Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translation from cuda file to spv file #2291

Open
zzj-github opened this issue Jan 8, 2024 · 1 comment
Open

translation from cuda file to spv file #2291

zzj-github opened this issue Jan 8, 2024 · 1 comment

Comments

@zzj-github
Copy link

I realize the conversion from cuda file to spv file.
I first use LLVM to generate the .bc file corresponding to cuda file, and then use llvm-spirv to convert the .bc file into the .spv file.
get an error:

InvalidTargetTriple: Expects spir-unknown-unknown or spir64-unknown-unknown. Actual target triple is x86_64-pc-linux-gnu

how to solve it?

@MrSidims
Copy link
Contributor

MrSidims commented Jan 9, 2024

Per https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/main/docs/SPIRVRepresentationInLLVM.rst#target-triple-and-datalayout-string triple must be spir. I'm not sure if clang has support to compile cuda to spir target. I can only suggest a non-official workaround, which is definitely must not be used in a product code, but might help with the research: modify triple manually and try to translate. It's not guarantied it would work out of the box, as per triple rules clang would restrict supported types, vector sizes, add address space generation rules etc which are mandatory for SPIR environment and that the translator expects, but it still might work.
TBH I would try out SPIR-V Backend, which is a part of LLVM project, you can just feed .bc to llc targeting SPIR-V and see how it goes. While it's a work in progress project, it should be more promising for your flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants