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

External compilation step with Clang 17 is significantly more stable than Clspv alone #1142

Open
BukeBeyond opened this issue Jun 24, 2023 · 0 comments

Comments

@BukeBeyond
Copy link

BukeBeyond commented Jun 24, 2023

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
Function Definition calling another with const reference fails to compile

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

1 participant