-
Notifications
You must be signed in to change notification settings - Fork 11.8k
cmake: simplify vulkan shader test logic #13263
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
cmake: simplify vulkan shader test logic #13263
Conversation
@jeffbolznv I think you were right about using the external project add for |
Thanks for making these cleanups. The changes look reasonable to me, though I don't know if there are any weird consequences of passing cmake arguments via file. |
No problem. We'll see how the CI responds. I added a couple cross-compile builds there so at very least we have the basic compile-checks covered. |
Interesting. This doesn't seem much simpler, though. It's about as much code and going through an external file is slightly convoluted. But I don't know enough about cmake to judge that particularly well, so I'll leave it up to you to decide what is better. |
The primary motivation is to only change one place when new extension checks are added. Because the Vulkan-shaders-gen project had several bugs associated with missing defines, this change would ensure that they will be present without having to duplicate flags within the sub project. Also, the "subdirs" loading is replaced by unifying the cross-compile approach with a regular build, both using ExternalProject_Add now. |
The one issue with using the file copy, however, is that one cannot build the Vulkan-shaders-gen without building ggml-vulkan, and so it becomes an implementation detail despite being an external project. I am happy to undo that change if this is not desirable. From my point of view this is the only way I've built the app, but perhaps there's a reason to decouple them. The net effect is just that we need to update 3 spots instead of 1 when adding new extension capabilities. |
I went ahead and removed the auto-generated file, but as a compromise the set of extension arguments are appended to a list which gets expanded automatically when adding vulkan-shaders-gen project. So, when adding new extension checks we just need to make two changes:
Well, and of course the shader test itself... 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think either is fine, you know a lot more than me about cmake. As long as it works and I can figure out where new extensions have to go, I'm happy. 😄
@0cc4m glad I could be of help. Learning Vulkan is on my bucket list but I'm not there yet—maybe some day I'll be able to help you all with the actual work! 😊 |
This PR adds a CMake function to simplify the shader feature-detection logic. In addition, the requisite preprocessor defines are shared with the vulkan-shaders-gen project through an auto-generated cmake file, preventing the need to pass them along manually.