NHWC issues with CLDirectConvolution in v18.08
Output of 'strings libarm_compute.so | grep arm_compute_version':
arm_compute_version= Build options: Git hash=52ba29e936b8e711e8acdfe819e36f884d4f3fe1
Platform:
aarch64
Operating System:
Linux firefly 4.4.77
Problem description:
There is issue https://github.com/ctuning/ck-nntest/issues/25 - It seems that CLDirectConvolution don't get along with NHWC at some parameters: sometimes we get invalid data, sometimes execution fails.
Steps to reproduce:
Prepare environment
Install CK:
$ python -m pip install ck```
Get NNTest repositories:
```bash
$ ck pull repo:ck-nntest
Install ArmCL library 18.08:
$ ck install ck-math:package:lib-armcl-opencl-18.08 --env.USE_NEON=ON```
With command:
```bash
$ ck compile program:directconv-armcl-opencl
$ ck run program:directconv-armcl-opencl \
--dataset_uoa=tensor-conv5x5-inception-v3 \
--env.CK_LWS_TUNER_TYPE=NONE \
--env.CK_DATA_LAYOUT=NHWC```
error arises:
```terminate called after throwing an instance of 'cl::Error'
what(): clEnqueueMapBuffer```
Failing tensor shape and operation parameters are
```{
"CK_IN_SHAPE_C": 48,
"CK_IN_SHAPE_H": 35,
"CK_IN_SHAPE_W": 35,
"CK_OUT_SHAPE_C": 64,
"CK_CONV_KERNEL": 5,
"CK_CONV_STRIDE": 1,
"CK_CONV_PAD": 2
}```
Hi @bellycat77 It looks like there is a bug in ACL. We'll investigate further, thanks for reporting this.
Has this been fixed in v18.11?
Hello @psyhtest, Yes this should be fixed in 18.11
We are trying to recreate the issue but we can't.
Please give us more details like your choices of
Registering software installations found on your machine in the CK: (for gcc)
Registering software installations found on your machine in the CK: (for libOpenCL.so)
Some support tools and scripts may be available for your target platform in CK: (first run)
Thanks Manuel
This is still reproducible on Firefly-RK3399 with the above steps:
$ ck install ck-math:package:lib-armcl-opencl-18.08 --env.USE_NEON=ON
$ ck compile program:directconv-armcl-opencl
$ ck run program:directconv-armcl-opencl --cmd_key=default \
--dataset_uoa=tensor-conv5x5-inception-v3 \
--env.CK_LWS_TUNER_TYPE=NONE \
--env.CK_DATA_LAYOUT=NHWC
...
export CK_ABS_DIFF_THRESHOLD=0.001
export CK_COMPUTE_DEVICE_ID=0
export CK_COMPUTE_PLATFORM_ID=0
export CK_CONV_KERNEL=5
export CK_CONV_PAD=2
export CK_CONV_STRIDE=1
export CK_DATASET_FILENAME=shape-48-35-35-5-64-1-2
export CK_DATA_LAYOUT=NHWC
export CK_IN_SHAPE_C=48
export CK_IN_SHAPE_H=35
export CK_IN_SHAPE_N=1
export CK_IN_SHAPE_W=35
export CK_LWS_TUNER_TYPE=NONE
export CK_OUT_RAW_DATA=tmp-ck-output.bin
export CK_OUT_SHAPE_C=64
export CK_SEED=42
...
* tmp-stderr.tmp
terminate called after throwing an instance of 'cl::Error'
what(): clEnqueueMapBuffer
Here's my environment:
- GCC 7.4.0:
$ ck show env --tags=gcc
Env UID: Target OS: Bits: Name: Version: Tags:
8c4b3bb5176d1757 linux-64 64 GNU C compiler 7.4.0 64bits,compiler,gcc,host-os-linux-64,lang-c,lang-cpp,target-os-linux-64,v7,v7.4,v7.4.0
- OpenCL driver r13p0:
$ ck show env --tags=opencl,lib
Env UID: Target OS: Bits: Name: Version: Tags:
4bfcfd3247eca1da linux-64 64 OpenCL library 1.2-r13p0 64bits,host-os-linux-64,lib,opencl,target-os-linux-64,v1,v1.2,v1.2.0
For the target platform, you should select firefly-linux:
$ ck search platform.init --tags=firefly
ck-env:platform.init:firefly-linux
although it shouldn't be a problem if you don't.
However, I've just tried with ArmCL 18.11: without any issues:
$ ck install ck-math:package:lib-armcl-opencl-18.11 --env.USE_NEON=ON
$ ck compile program:directconv-armcl-opencl
...
0) ARM Compute Library (opencl) - v18.11-b9abeae (64bits,arm,arm-compute-library,armcl,channel-stable,compiled-by-gcc,compiled-by-gcc-7.4.0,host-os-linux-64,lib,target-os-linux-64,v18,v18.11,v18.11.0,vdefault,vneon,vopencl (f17a14d97865ded1))
- Depends on "compiler" (env UOA=8c4b3bb5176d1757, tags="compiler,lang-cpp", version=7.4.0)
- Depends on "opencl" (env UOA=4bfcfd3247eca1da, tags="lib,opencl", version=1.2-r13p0)
$ ck run program:directconv-armcl-opencl --cmd_key=default \
--dataset_uoa=tensor-conv5x5-inception-v3 \
--env.CK_LWS_TUNER_TYPE=NONE \
--env.CK_DATA_LAYOUT=NHWC
...
{
"env": {
"CK_ABS_DIFF_THRESHOLD": 0.001,
"CK_COMPUTE_DEVICE_ID": "0",
"CK_COMPUTE_PLATFORM_ID": "0",
"CK_CONV_KERNEL": 5,
"CK_CONV_PAD": 2,
"CK_CONV_STRIDE": 1,
"CK_DATASET_FILENAME": "shape-48-35-35-5-64-1-2",
"CK_DATA_LAYOUT": "NHWC",
"CK_IN_SHAPE_C": 48,
"CK_IN_SHAPE_H": 35,
"CK_IN_SHAPE_N": 1,
"CK_IN_SHAPE_W": 35,
"CK_LWS_TUNER_TYPE": "NONE",
"CK_OUT_RAW_DATA": "tmp-ck-output.bin",
"CK_OUT_SHAPE_C": 64,
"CK_SEED": 42
},
"execution_time": 2.408828,
"execution_time_kernel_0": 2.408828,
"execution_time_kernel_1": 0.197985,
"post_processed": "yes",
"run_time_state": {
"data_bits": 32,
"in_shape_C": 48,
"in_shape_H": 35,
"in_shape_N": 1,
"in_shape_W": 35,
"out_shape_C": 64,
"out_shape_H": 35,
"out_shape_N": 1,
"out_shape_W": 35,
"rnd_seed": 42,
"time_setup": 2.210843,
"time_test": 0.197985
}
}
This supports what @GeorgeARM said a month ago that this was fixed in v18.11.
Thanks.
Thanks a lot @psyhtest for checking out. Closing this. Reopen if needed.