Skip to content

CL: use libclc spirv

Jesse Natalie requested to merge jenatali/mesa:libclc-upstream into master

This is based on @airlied's !4323 (closed), but using a mangler implemented in vtn instead of shelling out to a driver-provided mangler, which came from LLVM. This is necessary to support OpenCL's async functions from libclc, which use events, which LLVM's mangler doesn't support. It also adds address space knowledge into the mangler, which is also required for those functions.

It requires a set of clc patches:

  • LLVM D77589 (libclc SPIR-V target): This is the core patch that produces a spv binary we can use.
  • LLVM D82078 (add overload/mangling to all CL builtins): Without this, the async copy functions produce calls to non-implemented functions for work item IDs, because the SPIRV converter doesn't translate them to opcodes without mangling.
  • LLVM D85910 (__builtin_has_hw_fma32()): This allows the same SPIR-V binary to be used for drivers which do have fused fma, and drivers that don't (like the DXIL backend), by promoting the fma presence query to a vtn compile option rather than a libclc compile option.
  • LLVM D85911 (math fixes: SPIRV-specific fma, add fmod/ldexp): Necessary to have fully conformant implementations of these ops.

It requires switch support and the structurizer to be merged !2401 (merged)

Edited by Jesse Natalie

Merge request reports

Loading