From a9676118fd2a0e5bc916969af83ecee049bae76b Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Thu, 22 Feb 2018 18:07:43 +0000 Subject: COMPMID-886 Don't use LWS hints by default for GPU post Mali-G72 Change-Id: I64cb2d7f9513d69aebd9307a803b1b2c9c0e04c3 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/121929 Reviewed-by: Anthony Barbier Tested-by: Jenkins --- arm_compute/core/CL/CLHelpers.h | 29 +++++- arm_compute/core/CL/CLTypes.h | 12 ++- arm_compute/core/CL/ICLKernel.h | 2 +- src/core/CL/CLHelpers.cpp | 108 +++++++++++++++------ src/core/CL/CLKernelLibrary.cpp | 18 +++- src/core/CL/kernels/CLCol2ImKernel.cpp | 4 +- .../CLDepthwiseConvolutionLayer3x3Kernel.cpp | 4 +- src/core/CL/kernels/CLDepthwiseIm2ColKernel.cpp | 5 +- .../CL/kernels/CLDirectConvolutionLayerKernel.cpp | 6 +- .../kernels/CLGEMMMatrixAccumulateBiasesKernel.cpp | 10 +- src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp | 55 ++++++++--- .../kernels/CLGEMMMatrixVectorMultiplyKernel.cpp | 4 +- src/core/CL/kernels/CLIm2ColKernel.cpp | 4 +- src/core/CL/kernels/CLPoolingLayerKernel.cpp | 4 +- src/runtime/CL/functions/CLGEMM.cpp | 4 +- .../CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp | 2 +- tests/validation/CL/ConvolutionLayer.cpp | 2 +- tests/validation/CL/UNIT/Helpers.cpp | 65 +++++++++++++ utils/TypePrinter.h | 25 ++++- 19 files changed, 288 insertions(+), 75 deletions(-) create mode 100644 tests/validation/CL/UNIT/Helpers.cpp diff --git a/arm_compute/core/CL/CLHelpers.h b/arm_compute/core/CL/CLHelpers.h index 365ecb06c4..66423d648a 100644 --- a/arm_compute/core/CL/CLHelpers.h +++ b/arm_compute/core/CL/CLHelpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -103,6 +103,14 @@ std::unique_ptr create_kernel() return k; } +/** Helper function to get the GPU target from a device name + * + * @param[in] device_name A device name + * + * @return the GPU target + */ +GPUTarget get_target_from_name(const std::string &device_name); + /** Helper function to get the GPU target from CL device * * @param[in] device A CL device @@ -140,5 +148,24 @@ bool fp16_support(const cl::Device &device); * @return True if the extension is supported */ bool non_uniform_workgroup_support(const cl::Device &device); +/** Helper function to check whether a gpu target is equal to the provided targets + * + * @param[in] target_to_check gpu target to check + * @param[in] target First target to compare against + * @param[in] targets (Optional) Additional targets to compare with + * + * @return True if the target is equal with at least one of the targets. + */ +template +bool gpu_target_is_in(GPUTarget target_to_check, GPUTarget target, Args... targets) +{ + return (target_to_check == target) | gpu_target_is_in(target_to_check, targets...); +} + +/** Variant of gpu_target_is_in for comparing two targets */ +inline bool gpu_target_is_in(GPUTarget target_to_check, GPUTarget target) +{ + return target_to_check == target; +} } #endif /* __ARM_COMPUTE_CLHELPERS_H__ */ diff --git a/arm_compute/core/CL/CLTypes.h b/arm_compute/core/CL/CLTypes.h index 05f9e2e119..c207ec7611 100644 --- a/arm_compute/core/CL/CLTypes.h +++ b/arm_compute/core/CL/CLTypes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -34,13 +34,21 @@ static const std::string default_config_id = "no_config_id"; /** Available GPU Targets */ enum class GPUTarget { + UNKNOWN = 0x000, GPU_ARCH_MASK = 0xF00, MIDGARD = 0x100, BIFROST = 0x200, T600 = 0x110, T700 = 0x120, T800 = 0x130, - G70 = 0x210 + G71 = 0x210, + G72 = 0x220, + G51 = 0x230, + G51BIG = 0x231, + G51LIT = 0x232, + TNOX = 0x240, + TTRX = 0x250, + TBOX = 0x260 }; /* Available OpenCL Version */ diff --git a/arm_compute/core/CL/ICLKernel.h b/arm_compute/core/CL/ICLKernel.h index e660ae55a0..f331df2996 100644 --- a/arm_compute/core/CL/ICLKernel.h +++ b/arm_compute/core/CL/ICLKernel.h @@ -287,7 +287,7 @@ protected: * @param[in,out] queue OpenCL command queue. * @param[in] kernel Kernel to enqueue * @param[in] window Window the kernel has to process. - * @param[in] lws_hint Local workgroup size requested, by default (128,1). + * @param[in] lws_hint Local workgroup size requested. Default is based on the device target. * * @note If any dimension of the lws is greater than the global workgroup size then no lws will be passed. */ diff --git a/src/core/CL/CLHelpers.cpp b/src/core/CL/CLHelpers.cpp index ef517aa589..eb1b06e7a8 100644 --- a/src/core/CL/CLHelpers.cpp +++ b/src/core/CL/CLHelpers.cpp @@ -35,9 +35,37 @@ namespace { arm_compute::GPUTarget get_bifrost_target(const std::string &version) { - if(version == "70") + if(version == "G71") { - return arm_compute::GPUTarget::G70; + return arm_compute::GPUTarget::G71; + } + else if(version == "G72") + { + return arm_compute::GPUTarget::G72; + } + else if(version == "G51") + { + return arm_compute::GPUTarget::G51; + } + else if(version == "G51BIG") + { + return arm_compute::GPUTarget::G51BIG; + } + else if(version == "G51LIT") + { + return arm_compute::GPUTarget::G51LIT; + } + else if(version == "TNOX") + { + return arm_compute::GPUTarget::TNOX; + } + else if(version == "TTRX") + { + return arm_compute::GPUTarget::TTRX; + } + else if(version == "TBOX") + { + return arm_compute::GPUTarget::TBOX; } else { @@ -47,16 +75,21 @@ arm_compute::GPUTarget get_bifrost_target(const std::string &version) arm_compute::GPUTarget get_midgard_target(const std::string &version) { - switch(version[0]) - { - case '6': - return arm_compute::GPUTarget::T600; - case '7': - return arm_compute::GPUTarget::T700; - case '8': - return arm_compute::GPUTarget::T800; - default: - return arm_compute::GPUTarget::MIDGARD; + if(version == "T600") + { + return arm_compute::GPUTarget::T600; + } + else if(version == "T700") + { + return arm_compute::GPUTarget::T700; + } + else if(version == "T800") + { + return arm_compute::GPUTarget::T800; + } + else + { + return arm_compute::GPUTarget::MIDGARD; } } @@ -159,39 +192,58 @@ const std::string &string_from_target(GPUTarget target) { GPUTarget::T600, "t600" }, { GPUTarget::T700, "t700" }, { GPUTarget::T800, "t800" }, - { GPUTarget::G70, "g70" } + { GPUTarget::G71, "g71" }, + { GPUTarget::G72, "g72" }, + { GPUTarget::G51, "g51" }, + { GPUTarget::G51BIG, "g51big" }, + { GPUTarget::G51LIT, "g51lit" }, + { GPUTarget::TNOX, "tnox" }, + { GPUTarget::TTRX, "ttrx" }, + { GPUTarget::TBOX, "tbox" } }; return gpu_target_map[target]; } -GPUTarget get_target_from_device(cl::Device &device) +GPUTarget get_target_from_name(const std::string &device_name) { - // Query device name size - std::string device_name = device.getInfo(); - std::regex mali_regex(R"(Mali-([TG])(\d+))"); + std::regex mali_regex(R"(Mali-(.*))"); std::smatch name_parts; const bool found_mali = std::regex_search(device_name, name_parts, mali_regex); if(!found_mali) { - ARM_COMPUTE_LOG_INFO_MSG_CORE("Can't find valid Mali GPU. Target is set to MIDGARD."); - return GPUTarget::MIDGARD; + ARM_COMPUTE_LOG_INFO_MSG_CORE("Can't find valid Mali GPU. Target is set to UNKNOWN."); + return GPUTarget::UNKNOWN; } const char target = name_parts.str(1)[0]; - const std::string &version = name_parts.str(2); + const std::string &version = name_parts.str(1); + + std::regex future_regex(R"(.*X)"); + const bool is_future_bifrost = std::regex_search(version, future_regex); - switch(target) + if(target == 'G' || is_future_bifrost) { - case 'T': - return get_midgard_target(version); - case 'G': - return get_bifrost_target(version); - default: - ARM_COMPUTE_LOG_INFO_MSG_CORE("Mali GPU unknown. Target is set to the default one."); - return GPUTarget::MIDGARD; + return get_bifrost_target(version); + } + else if(target == 'T') + { + return get_midgard_target(version); } + else + { + ARM_COMPUTE_LOG_INFO_MSG_CORE("Mali GPU unknown. Target is set to the default one."); + return GPUTarget::UNKNOWN; + } +} + +GPUTarget get_target_from_device(cl::Device &device) +{ + // Query device name size + std::string device_name = device.getInfo(); + + return get_target_from_name(device_name); } GPUTarget get_arch_from_target(GPUTarget target) diff --git a/src/core/CL/CLKernelLibrary.cpp b/src/core/CL/CLKernelLibrary.cpp index caf017d984..aba20448e7 100644 --- a/src/core/CL/CLKernelLibrary.cpp +++ b/src/core/CL/CLKernelLibrary.cpp @@ -838,7 +838,23 @@ size_t CLKernelLibrary::max_local_workgroup_size(const cl::Kernel &kernel) const cl::NDRange CLKernelLibrary::default_ndrange() const { - return cl::NDRange(128u, 1); + cl::Device device = cl::Device::getDefault(); + GPUTarget _target = get_target_from_device(device); + cl::NDRange default_range; + + switch(_target) + { + case GPUTarget::MIDGARD: + case GPUTarget::T600: + case GPUTarget::T700: + case GPUTarget::T800: + default_range = cl::NDRange(128u, 1); + break; + default: + default_range = cl::NullRange; + } + + return default_range; } std::string CLKernelLibrary::get_device_version() diff --git a/src/core/CL/kernels/CLCol2ImKernel.cpp b/src/core/CL/kernels/CLCol2ImKernel.cpp index 8ccec06c37..c66d64332a 100644 --- a/src/core/CL/kernels/CLCol2ImKernel.cpp +++ b/src/core/CL/kernels/CLCol2ImKernel.cpp @@ -111,8 +111,8 @@ void CLCol2ImKernel::configure(const ICLTensor *input, ICLTensor *output, std::p // Configure the local work size for Bifrost with a value obtained // via exhaustive autotuning over 30 representative tensor shapes. - const GPUTarget gpu_target = get_arch_from_target(get_target()); - if(gpu_target == GPUTarget::BIFROST) + const GPUTarget gpu_target = get_target(); + if(gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72)) { if((_convolved_dims.first == 7) || (_convolved_dims.first == 14)) { diff --git a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3Kernel.cpp b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3Kernel.cpp index 29564b36c9..7a47bcc704 100644 --- a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3Kernel.cpp +++ b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3Kernel.cpp @@ -118,7 +118,7 @@ void CLDepthwiseConvolutionLayer3x3Kernel::configure(const ICLTensor *input, con // Configure the local work size for Bifrost with a value obtained // via exhaustive autotuning for the MobileNets tensor shapes. - const GPUTarget gpu_target = get_arch_from_target(get_target()); + const GPUTarget gpu_target = get_target(); // Configure kernel window unsigned int num_elems_read_per_iteration_x = 0; @@ -151,7 +151,7 @@ void CLDepthwiseConvolutionLayer3x3Kernel::configure(const ICLTensor *input, con break; } } - else if(input->info()->data_type() == DataType::F32 && gpu_target == GPUTarget::BIFROST) + else if(input->info()->data_type() == DataType::F32 && gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72)) { if(_conv_stride_x == 1 && _conv_stride_y == 1) { diff --git a/src/core/CL/kernels/CLDepthwiseIm2ColKernel.cpp b/src/core/CL/kernels/CLDepthwiseIm2ColKernel.cpp index 9851475928..18d64a1a9d 100644 --- a/src/core/CL/kernels/CLDepthwiseIm2ColKernel.cpp +++ b/src/core/CL/kernels/CLDepthwiseIm2ColKernel.cpp @@ -77,8 +77,9 @@ void CLDepthwiseIm2ColKernel::configure(const ICLTensor *input, ICLTensor *outpu // Configure the local work size for Bifrost with a value obtained // via exhaustive autotuning for the MobileNets tensor shapes. - const GPUTarget gpu_target = get_arch_from_target(get_target()); - if(gpu_target == GPUTarget::BIFROST) + const GPUTarget gpu_target = get_target(); + + if(gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72)) { _lws_hint = cl::NDRange(1, 2, 1); } diff --git a/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp b/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp index c01a6660a7..56ac0c7250 100644 --- a/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp +++ b/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp @@ -134,7 +134,7 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen unsigned int num_elems_written_per_iteration_x = 0; unsigned int num_elems_written_per_iteration_y = 0; - if((target == GPUTarget::BIFROST) && (kernel_size <= 5) && (conv_stride_x == 1) && (conv_stride_y == 1) && (data_type == DataType::F32)) + if(gpu_target_is_in(target, GPUTarget::G71, GPUTarget::G72) && (kernel_size <= 5) && (conv_stride_x == 1) && (conv_stride_y == 1) && (data_type == DataType::F32)) { // Configure kernel window @@ -301,7 +301,7 @@ void CLDirectConvolutionLayerKernel::configure(const ICLTensor *input, const ICL _output = output; _biases = biases; - const GPUTarget gpu_target = get_arch_from_target(get_target()); + const GPUTarget gpu_target = get_target(); std::stringstream kernel_name; kernel_name << "direct_convolution" << kernel_size << "x" << kernel_size; @@ -309,7 +309,7 @@ void CLDirectConvolutionLayerKernel::configure(const ICLTensor *input, const ICL CLBuildOptions build_options; build_options.add_option_if(_biases != nullptr, std::string("-DHAS_BIAS")); - if((gpu_target == GPUTarget::BIFROST) && (kernel_size <= 5) && (_conv_stride_x == 1) && (_conv_stride_y == 1) && (data_type == DataType::F32)) + if(gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72) && (kernel_size <= 5) && (_conv_stride_x == 1) && (_conv_stride_y == 1) && (data_type == DataType::F32)) { build_options.add_option(std::string("-DWEIGHTS_DEPTH=" + support::cpp11::to_string(_weights->info()->dimension(2)))); diff --git a/src/core/CL/kernels/CLGEMMMatrixAccumulateBiasesKernel.cpp b/src/core/CL/kernels/CLGEMMMatrixAccumulateBiasesKernel.cpp index d5c93dd24a..3309775c36 100644 --- a/src/core/CL/kernels/CLGEMMMatrixAccumulateBiasesKernel.cpp +++ b/src/core/CL/kernels/CLGEMMMatrixAccumulateBiasesKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -52,7 +52,7 @@ std::pair validate_and_configure_window(ITensorInfo *accum, ITen unsigned int &num_elems_processed_per_iteration) { // Select the vector size to use (8 for Bifrost; 16 for Midgard). - num_elems_processed_per_iteration = (gpu_target == GPUTarget::BIFROST) ? 8 : 16; + num_elems_processed_per_iteration = gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72) ? 8 : 16; // Configure kernel window Window win = calculate_max_window(*accum, Steps(num_elems_processed_per_iteration)); @@ -81,12 +81,12 @@ void CLGEMMMatrixAccumulateBiasesKernel::configure(ICLTensor *accum, const ICLTe _biases = biases; _accum = accum; - // Get the target architecture - GPUTarget arch_target = get_arch_from_target(get_target()); + // Get the target gpu + GPUTarget gpu_target = get_target(); unsigned int vector_size = 0; // Configure kernel window - auto win_config = validate_and_configure_window(accum->info(), biases->info(), arch_target, vector_size); + auto win_config = validate_and_configure_window(accum->info(), biases->info(), gpu_target, vector_size); ARM_COMPUTE_ERROR_THROW_ON(win_config.first); ICLKernel::configure(win_config.second); diff --git a/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp b/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp index 6655d12d7e..9c69800928 100644 --- a/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp +++ b/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp @@ -139,7 +139,8 @@ inline std::pair validate_and_configure_window(ITensorInfo *inpu num_elems_processed_per_iteration_y = std::min(static_cast(output->dimension(1)), 4); // Create kernels according to the architecture, data type and input size. - if(gpu_target == GPUTarget::BIFROST && data_type == DataType::F32) + GPUTarget arch_target = get_arch_from_target(gpu_target); + if(arch_target == GPUTarget::BIFROST && data_type == DataType::F32) { num_elems_processed_per_iteration_x = (input1->dimension(0) <= 1000 && input0->num_dimensions() == 1) ? 2 : 4; } @@ -199,27 +200,48 @@ void CLGEMMMatrixMultiplyKernel::configure(const ICLTensor *input0, const ICLTen const int fp_pos = input0->info()->fixed_point_position(); // Get target architecture - GPUTarget arch_target = get_arch_from_target(get_target()); + GPUTarget gpu_target = get_target(); // Configure LWS hint - if(arch_target == GPUTarget::BIFROST && input1->info()->dimension(1) == 24) - { - // LWS optimized for the 11x11 AlexNet convolution on Bifrost. - _lws_hint = cl::NDRange(2, 2); - } - else if(output->info()->dimension(1) == 196) + switch(gpu_target) { - _lws_hint = cl::NDRange(1, 7); - } - else - { - _lws_hint = cl::NDRange(8, 8); + case GPUTarget::MIDGARD: + case GPUTarget::T600: + case GPUTarget::T700: + case GPUTarget::T800: + if(output->info()->dimension(1) == 196) + { + _lws_hint = cl::NDRange(1, 7); + } + else + { + _lws_hint = cl::NDRange(8, 8); + } + break; + case GPUTarget::G71: + case GPUTarget::G72: + if(input1->info()->dimension(1) == 24) + { + // LWS optimized for the 11x11 AlexNet convolution on Bifrost. + _lws_hint = cl::NDRange(2, 2); + } + else if(output->info()->dimension(1) == 196) + { + _lws_hint = cl::NDRange(1, 7); + } + else + { + _lws_hint = cl::NDRange(8, 8); + } + break; + default: + _lws_hint = cl::NullRange; } ElementsProcessed num_elements_processed{}; // Configure kernel window - auto win_config = validate_and_configure_window(input0->info(), input1->info(), output->info(), is_interleaved_transposed, arch_target, num_elements_processed); + auto win_config = validate_and_configure_window(input0->info(), input1->info(), output->info(), is_interleaved_transposed, gpu_target, num_elements_processed); ARM_COMPUTE_ERROR_THROW_ON(win_config.first); ICLKernel::configure(win_config.second); @@ -247,7 +269,8 @@ void CLGEMMMatrixMultiplyKernel::configure(const ICLTensor *input0, const ICLTen if(data_type == DataType::F32) { - kernel_name = "gemm_mm_interleaved_transposed_f32_" + string_from_target(arch_target); + GPUTarget arch_target = get_arch_from_target(gpu_target); + kernel_name = "gemm_mm_interleaved_transposed_f32_" + string_from_target(arch_target); } else { @@ -259,7 +282,7 @@ void CLGEMMMatrixMultiplyKernel::configure(const ICLTensor *input0, const ICLTen build_opts.add_option("-DCOLS_A=" + support::cpp11::to_string(input0->info()->dimension(0))); // Create kernels according to the architecture, data type and input size. - if(arch_target == GPUTarget::BIFROST && data_type == DataType::F32) + if((gpu_target == GPUTarget::G71 || gpu_target == GPUTarget::G72) && data_type == DataType::F32) { // The first kernel is optimized for the case of 1000 or less output elements (e.g. FC8 of AlexNet and VGG-16, and // FC1 of Inception v3). The second kernel is optimized for the case of greater than 1000 output elements (e.g. diff --git a/src/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.cpp b/src/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.cpp index cc483dc44e..87e624cc74 100644 --- a/src/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.cpp +++ b/src/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.cpp @@ -77,8 +77,8 @@ void CLGEMMMatrixVectorMultiplyKernel::configure(const ICLTensor *input0, const // Configure the local work size for Bifrost with a value obtained // via exhaustive autotuning for the MobileNets tensor shapes. - const GPUTarget gpu_target = get_arch_from_target(get_target()); - if(gpu_target == GPUTarget::BIFROST) + const GPUTarget gpu_target = get_target(); + if(gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72)) { _lws_hint = cl::NDRange(1, 1, 1); } diff --git a/src/core/CL/kernels/CLIm2ColKernel.cpp b/src/core/CL/kernels/CLIm2ColKernel.cpp index b75d2646c6..9bc4787384 100644 --- a/src/core/CL/kernels/CLIm2ColKernel.cpp +++ b/src/core/CL/kernels/CLIm2ColKernel.cpp @@ -75,7 +75,7 @@ void CLIm2ColKernel::configure(const ICLTensor *input, ICLTensor *output, const _kernel_dims = kernel_dims; const DataType data_type = input->info()->data_type(); - const GPUTarget gpu_target = get_arch_from_target(get_target()); + const GPUTarget gpu_target = get_target(); // Create kernel CLBuildOptions build_opts; @@ -185,7 +185,7 @@ void CLIm2ColKernel::configure(const ICLTensor *input, ICLTensor *output, const vector_size = kernel_dims.width; } // Local work size and vector size optimized for the 11x11 AlexNet convolution on Bifrost. - if(gpu_target == GPUTarget::BIFROST && kernel_dims.width == 11) + if(gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72) && kernel_dims.width == 11) { _lws_hint = cl::NDRange(1, 1, 1); vector_size = 8; diff --git a/src/core/CL/kernels/CLPoolingLayerKernel.cpp b/src/core/CL/kernels/CLPoolingLayerKernel.cpp index b3034e10cc..d7b86e78f6 100644 --- a/src/core/CL/kernels/CLPoolingLayerKernel.cpp +++ b/src/core/CL/kernels/CLPoolingLayerKernel.cpp @@ -190,7 +190,7 @@ void CLPoolingLayerKernel::configure(const ICLTensor *input, ICLTensor *output, _output = output; _pool_info = pool_info; - const GPUTarget gpu_target = get_arch_from_target(get_target()); + const GPUTarget gpu_target = get_target(); const DataType data_type = input->info()->data_type(); // Set build options @@ -240,7 +240,7 @@ void CLPoolingLayerKernel::configure(const ICLTensor *input, ICLTensor *output, // On Bifrost, this works for up to 35x35xC filters, for which the pooling_layer_3_optimized // kernel is launched with gws=(9, 33, C). In any case, the hint will be ignored if it is // invalid (e.g. exceeds the maximum workgroup size that the kernel can be launched with). - if(gpu_target == GPUTarget::BIFROST) + if(gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72)) { cl::NDRange gws = ICLKernel::gws_from_window(std::get<1>(win_config)); _lws_hint = cl::NDRange(gws[0], gws[1], 1); diff --git a/src/runtime/CL/functions/CLGEMM.cpp b/src/runtime/CL/functions/CLGEMM.cpp index da00d2dc64..e6f8f266d8 100644 --- a/src/runtime/CL/functions/CLGEMM.cpp +++ b/src/runtime/CL/functions/CLGEMM.cpp @@ -44,7 +44,7 @@ inline bool is_interleaved_transposed(int m, int n, int k, DataType data_type, b { bool flag = true; - if(gpu_target == GPUTarget::BIFROST) + if(gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72)) { // COMPMID-852 if(k > 256 && m > 4 && data_type == DataType::F32 && reshape_b_only_on_first_run) @@ -122,7 +122,7 @@ void CLGEMM::configure(const ICLTensor *a, const ICLTensor *b, const ICLTensor * int mult_transpose1xW_width = 1; int mult_interleave4x4_height = 1; - if(gpu_target == GPUTarget::BIFROST) + if(gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72)) { mult_transpose1xW_width = 4; mult_interleave4x4_height = 2; diff --git a/src/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp b/src/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp index c688299d4f..c4f939e297 100644 --- a/src/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp +++ b/src/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp @@ -41,7 +41,7 @@ inline bool is_interleaved_transposed(int m, int n, int k, bool reshape_b_only_o { bool flag = true; - if(gpu_target == GPUTarget::BIFROST) + if(gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72)) { // COMPMID-852 if(k > 256 && m > 4 && reshape_b_only_on_first_run) diff --git a/tests/validation/CL/ConvolutionLayer.cpp b/tests/validation/CL/ConvolutionLayer.cpp index bbe4c6a271..98d00ac47a 100644 --- a/tests/validation/CL/ConvolutionLayer.cpp +++ b/tests/validation/CL/ConvolutionLayer.cpp @@ -98,7 +98,7 @@ DATA_TEST_CASE(ValidateConvolutionMethod, framework::DatasetMode::ALL, zip(zip(z })), framework::dataset::make("GpuTarget", { GPUTarget::BIFROST, GPUTarget::MIDGARD, - GPUTarget::G70, + GPUTarget::G71, GPUTarget::MIDGARD, GPUTarget::BIFROST })), diff --git a/tests/validation/CL/UNIT/Helpers.cpp b/tests/validation/CL/UNIT/Helpers.cpp new file mode 100644 index 0000000000..d651efcd5b --- /dev/null +++ b/tests/validation/CL/UNIT/Helpers.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2017-2018 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "arm_compute/core/CL/CLHelpers.h" +#include "support/ToolchainSupport.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/Utils.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +TEST_SUITE(UNIT) +TEST_SUITE(CLHelpers) + +TEST_CASE(GetGPUTargetFromName, framework::DatasetMode::ALL) +{ + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-T600") == GPUTarget::T600, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-T700") == GPUTarget::T700, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-T800") == GPUTarget::T800, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-G71") == GPUTarget::G71, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-G72") == GPUTarget::G72, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-G51") == GPUTarget::G51, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-G51BIG") == GPUTarget::G51BIG, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-G51LIT") == GPUTarget::G51LIT, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-TNOX") == GPUTarget::TNOX, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-TTRX") == GPUTarget::TTRX, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-TBOX") == GPUTarget::TBOX, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(get_target_from_name("Mali-T000") == GPUTarget::MIDGARD, framework::LogLevel::ERRORS); +} + +TEST_CASE(GPUTargetIsIn, framework::DatasetMode::ALL) +{ + ARM_COMPUTE_EXPECT(!gpu_target_is_in(GPUTarget::G71, GPUTarget::T600, GPUTarget::T800, GPUTarget::G72), framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(gpu_target_is_in(GPUTarget::G71, GPUTarget::T600, GPUTarget::T800, GPUTarget::G71), framework::LogLevel::ERRORS); +} +TEST_SUITE_END() // CLHelpers +TEST_SUITE_END() // UNIT +} // namespace validation +} // namespace test +} // namespace arm_compute diff --git a/utils/TypePrinter.h b/utils/TypePrinter.h index e5f860812d..17347159e1 100644 --- a/utils/TypePrinter.h +++ b/utils/TypePrinter.h @@ -1010,8 +1010,29 @@ inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_targe case GPUTarget::T800: os << "T800"; break; - case GPUTarget::G70: - os << "G70"; + case GPUTarget::G71: + os << "G71"; + break; + case GPUTarget::G72: + os << "G72"; + break; + case GPUTarget::G51: + os << "G51"; + break; + case GPUTarget::G51BIG: + os << "G51BIG"; + break; + case GPUTarget::G51LIT: + os << "G51LIT"; + break; + case GPUTarget::TNOX: + os << "TNOX"; + break; + case GPUTarget::TTRX: + os << "TTRX"; + break; + case GPUTarget::TBOX: + os << "TBOX"; break; default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); -- cgit v1.2.1