This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

clCreateProgramWithIL() + SPIR-V failed with CL_INVALID_VALUE

I have a smartphone with a mali G710 gpu, which supports opencl 3.0. There is a x86_64 machine with ubuntu 16.04, where my opencl kernel was compiled and converted to a .spv file following G.2 Intermediate language programs in Arm Mali GPU OpenCL Developer Guide(Version 4.11). When the .spv kernel file was copyed to the smartphone and used in clCreateProgramWithIL(), clCreateProgramWithIL() failed with error code--CL_INVALID_VALUE. The SPIR-V in .spv was loaded with fread() and I validated that the il passed to clCreateProgramWithIL() was not NULL and its length was not zero. According to The OpenCL Specification 3.0, CL_INVALID_VALUE means that the length-byte memory pointed to by il does not contain well-formed intermediate language input that can be consumed by the OpenCL runtime. Does anyone has any idea about this error?


The command for compiling opencl kernel is as following:
~/clang+llvm-15.0.2-x86_64-unknown-linux-gnu/bin/clang -Xclang -finclude-default-header --target=spirv64-unknown-unknown -emit-llvm -D SPIR -c -o0 -o test.bc test.cl
~/llvm-project/build/bin/llvm-spirv test.bc -o test.spv

Parents
  • It was the problem of the supportted SPIRV-V on G710. When I added --spirv-max-version=1.0 to llvm-spirv command, clCreateProgramWithIL() succeeded. However, clBuildProgram() failed with the error code--CL_BUILD_PROGRAM_FAILURE, and the program building log showed that kernels definition were not found.

    Since kernels were transferred to a .spv binary file on a x86_64 platform, but readed and build on a arm platform, is this related to binary compatibility?

Reply
  • It was the problem of the supportted SPIRV-V on G710. When I added --spirv-max-version=1.0 to llvm-spirv command, clCreateProgramWithIL() succeeded. However, clBuildProgram() failed with the error code--CL_BUILD_PROGRAM_FAILURE, and the program building log showed that kernels definition were not found.

    Since kernels were transferred to a .spv binary file on a x86_64 platform, but readed and build on a arm platform, is this related to binary compatibility?

Children
No data