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
Paths
| Differential D77589
libclc: Add Mesa/SPIR-V target ClosedPublic Authored by daniels on Apr 6 2020, 2:26 PM.
Details
Summary 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.
daniels added inline comments.
This revision is now accepted and ready to land.May 27 2020, 7:35 AM
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. This revision now requires changes to proceed.Jun 4 2020, 8:19 AM daniels retitled this revision from libclc: Add Mesa/SPIR-V/DXIL target to libclc: Add Mesa/SPIR-V target.Jun 16 2020, 5:24 AM 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.
This revision is now accepted and ready to land.Jun 16 2020, 7:00 AM 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? bbrezillon added inline comments.
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.
Closed by commit rGc37145cab121: libclc: Add Mesa/SPIR-V target (authored by airlied, committed by tstellar). · Explain WhyAug 17 2020, 2:02 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 271075 libclc/CMakeLists.txt
libclc/generic/include/clc/clcfunc.h
libclc/generic/lib/common/smoothstep.cl
libclc/generic/lib/common/step.cl
libclc/spirv/lib/SOURCES
libclc/spirv/lib/subnormal_config.cl
libclc/spirv64/lib/SOURCES
libclc/spirv64/lib/subnormal_config.cl
|
automagic build targets are not nice, because they can fail silently.
I don't mind having dxil in ALL, but an error check if the user selected dxil and llvm-spirv tools were not found would be useful.