1 // 2 // Copyright © 2017 Arm Ltd. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 6 #include "NeonWorkloadFactoryHelper.hpp" 7 8 #include <layers/ConvertFp16ToFp32Layer.hpp> 9 #include <layers/ConvertFp32ToFp16Layer.hpp> 10 #include <armnnTestUtils/TensorHelpers.hpp> 11 12 #include <armnn/backends/TensorHandle.hpp> 13 #include <neon/NeonWorkloadFactory.hpp> 14 #include <backendsCommon/test/IsLayerSupportedTestImpl.hpp> 15 #include <backendsCommon/test/LayerTests.hpp> 16 17 #include <doctest/doctest.h> 18 19 #include <string> 20 21 TEST_SUITE("NeonLayerSupport") 22 { 23 TEST_CASE("IsLayerSupportedFloat16Neon") 24 { 25 armnn::NeonWorkloadFactory factory = 26 NeonWorkloadFactoryHelper::GetFactory(NeonWorkloadFactoryHelper::GetMemoryManager()); 27 IsLayerSupportedTests<armnn::NeonWorkloadFactory, armnn::DataType::Float16>(&factory); 28 } 29 30 TEST_CASE("IsLayerSupportedFloat32Neon") 31 { 32 armnn::NeonWorkloadFactory factory = 33 NeonWorkloadFactoryHelper::GetFactory(NeonWorkloadFactoryHelper::GetMemoryManager()); 34 IsLayerSupportedTests<armnn::NeonWorkloadFactory, armnn::DataType::Float32>(&factory); 35 } 36 37 TEST_CASE("IsLayerSupportedQAsymmU8Neon") 38 { 39 armnn::NeonWorkloadFactory factory = 40 NeonWorkloadFactoryHelper::GetFactory(NeonWorkloadFactoryHelper::GetMemoryManager()); 41 IsLayerSupportedTests<armnn::NeonWorkloadFactory, armnn::DataType::QAsymmU8>(&factory); 42 } 43 44 TEST_CASE("IsLayerSupportedQAsymmS8Neon") 45 { 46 armnn::NeonWorkloadFactory factory = 47 NeonWorkloadFactoryHelper::GetFactory(NeonWorkloadFactoryHelper::GetMemoryManager()); 48 IsLayerSupportedTests<armnn::NeonWorkloadFactory, armnn::DataType::QAsymmS8>(&factory); 49 } 50 51 TEST_CASE("IsLayerSupportedQSymmS8Neon") 52 { 53 armnn::NeonWorkloadFactory factory = 54 NeonWorkloadFactoryHelper::GetFactory(NeonWorkloadFactoryHelper::GetMemoryManager()); 55 IsLayerSupportedTests<armnn::NeonWorkloadFactory, armnn::DataType::QSymmS8>(&factory); 56 } 57 58 TEST_CASE("IsConvertFp16ToFp32SupportedNeon") 59 { 60 std::string reasonIfUnsupported; 61 62 bool result = IsConvertLayerSupportedTests<armnn::NeonWorkloadFactory, armnn::ConvertFp16ToFp32Layer, 63 armnn::DataType::Float16, armnn::DataType::Float32>(reasonIfUnsupported); 64 65 CHECK(result); 66 } 67 68 TEST_CASE("IsConvertFp32ToFp16SupportedNeon") 69 { 70 std::string reasonIfUnsupported; 71 72 bool result = IsConvertLayerSupportedTests<armnn::NeonWorkloadFactory, armnn::ConvertFp32ToFp16Layer, 73 armnn::DataType::Float32, armnn::DataType::Float16>(reasonIfUnsupported); 74 75 CHECK(result); 76 } 77 78 TEST_CASE("IsLogicalBinarySupportedNeon") 79 { 80 std::string reasonIfUnsupported; 81 82 bool result = IsLogicalBinaryLayerSupportedTests<armnn::NeonWorkloadFactory, 83 armnn::DataType::Boolean, armnn::DataType::Boolean>(reasonIfUnsupported); 84 85 CHECK(result); 86 } 87 88 TEST_CASE("IsLogicalBinaryBroadcastSupportedNeon") 89 { 90 std::string reasonIfUnsupported; 91 92 bool result = IsLogicalBinaryLayerBroadcastSupportedTests<armnn::NeonWorkloadFactory, 93 armnn::DataType::Boolean, armnn::DataType::Boolean>(reasonIfUnsupported); 94 95 CHECK(result); 96 } 97 98 TEST_CASE("IsMeanSupportedNeon") 99 { 100 std::string reasonIfUnsupported; 101 102 bool result = IsMeanLayerSupportedTests<armnn::NeonWorkloadFactory, 103 armnn::DataType::Float32, armnn::DataType::Float32>(reasonIfUnsupported); 104 105 CHECK(result); 106 } 107 108 TEST_CASE("IsConstantSupportedNeon") 109 { 110 std::string reasonIfUnsupported; 111 112 bool result = IsConstantLayerSupportedTests<armnn::NeonWorkloadFactory, 113 armnn::DataType::Float16>(reasonIfUnsupported); 114 CHECK(result); 115 116 result = IsConstantLayerSupportedTests<armnn::NeonWorkloadFactory, 117 armnn::DataType::Float32>(reasonIfUnsupported); 118 CHECK(result); 119 120 result = IsConstantLayerSupportedTests<armnn::NeonWorkloadFactory, 121 armnn::DataType::QAsymmU8>(reasonIfUnsupported); 122 CHECK(result); 123 124 result = IsConstantLayerSupportedTests<armnn::NeonWorkloadFactory, 125 armnn::DataType::Boolean>(reasonIfUnsupported); 126 CHECK(!result); 127 128 result = IsConstantLayerSupportedTests<armnn::NeonWorkloadFactory, 129 armnn::DataType::QSymmS16>(reasonIfUnsupported); 130 CHECK(result); 131 132 result = IsConstantLayerSupportedTests<armnn::NeonWorkloadFactory, 133 armnn::DataType::QSymmS8>(reasonIfUnsupported); 134 CHECK(result); 135 136 result = IsConstantLayerSupportedTests<armnn::NeonWorkloadFactory, 137 armnn::DataType::QAsymmS8>(reasonIfUnsupported); 138 CHECK(result); 139 140 result = IsConstantLayerSupportedTests<armnn::NeonWorkloadFactory, 141 armnn::DataType::BFloat16>(reasonIfUnsupported); 142 CHECK(result); 143 } 144 145 } 146