COMPMID-3887: NEGEMMConvolutionLayer hangs up on num_threads>18
authorSheri Zhang <sheri.zhang@arm.com>
Thu, 5 Nov 2020 10:43:37 +0000 (10:43 +0000)
committerGeorgios Pinitas <georgios.pinitas@arm.com>
Tue, 10 Nov 2020 10:44:47 +0000 (10:44 +0000)
When store the Tensor shape information, the size was clamped to 32bit, which cause the memory allocated is not big enough.

Signed-off-by: Sheri Zhang <sheri.zhang@arm.com>
Change-Id: I9f7dfcd5595a143b0ed4f6973e20bcd9d776b673
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4331
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
arm_compute/core/TensorShape.h
arm_compute/core/Window.inl
utils/GraphUtils.cpp

index 218774360ec511b23a49a574bea52c922560f599..b455a07767458e6dffc01f1d0fb0df22d227da4e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 Arm Limited.
+ * Copyright (c) 2016-2020 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -36,7 +36,7 @@
 namespace arm_compute
 {
 /** Shape of a tensor */
-class TensorShape : public Dimensions<uint32_t>
+class TensorShape : public Dimensions<size_t>
 {
 public:
     /** Constructor to initialize the tensor shape.
index 14a432a0c0d3352e219e400a68b9402359204734..6100d09a1cf16cbfbeaccc96a437679783237c53 100644 (file)
@@ -197,15 +197,15 @@ inline Window Window::split_window(size_t dimension, size_t id, size_t total) co
     {
         if(d == dimension)
         {
-            int start        = _dims[d].start();
-            int end          = _dims[d].end();
-            const int step   = _dims[d].step();
+            int       start = _dims[d].start();
+            int       end   = _dims[d].end();
+            const int step  = _dims[d].step();
 
             const int num_it = num_iterations(d);
             const int rem    = num_it % total;
-            int work         = num_it / total;
+            int       work   = num_it / total;
 
-            int it_start     = work * id;
+            int it_start = work * id;
 
             if(int(id) < rem)
             {
@@ -277,7 +277,7 @@ inline void Window::use_tensor_dimensions(const TensorShape &shape, size_t first
 {
     for(unsigned int n = first_dimension; n < shape.num_dimensions(); ++n)
     {
-        set(n, Window::Dimension(0, std::max(shape[n], static_cast<uint32_t>(1))));
+        set(n, Window::Dimension(0, std::max(shape[n], static_cast<size_t>(1))));
     }
 }
 
index 84f04161a8d52da0c8d16efa7b4af6b2992c8652..e543cabea96cc950884f16b7cf233cf612f00a5a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 Arm Limited.
+ * Copyright (c) 2017-2020 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -272,9 +272,16 @@ bool ImageAccessor::access_tensor(ITensor &tensor)
         {
             std::tie(permuted_shape, perm) = compute_permutation_parameters(tensor.info()->tensor_shape(), tensor.info()->data_layout());
         }
+
+#ifdef __arm__
         ARM_COMPUTE_EXIT_ON_MSG_VAR(image_loader->width() != permuted_shape.x() || image_loader->height() != permuted_shape.y(),
                                     "Failed to load image file: dimensions [%d,%d] not correct, expected [%" PRIu32 ",%" PRIu32 "].",
                                     image_loader->width(), image_loader->height(), permuted_shape.x(), permuted_shape.y());
+#else  // __arm__
+        ARM_COMPUTE_EXIT_ON_MSG_VAR(image_loader->width() != permuted_shape.x() || image_loader->height() != permuted_shape.y(),
+                                    "Failed to load image file: dimensions [%d,%d] not correct, expected [%" PRIu64 ",%" PRIu64 "].",
+                                    image_loader->width(), image_loader->height(), permuted_shape.x(), permuted_shape.y());
+#endif // __arm__
 
         // Fill the tensor with the PPM content (BGR)
         image_loader->fill_planar_tensor(tensor, _bgr);
@@ -348,9 +355,16 @@ bool ValidationInputAccessor::access_tensor(arm_compute::ITensor &tensor)
             std::tie(permuted_shape, perm) = compute_permutation_parameters(tensor.info()->tensor_shape(),
                                                                             tensor.info()->data_layout());
         }
+
+#ifdef __arm__
         ARM_COMPUTE_EXIT_ON_MSG_VAR(jpeg.width() != permuted_shape.x() || jpeg.height() != permuted_shape.y(),
                                     "Failed to load image file: dimensions [%d,%d] not correct, expected [%" PRIu32 ",%" PRIu32 "].",
                                     jpeg.width(), jpeg.height(), permuted_shape.x(), permuted_shape.y());
+#else  // __arm__
+        ARM_COMPUTE_EXIT_ON_MSG_VAR(jpeg.width() != permuted_shape.x() || jpeg.height() != permuted_shape.y(),
+                                    "Failed to load image file: dimensions [%d,%d] not correct, expected [%" PRIu64 ",%" PRIu64 "].",
+                                    jpeg.width(), jpeg.height(), permuted_shape.x(), permuted_shape.y());
+#endif // __arm__
 
         // Fill the tensor with the JPEG content (BGR)
         jpeg.fill_planar_tensor(tensor, _bgr);