ROCm / MIVisionX

MIVisionX toolkit is a set of comprehensive computer vision and machine intelligence libraries, utilities, and applications bundled into a single toolkit. AMD MIVisionX also delivers a highly optimized open-source implementation of the Khronos OpenVX™ and OpenVX™ Extensions.
https://rocm.docs.amd.com/projects/MIVisionX/en/latest/
MIT License
186 stars 73 forks source link

ERROR: kernel com.amd.nn_extension.reshape_layer exec failed (-1:(null)) #1198

Closed hansely closed 1 year ago

hansely commented 1 year ago

Using vx_enum type to get the size of data type always returns 4 regardless of the actual data type. e.g.

sizeof(VX_TYPE_INT8) // expects 1
sizeof(VX_TYPE_FLOAT16) // expects 2
sizeof(VX_TYPE_FLOAT32) // expects 4
sizeof(VX_TYPE_FLOAT64) // expects 8

The above code lines all return 4.

This cause unexpected behavior especially when calculating the tensor memory size. e.g.

vx_enum type;
ERROR_CHECK_STATUS(vxQueryTensor((vx_tensor)parameters[1], VX_TENSOR_DATA_TYPE, &type, sizeof(type)));
data->memsizeInBytes = dims[0]*dims[1]*dims[2]*dims[3]*sizeof(type);  // sizeof(type) always returns 4
kiritigowda commented 1 year ago

VX_TYPE_FLOAT32 is an enum def which is the 4 bytes. The vx_float16 is typedef to half. This will return 2

hansely commented 1 year ago

VX_TYPE_FLOAT32 is an enum def which is the 4 bytes. The vx_float16 is typedef to half. This will return 2

Yes, will modify the code accordingly to match the expected behavior

kiritigowda commented 1 year ago

@hansely - you need to use vx_int8, vx_float32, & vx_float64

kiritigowda commented 1 year ago

@hansely - changing the issue name to reflect the PR fix. you might need to pull in PR #1199 into your PR to find vx_float16 definition in https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX/blob/5d836de20ca998bd7203c4ffa196e82c0f752d17/amd_openvx/openvx/include/vx_ext_amd.h#L505

https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX/blob/5d836de20ca998bd7203c4ffa196e82c0f752d17/amd_openvx/openvx/include/vx_ext_amd.h#L507