From 9d6ddfc8a0ea579fb2a46fab971f6827d93fc96b Mon Sep 17 00:00:00 2001 From: Sheri Zhang Date: Wed, 15 Sep 2021 13:10:18 +0100 Subject: Fix nightly cl_image not supported issue Resolves: COMPMID-4813 Signed-off-by: Sheri Zhang Change-Id: I773e5b1be2951431e072012fe393993411f68b66 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6269 Comments-Addressed: Arm Jenkins Reviewed-by: Gunes Bayir Reviewed-by: Giorgio Arena Tested-by: Arm Jenkins --- .../fixtures/DepthwiseConvolutionLayerFixture.h | 41 +++++++++++++--------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h') diff --git a/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h b/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h index ddbab7fe13..cecccc87bb 100644 --- a/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h +++ b/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h @@ -446,6 +446,19 @@ public: void configure_target() { +#if defined(ARM_COMPUTE_OPENCL_ENABLED) + if(_export_to_cl_image) + { + _validate_output &= image2d_from_buffer_supported(CLKernelLibrary::get().get_device()); + _validate_output &= (get_cl_image_pitch_alignment(CLKernelLibrary::get().get_device()) != 0); + } +#endif // ARM_COMPUTE_OPENCL_ENABLED + + if(!_validate_output) + { + return; + } + TensorShape input_shape = _input_shape; TensorShape weights_shape = _weights_shape; @@ -471,14 +484,6 @@ public: dwc_info.m0 = _conv_info.stride().first == 1 && _dilation.x() == 1 ? 8 : 1; dwc_info.export_weights_to_cl_image = _export_to_cl_image; -#if defined(ARM_COMPUTE_OPENCL_ENABLED) - if(_export_to_cl_image) - { - _validate_output |= image2d_from_buffer_supported(CLKernelLibrary::get().get_device()); - _validate_output |= (get_cl_image_pitch_alignment(CLKernelLibrary::get().get_device()) != 0); - } -#endif // ARM_COMPUTE_OPENCL_ENABLED - const ConvolutionInfo conv_kernel_info { _conv_info, _depth_multiplier, _act_info, _dilation @@ -498,6 +503,11 @@ public: void allocate_and_run_target() { + if(!_validate_output) + { + return; + } + // Allocate tensors _src.allocator()->allocate(); _weights.allocator()->allocate(); @@ -525,10 +535,7 @@ public: } // Compute function - if(_validate_output) - { - _dwc.run(); - } + _dwc.run(); // Reinstating original data layout for the test suite to properly check the values if(!_in_place) @@ -539,6 +546,11 @@ public: void compute_reference() { + if(!_validate_output) + { + return; + } + SimpleTensor src{ _input_shape, _data_type }; SimpleTensor weights{ _weights_shape, _data_type }; SimpleTensor biases{ _biases_shape, _data_type }; @@ -549,10 +561,7 @@ public: const ConvolutionInfo info{ _conv_info, _depth_multiplier, _act_info, _dilation }; const TensorShape dst_shape = compute_depthwise_convolution_shape(TensorInfo(_input_shape, 1, _data_type), TensorInfo(_weights_shape, 1, _data_type), info); - if(_validate_output) - { - _reference = reference::activation_layer(reference::depthwise_convolution(src, weights, biases, dst_shape, _conv_info, _depth_multiplier, _dilation), _act_info); - } + _reference = reference::activation_layer(reference::depthwise_convolution(src, weights, biases, dst_shape, _conv_info, _depth_multiplier, _dilation), _act_info); } protected: -- cgit v1.2.1