External compilation step with Clang 17 is significantly more stable than Clspv alone
- Dominant language
- LLVM
- Stars
- 729
- Forks
- 110
- Avg merge
- 17h 51m
- Merged PRs (30d)
- 23
Description
We have numerous tests that have failed compiling with Clspv alone. Some of these bugs have been around for over a year.
However now, compiling externally with the latest Clang 17 to produce an IR file, and providing that to Clspv for Vulkan conversion has achieved a new level of stability!
Clspv calls the same Clang 17 compiler code internally, but with a lot of old and undocumented settings. These internal settings are awaiting to be fixed by the expert developers of Clspv. Until then, here is an example of external compilation:
```
clang -x cl -cl-std=CLC++ -S -emit-llvm -target spir64-unknown-unknown -O3 --compile $InFile -MMD -MF $OutFile.d -o $OutFile.ll
clspv -cl-std=CLC++ -inline-entry-points -arch=spir64 -cl-kernel-arg-info -cl-native-math -x=ir $OutFile.ll -o $OutFile.spv
```
As a bonus to using full Clang, the optional `-MMD -MF $OutFile.d` generates a dependency file from #includes, and can be used with Ninja in complex projects.
And the best bonus for the last... Clang 17 accepts -cl-std=CLC++2021! And this works fine with Clspv -cl-std=CLC++.
Hope this helps!
Here are just 2 bug triggers posted that currently fail Clspv alone. Until the internal compilation passes these basic tests, we probably do not need to post anymore issues.
[Function call with generic struct reference fails to compile](https://github.com/google/clspv/issues/1137)
[Function Definition calling another with const reference fails to compile](https://github.com/google/clspv/issues/1138)
Contributor guide
Assessment
This issue has not been assessed yet.