Closed zzj-github closed 7 months ago
chipStar can be used only for .cu (sources) to a fat binary which includes .spv as the device program format, not for PTX to SPV (at least so far).
chipStar can be used only for .cu (sources) to a fat binary which includes .spv as the device program format, not for PTX to SPV (at least so far).
yes,I want to implement the conversion from .cu (sources) to a fat binary which includes .spv, how to achieve it? What is the compile command?
There is cuspvc
tool for compiling CUDA sources. For example,
$ cd chipStar/samples/cuda_samples/0_Simple/vectorAdd
$ <chipStar-install-dir>/bin/cuspvc -I../../Common vectorAdd.cu -o foo
There is
cuspvc
tool for compiling CUDA sources. For example,$ cd chipStar/samples/cuda_samples/0_Simple/vectorAdd $ <chipStar-install-dir>/bin/cuspvc -I../../Common vectorAdd.cu -o foo
the output foo is a binary or a spirv file? if foo is a binary, how to obtain the corresponding spirv file?
the output foo is a binary or a spirv file? if foo is a binary, how to obtain the corresponding spirv file?
Binary. To obtain only the device code, use:
$ <chipStar-install-dir>/bin/cuspvc -I../../Common --cuda-device-only -c vectorAdd.cu -o foo.spv.cob
$ clang-offload-bundler --type=o --targets=hip-spirv64-generic --input=foo.spv.cob --unbundle --output foo.spv
the output foo is a binary or a spirv file? if foo is a binary, how to obtain the corresponding spirv file?
Binary. To obtain only the device code, use:
$ <chipStar-install-dir>/bin/cuspvc -I../../Common --cuda-device-only -c vectorAdd.cu -o foo.spv.cob $ clang-offload-bundler --type=o --targets=hip-spirv64-generic --input=foo.spv.cob --unbundle --output foo.spv
Thanks Follow the command you provide can generate the spv file. I couldn't find anything online about these commands. Where are the instructions for these commands? Could you please provide some relevant materials(documents, web links, etc.) about cuda to spirv for me to learn?
Where are the instructions for these commands?
I mostly learned them by studying Clang’s internal tests plus trial and error. Clang’s documentation may be helpful too.
I want to implement the conversion from cuda(.cu) to spirv(.spv) with chipstar. The following are the conversion methods provided in the documentation:
Compiling CUDA applications directly with chipStar Compilation of CUDA sources without changing the sources, can be done in two ways: The first way is to replace calls of the nvcc compiler with calls of the wrapper script /bin/cuspv in Makefiles. The wrapper script will call clang with the correct flags. The other way is by using CMake: use and then use . However, the project must be compiled with a Clang version supported by HIP. Note that it's not necessary to have Nvidia's CUDA installed.find_package(HIP REQUIRED CONFIG)target_link_libraries( hip::device)
The description in the document is too brief and does not provide specific steps, can you describe in detail how to implement these two methods?