aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2020-09-04 20:20:56 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2020-09-07 12:37:27 +0000
commit8a14b2ca62c43a2691066ce374949c2501ae8315 (patch)
treedc262d9b720ca1caadcc39ee065e66502889e354
parent903f8cca78502a9e3835e6ec42caa1f816274600 (diff)
downloadComputeLibrary-8a14b2ca62c43a2691066ce374949c2501ae8315.tar.gz
COMPMID-3748: Compiler issue with Bfloat16 on gcc8
Treat bf16 memory on memset as raw memory by casting to void*. This hides the class-memaccess warning and is safe for the current class layout of arm_compute::bfloat16 Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: I5e242827d3737b4491d29abe7570eefee5b6edc1 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3928 Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h22
-rw-r--r--src/core/CL/kernels/CLDepthToSpaceLayerKernel.cpp2
-rw-r--r--src/core/CL/kernels/CLSpaceToDepthLayerKernel.cpp2
-rw-r--r--src/core/NEON/kernels/NEDepthToSpaceLayerKernel.cpp4
-rw-r--r--src/core/NEON/kernels/NEIm2ColKernel.cpp6
-rw-r--r--src/graph/nodes/DepthToSpaceLayerNode.cpp2
6 files changed, 19 insertions, 19 deletions
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index f2f5a30b6a..72b7675749 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -1083,24 +1083,24 @@ inline TensorShape compute_batch_to_space_shape(const ITensorInfo *input, const
/** Calculate the depth to space output shape of a tensor
*
- * @param[in] input Input tensor info
- * @param[in] block Block shape value
+ * @param[in] input_shape Input tensor shape
+ * @param[in] data_layout Operation data layout
+ * @param[in] block Block shape value
*
* @return the calculated shape
*/
-inline TensorShape compute_depth_to_space_shape(const ITensorInfo *input, int block)
+inline TensorShape compute_depth_to_space_shape(const TensorShape &input_shape, DataLayout data_layout, int block)
{
ARM_COMPUTE_ERROR_ON(block < 2);
- const DataLayout data_layout = input->data_layout();
- const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
- const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
- const int idx_channel = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL);
+ const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
+ const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
+ const int idx_channel = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL);
- TensorShape output_shape{ input->tensor_shape() };
- output_shape.set(idx_width, input->dimension(idx_width) * block);
- output_shape.set(idx_height, input->dimension(idx_height) * block);
- output_shape.set(idx_channel, input->dimension(idx_channel) / (block * block));
+ TensorShape output_shape{ input_shape };
+ output_shape.set(idx_width, input_shape[idx_width] * block);
+ output_shape.set(idx_height, input_shape[idx_height] * block);
+ output_shape.set(idx_channel, input_shape[idx_channel] / (block * block));
return output_shape;
}
diff --git a/src/core/CL/kernels/CLDepthToSpaceLayerKernel.cpp b/src/core/CL/kernels/CLDepthToSpaceLayerKernel.cpp
index b16c961547..e6f909e884 100644
--- a/src/core/CL/kernels/CLDepthToSpaceLayerKernel.cpp
+++ b/src/core/CL/kernels/CLDepthToSpaceLayerKernel.cpp
@@ -74,7 +74,7 @@ void CLDepthToSpaceLayerKernel::configure(const CLCompileContext &compile_contex
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
- TensorShape output_shape = compute_depth_to_space_shape(input->info(), block_shape);
+ TensorShape output_shape = compute_depth_to_space_shape(input->info()->tensor_shape(), input->info()->data_layout(), block_shape);
auto_init_if_empty(*output->info(), output_shape, 1, input->info()->data_type());
ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), block_shape));
diff --git a/src/core/CL/kernels/CLSpaceToDepthLayerKernel.cpp b/src/core/CL/kernels/CLSpaceToDepthLayerKernel.cpp
index 877d42681f..4b6c1be8c2 100644
--- a/src/core/CL/kernels/CLSpaceToDepthLayerKernel.cpp
+++ b/src/core/CL/kernels/CLSpaceToDepthLayerKernel.cpp
@@ -75,7 +75,7 @@ void CLSpaceToDepthLayerKernel::configure(const CLCompileContext &compile_contex
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
- TensorShape output_shape = compute_depth_to_space_shape(input->info(), block_shape);
+ TensorShape output_shape = compute_space_to_depth_shape(input->info(), block_shape);
auto_init_if_empty(*output->info(), output_shape, 1, input->info()->data_type());
ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), block_shape));
diff --git a/src/core/NEON/kernels/NEDepthToSpaceLayerKernel.cpp b/src/core/NEON/kernels/NEDepthToSpaceLayerKernel.cpp
index 618a1baf07..d012cbfded 100644
--- a/src/core/NEON/kernels/NEDepthToSpaceLayerKernel.cpp
+++ b/src/core/NEON/kernels/NEDepthToSpaceLayerKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Arm Limited.
+ * Copyright (c) 2019-2020 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -71,7 +71,7 @@ NEDepthToSpaceLayerKernel::NEDepthToSpaceLayerKernel()
void NEDepthToSpaceLayerKernel::configure(const ITensor *input, ITensor *output, int32_t block_shape)
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
- TensorShape output_shape = compute_depth_to_space_shape(input->info(), block_shape);
+ TensorShape output_shape = compute_depth_to_space_shape(input->info()->tensor_shape(), input->info()->data_layout(), block_shape);
// Output auto inizialitation if not yet initialized
auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(output_shape));
diff --git a/src/core/NEON/kernels/NEIm2ColKernel.cpp b/src/core/NEON/kernels/NEIm2ColKernel.cpp
index 1a2b95e8d6..6eae0541aa 100644
--- a/src/core/NEON/kernels/NEIm2ColKernel.cpp
+++ b/src/core/NEON/kernels/NEIm2ColKernel.cpp
@@ -161,7 +161,7 @@ inline void linearize_volume_nchw(const uint8_t *const in_ptr,
if((y < 0 || y >= input_h) && has_pads)
{
// All the values will be the offset (will be zeros when not quantized)
- memset(out_ptr, pad_value, kernel_width * sizeof(T));
+ memset(static_cast<void *>(out_ptr), pad_value, kernel_width * sizeof(T));
out_ptr += kernel_width;
}
else
@@ -224,7 +224,7 @@ inline void linearize_volume_nhwc(const uint8_t *const in_ptr,
{
if(y < 0 || y >= input_h)
{
- memset(out_ptr, pad_value, pad_quant * element_size);
+ memset(static_cast<void *>(out_ptr), pad_value, pad_quant * element_size);
out_ptr += pad_quant;
}
else if(dilation_x > 1 || start_x < 0 || end_x >= input_w || input_stride_y != input_c * element_size)
@@ -233,7 +233,7 @@ inline void linearize_volume_nhwc(const uint8_t *const in_ptr,
{
if(x < 0 || x >= input_w)
{
- memset(out_ptr, pad_value, input_c * element_size);
+ memset(static_cast<void *>(out_ptr), pad_value, input_c * element_size);
out_ptr += input_c;
}
else
diff --git a/src/graph/nodes/DepthToSpaceLayerNode.cpp b/src/graph/nodes/DepthToSpaceLayerNode.cpp
index 785e850533..b70ac56a07 100644
--- a/src/graph/nodes/DepthToSpaceLayerNode.cpp
+++ b/src/graph/nodes/DepthToSpaceLayerNode.cpp
@@ -53,7 +53,7 @@ TensorDescriptor DepthToSpaceLayerNode::compute_output_descriptor(const TensorDe
// Set descriptor shape
TensorDescriptor output_descriptor = input_descriptor;
- output_descriptor.shape = compute_depth_to_space_output_shape(input_shape, data_layout, block_shape);
+ output_descriptor.shape = misc::shape_calculator::compute_depth_to_space_shape(input_shape, data_layout, block_shape);
return output_descriptor;
}