PRELU compilation error on iMX8MP

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

PRELU compilation error on iMX8MP

跳至解决方案
995 次查看
jetxeberria
Contributor III

Hi,

I'm having issues compiling my model with PReLU activation for iMX8MP. This operation is supposed to be supported.

I'm converting and quantizing (to int8) the model from keras to tflite using quantization aware training with native tflite methods

k_model = keras.models.load_model(path_keras)
print("Converting Keras model to int8 tflite format")
converter = tf.lite.TFLiteConverter.from_keras_model(k_model)
converter.target_spec.supported_ops = [
tf.lite.OpsSet.TFLITE_BUILTINS,
tf.lite.OpsSet.TFLITE_BUILTINS_INT8,
]
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = tf.lite.RepresentativeDataset(
ImageDataset(shuffle=True, limit=200, channel_first=False, input_name="input_1").generator
)
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
converter.inference_input_type = tf.int8
converter.inference_output_type = tf.int8
tflite_model = converter.convert()
with open(path_tflite, "wb") as f:
f.write(tflite_model)

This is the error:

Vx delegate: allowed_cache_mode set to 0.
Vx delegate: device num set to 0.
Vx delegate: allowed_builtin_code set to 0.
Vx delegate: error_during_init set to 0.
Vx delegate: error_during_prepare set to 0.
Vx delegate: error_during_invoke set to 0.
input: serving_default_input_1:0shape: [ 1 112 112 3] dtype: <class 'numpy.int8'>
W [HandleLayoutInfer:274]Op 162: default layout inference pass.
(267:0) : error : Error(0,267) : Cannot find the header file cl_viv_vx_ext.h.
(25:0) : error : undefined identifier: 'COPY'
(59:0) : error : undefined identifier: 'COPY'
(270:0) : error : syntax error at 'VXC_512Bits'

ERROR: Failed to compile vx shader. (error: FFFFFFFF)
E [kernel/vsi_nn_kernel.c:_gpu_register:600]Build program fail.
E [kernel/vsi_nn_kernel.c:vsi_nn_kernel_create_node:874]Register client kernel com.vivantecorp.extension.evis.prelu_U8U8toU8_2D fail with -1.
(267:0) : error : Error(0,267) : Cannot find the header file cl_viv_vx_ext.h.
(25:0) : error : undefined identifier: 'COPY'
(59:0) : error : undefined identifier: 'COPY'
(270:0) : error : syntax error at 'VXC_512Bits'

This is repeated for 49 times and then this last error is shown:

ERROR: Failed to compile vx shader. (error: FFFFFFFF)
E [kernel/vsi_nn_kernel.c:_gpu_register:600]Build program fail.
E [kernel/vsi_nn_kernel.c:vsi_nn_kernel_create_node:874]Register client kernel com.vivantecorp.extension.evis.prelu_U8U8toU8_2D fail with -1.

Do you identify this error? PReLU is supposed to work, why am I seeing this error?

Thanks in advance

 

1 解答
863 次查看
JeFi
Contributor II

I had an similar error this week. For me it was the missing header file cl_viv_vx_ext.h that is also missing in the error message. I think it was in the opencl recipe and the header file is only copied on the yocto image if something happens (its been too long), but what you can try: just create the header file with

https://github.com/larrylart/codrive/blob/master/hw_sampling/vim3_npu/include/aml_sdk/CL/cl_viv_vx_e...

and place it in the folder of youre executable.

Best wishes

在原帖中查看解决方案

5 回复数
864 次查看
JeFi
Contributor II

I had an similar error this week. For me it was the missing header file cl_viv_vx_ext.h that is also missing in the error message. I think it was in the opencl recipe and the header file is only copied on the yocto image if something happens (its been too long), but what you can try: just create the header file with

https://github.com/larrylart/codrive/blob/master/hw_sampling/vim3_npu/include/aml_sdk/CL/cl_viv_vx_e...

and place it in the folder of youre executable.

Best wishes

842 次查看
jorgemf
Contributor I

This worked. Thanks!

标记 (1)
0 项奖励
872 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello.

 

Does this happens on 6.6.3v BSP? since is the first one that support PRELU.

Regards

0 项奖励
865 次查看
jetxeberria
Contributor III

Hello Bio_TICFSL,

Thanks for your response.

We're using Kirkstone 5.15.71_2.2.0. Docs say it's supported: https://github.com/nxp-imx/tflite-vx-delegate-imx/blob/lf-5.15.71_2.2.0/op_status.md

0 项奖励
869 次查看
jorgemf
Contributor I

it should be supported, at least it is state int he docs: https://github.com/nxp-imx/tflite-vx-delegate-imx/blob/lf-5.15.5_1.0.0/op_status.md

0 项奖励