Add targets to emit SPIR-V targeted to Mesa's OpenCL support, using
SPIR-V 1.1.
Substantially based on Dave Airlie's earlier work.
libclc: spirv: remove step/smoothstep apis not defined for SPIR-V
libclc: disable inlines for SPIR-V builds
Differential D77589
libclc: Add Mesa/SPIR-V target daniels on Apr 6 2020, 2:26 PM. Authored by
Details
Add targets to emit SPIR-V targeted to Mesa's OpenCL support, using Substantially based on Dave Airlie's earlier work. libclc: spirv: remove step/smoothstep apis not defined for SPIR-V libclc: disable inlines for SPIR-V builds
Diff Detail
Event TimelineComment Actions Just as an FYI, this is what we are actually using together with a few WIP branches in Mesa. Of note is that we run the LLVM StructurizeCFG pass before generating SPIR-V, else vtn chokes on it, even with the WIP Mesa structuriser.
Comment Actions It looks like we also need to add _CLC_OVERLOAD to the declaration and definitions of the functions declared in workitem as well as barrer(). The LLVM->SPIR-V converter requires these function names to be mangled in order to appropriately translate them to the dedicated SPIR-V built-ins. The names are not mangled for C/CLC unless overloading is requested. Comment Actions I'll submit that as a separate change. I don't have a good way to test Clover at the moment, so I have to dig out the relevant Clover/llvmpipe branches and get them built.
Comment Actions Hmm, another new failure, this time because clang-tidy is newly running on the CL source files, and doesn't like them. Should I just blacklist all the libclc source files? Comment Actions PR to make clang-tidy not try to parse CLC source: https://github.com/google/llvm-premerge-checks/pull/202 Comment Actions That PR was merged to fix the build failure, and now we have a new failure ... https://github.com/google/llvm-premerge-checks/issues/207 Comment Actions Third time's a charm - the CI now passes. Can someone please push this when you're ready?
Comment Actions I've rebased this against current master whilst fixing @bbrezillon's comment. @tstellar @jvesely Can one of you please land this, D83473: libclc: Fix FP_ILOGBNAN definition, and D82078: libclc: Make all built-ins overloadable? We are ready to merge the SPIR-V libclc support into Mesa for multiple drivers now, but are blocking on this being merged into LLVM trunk.
|