-
Notifications
You must be signed in to change notification settings - Fork 813
How to emit SPIRV and how to emit LLVM? #5608
-
--emit-llvm doesn't work in dcpp. Don't understand why. Also, how do I emit the SPIRV module to file instead of linking it to the .o?
Beta Was this translation helpful? Give feedback.
All reactions
Hi, I usually use:
clang++ -fsycl -fsycl-device-only test.cpp - to emit .bc file
and
clang++ -fsycl -fsycl-device-only -fno-sycl-use-bitcode test.cpp to emit .spv file
I'm unsure, if -fno-sycl-use-bitcode option works with dpcpp, so in this case I would suggest:
dpcpp -fsycl-device-only test.cpp - this alone will emit .bc file
llvm-spirv --spirv-ext=+all test.bc - this will translate it to .spv file
and llvm-dis / llvm-spirv --to-text are used to emit test formats for IR and SPV
Replies: 3 comments 2 replies
-
Hi, I usually use:
clang++ -fsycl -fsycl-device-only test.cpp - to emit .bc file
and
clang++ -fsycl -fsycl-device-only -fno-sycl-use-bitcode test.cpp to emit .spv file
I'm unsure, if -fno-sycl-use-bitcode option works with dpcpp, so in this case I would suggest:
dpcpp -fsycl-device-only test.cpp - this alone will emit .bc file
llvm-spirv --spirv-ext=+all test.bc - this will translate it to .spv file
and llvm-dis / llvm-spirv --to-text are used to emit test formats for IR and SPV
Beta Was this translation helpful? Give feedback.
All reactions
-
warning: option '-fno-sycl-use-bitcode' is deprecated and will be removed in a future release [-Wdeprecated]
This option is removed.
Beta Was this translation helpful? Give feedback.
All reactions
-
@alanzhai219, it is not yet removed, but it will be.
-fsycl-device-obj=<value>
Specify format of device code stored in the resulting object. Valid values are: spirv, llvmir (default)
Is a replacement you are looking for
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
When I invoke clang++ directly I get "kernel name is missing" errors. When I use dpcpp with these commands, it does generate a .spv, but it's broken:
sean@zenbook:~/mandelbrot/src$ dpcpp -fsycl -fsycl-device-only main.cpp
In file included from main.cpp:14:
./mandel.hpp:240:44: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
h.parallel_for(range<2>(rows, cols), [=](auto index) {
^
1 warning generated.
sean@zenbook:~/mandelbrot/src$ llvm-spirv --spirv-ext=+all main.bc
sean@zenbook:~/mandelbrot/src$ spirv-dis main.spv
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 237
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpCapability GenericPointer
OpCapability Int8
error: 7: Invalid capability operand: 5629
This is the mandelbrot test that ships with oneAPI. llvm-spirv --to-text does produce a form of disassembly, but I'm hoping to use the regular SPIRV-Tools with this.
Beta Was this translation helpful? Give feedback.
All reactions
-
When I invoke clang++ directly I get "kernel name is missing" errors.
I see. dpcpp binary includes several extensions. Addition of -fsycl-unnamed-lambda to clang++ shall work.
but I'm hoping to use the regular SPIRV-Tools with this
KhronosGroup/SPIRV-Headers#176 and KhronosGroup/SPIRV-Headers#177 are addressing this problem, when they merged - this capability will become known for SPIR-V tools.
Beta Was this translation helpful? Give feedback.