intel / intel-graphics-compiler

Other
594 stars 155 forks source link

Undefined reference in ocloc when compiling compute-runtime #323

Closed dbermond closed 4 months ago

dbermond commented 5 months ago

When compiling compute-runtime, ocloc fails with a lot of 'undefined reference' errors, such like these ones:

error: undefined reference to `__builtin_spirv_OpImageWrite_img3d_wo_v4i32_v4i32_i32'
in function: '__builtin_spirv_OpImageWrite_img3d_wo_v4i32_v4i32_i32' called by kernels:
  - 'CopyBufferToImage3d16Bytes'
  - 'CopyBufferToImage3d8Bytes'
  - 'CopyBufferToImage3d4Bytes'
  - 'CopyBufferToImage3d2Bytes'
  - 'CopyBufferToImage3dBytes'

error: backend compiler failed build.

error: undefined reference to `__builtin_spirv_BuiltInGlobalInvocationId'
in function: '__builtin_spirv_BuiltInGlobalInvocationId' called by kernels:
  - 'CopyBufferToImage3dBytes'
  - 'CopyBufferToImage3d2Bytes'
  - 'CopyBufferToImage3d4Bytes'
  - 'CopyBufferToImage3d8Bytes'
  - 'CopyBufferToImage3d16Bytes'

error: backend compiler failed build.

Build failed with error code: -11
Command was: /build/intel-compute-runtime/src/build/bin/ocloc -q -file /build/intel-compute-runtime/src/build/bin/built_ins/x64/gen8/stateless_copy_buffer_to_image3d_stateless_bdw.spv -spirv_input -device 8.0.0 -cl-intel-greater-than-4GB-buffer-required -64 -output stateless_copy_buffer_to_image3d_stateless_8_0_0 -output_no_suffix -out_dir /build/intel-compute-runtime/src/build/bin/built_ins/x64/gen8 -options "-cl-kernel-arg-info"

A complete error log is attached here.

IGC is being built with the exact dependency versions/commits specified in the release page, using the 'Source' build way (no 'PreBuilds' dependencies).

The last good IGC + Neo versions that compiled fine were 1.0.15610.11 + 23.48.27912.11 respectively. These errors appeared since versions 1.0.15770.11 + 23.52.28202.14.

Another user opened this issue in the compute-runtime repository, and an Intel developer told to report it here, as it seems to be in the IGC side.

System information:

pvelesko commented 5 months ago

related to https://github.com/intel/intel-graphics-compiler/issues/313 which links to https://github.com/intel/compute-runtime/issues/704

dbermond commented 4 months ago

Not sure if it matters, but IGC in this setup is being built with IGC_OPTION__LINK_KHRONOS_SPIRV_TRANSLATOR=OFF. If setted to ON, the cmake configuration fails.

And changing IGC_OPTION__USE_KHRONOS_SPIRV_TRANSLATOR_IN_SC to ON or OFF does not make any difference in the problem.

dbermond commented 4 months ago

In time: using IGC_OPTION__USE_KHRONOS_SPIRV_TRANSLATOR_IN_SC=OFF makes it to work fine. Maybe this can be documented.