-
Notifications
You must be signed in to change notification settings - Fork 781
Apple compatibility fixes for driver optionality (MoltenVK & KosmicKrisp) #1435
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
base: main
Are you sure you want to change the base?
Conversation
|
We just discussed this, also in light of what you did for my repo. If I did understand you correct, if MoltenVK could be adjusted, we could get rid of having to handle it different than KosmicKrisp? Is that correct? If so we could forward that to the people still working on MoltenVK. |
Not really. The main end-user difference between MoltenVK and KosmicKrisp is recognition of MoltenVK being a Vulkan Portability driver with the need for enabling portability extensions ( What I have tried to do in this PR is:
Regarding your comment about asking the MoltenVK folks to handle things differently (i.e. portability vs conformant), I think that may be unreasonable or perhaps impossible at this point. Portability was a major design assumption of MoltenVK and has allowed it to advance its Vulkan version support by leveraging the subsetting nature of the Vulkan spec. I think MoltenVK is fine as is, supporting macOS, iOS and arm64/x86_64 across a wide range of OS versions. My goal here was not to force change back down the pipe, but to accommodate both approaches in the Vulkan-Samples project. Note that KosmicKrisp will start with a narrower support matrix of newer macOS versions on arm64 only, and I don't believe iOS support is planned at least for now. |
|
Not sure why Antora doc build is failing. I didn't touch anything related with this PR. Strange... |
|
The Doc build failure is our fault, see KhronosGroup/antora-ui-khronos#30 |
|
Fixed it. |
|
Also, I agree with @SRSaunders, there's nothing for MoltenVK to fix. That's the way MoltenVK is designed to work. During the meeting today, we were under the impression that @SRSaunders found some bug in MoltenVK having to do with non-standard's compliant layer handling in Sascha's samples. I think that's what we were wondering if we needed to escalate knowledge about to get fixed in the MoltenVK team. |
|
Just tested and it works with no issues, thank you! I do have one suggestion, but feel free to ignore it. Changing drivers is as easy as setting a new value for |
@aitor-lunarg thanks for testing quickly and delivering excellent news! I was hoping external dependencies like the Vulkan
This is an interesting idea, but would require changing the code from being a build-time decision to a runtime one. This may indeed be possible, but I would have to investigate if there are any limitations or downsides here. On the positive side, part of this concept is already in place - the portability extensions are always checked for availability at runtime prior to enabling them. However, we also need to understand the implications of always including vulkan_beta.h and things like
This is also good to hear. Can you tell me how a future SDK will handle setting up this env variable for KosmicKrisp vs. MoltenVK? Currently there is a single setup-env.sh file at the SDK root level (and a different one in the iOS subfolder) that sets up important env variables including Also will CMake's |
…omments for driver optionality
@aitor-lunarg I have updated this PR to ensure there are runtime checks for the portability extensions and features. However, I have left However, you may now see runtime warning messages that Note that I am still interested in how env variables will be configured for MoltenVK vs. KosmicKrisp in a co-resident SDK via setup-env.sh. If you have information about this I could update the docs to provide instructions to Vulkan-Samples users when running on macOS. I presume iOS will not change for now. If you want to test this updated PR with KosmicKrisp that would be great. If you come back with positive results, I could move this PR out of WIP status into ready for review. Thanks. |
gpx1000
left a comment
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.
This works well for me on KosmicKrisp and MoltenVK. Also tested in Linux to ensure everything still works everywhere.
My understanding is that it will just be added to the path used by the loader to search for drivers. Right now, setup-env.sh will export |
|
The plan for the first Alpha release of KosmicKrisp is to not include it in the system global folders the way MoltenVK is. The rationale is it may create havok if suddenly there are two ICD's to choose from now for developers using that option. An icd json file is included and people who want to experiment can embed it in their application bundles, or copy it to the system folder where MoltenVK is themselves. KosmicKrisp also does not support direct linking the way MoltenVK does. You have to use the Vulkan Loader. The ICD can then be placde in the system folders or (preferably) in the application bundle. I hope no one is actually shipping applications or games and assuming MoltenVK (or KosmicKrisp in the future) is installed in a system folder. |
|
Thanks @richard-lunarg for the explanation on initial KosmicKrisp installation decisions for the SDK. For the Vulkan-Samples project at least, the end user is asked to run setup-env.sh to define the path to the driver icd file (as well as to other things like the VVL). Up to this point that has been for MoltenVK only. Similar to @aitor-lunarg's comment above, will there be a second setup-env.sh available somewhere in an upcoming SDK which specifies VK_DRIVER_FILES and defines the path to KosmicKrisp_icd.json within the SDK (e.g. in a separate KosmicKrisp folder similar to what is done for iOS)? Or will that be entirely manual and up to the developer for the Alpha release? |
|
Thanks @gpx1000 for testing this PR and approving. I was waiting for someone to provide feedback re the added runtime checks for portability extensions and features, which provides compatibility for MoltenVK and KosmicKrisp without prior configuration. Given your positive results, I will now remove the WIP label on this PR. |
|
Thanks for the hard work on it! Your help on Apple has been really appreciated! |
Manual for now, but all they have to do is set the one environment variable. I'll put something in the release notes about it. After the alpha and some other feedback, we'll probably finesse this a bit more for the next SDK release. The response to KosmicKrisp has been really strong, we are all very gratified by how much enthusiasm the community is showing for this project. |
Thanks @richard-lunarg, sounds good. I won't add any additional docs on the Vulkan-Samples side for now. And @gpx1000 I'm happy to help out. Thanks for your ongoing feedback, testing, and support re Apple. |
|
Heads up, we did have a change in plan late in testing for the next SDK. If KosmicKrisp is selected, it will be placed in the system folders along side MoltenVK. The loader sees MoltenVK first, so it should not break anything, but all you will need to do is run: export VK_DRIVER_FILES=$VULKAN_SDK/share/vulkan/icd.d/libkosmickrisp_icd.json To switch to KosmicKrisp from MoltenVK from the command line. There are multiple ways to use KosmicKrisp, and see the 'Getting Started Guide" for macOS in the SDK for details next week. |
Will this be on arm64 hosts only? I presume this will not be the case for x86_64 hosts. Alternatively, will the SDK's KosmicKrisp installation option be available only on arm64?
This should work well for command line invocation of Vulkan-Samples. However, for Xcode-based builds and execution, the user will have to update the Vulkan-Samples Xcode schema (under Environment Variables) to modify the definition of |
Ah, good point/question. The installer does not distinguish between Apple Silicon and x86_64, but KosmicKrisp is only for Apple Silicon. I've added a note at least to indicate this on the installer and in the release notes. |
They can also include KosmicKrisp in the application bundle, which is the recommended method for distributable applications as well. |
|
Thanks @richard-lunarg for your answers. |
Description
This WIP PR removes the Apple = MoltenVK driver assumption and provides compatibility for the coming KosmicKrisp driver on supported platforms (macOS, arm64). In addition, it provides a simple mechanism to allow the user to build for either situation. The already-existant CMake variable
VKB_ENABLE_PORTABILITYis now externalized as a CMake command line optionfor users to select building for MoltenVK vs. KosmicKrisp. The option is set in this PR to default = ON for backwards compatibility. To build for KosmicKrisp the user will likely have to execute a specific setup-env.sh from the SDK (or set theVK_DRIVER_FILESenvironment variable) and then run CMake using the macOS instructionsadding the option.-DVKB_ENABLE_PORTABILITY=OFFSpecifics are:
VKB_ENABLE_PORTABILITYfrom being an internally set CMake variable to a cmdline option (default ON).#ifdef __APPLE__code block from vulkan_profiles.hpp to provide this flexibility. I realize this is a generated file, but the .hpp file makes a bad assumption that Apple = PORTABILITY and turns on the portability extensions by itself. This is not correct going forward and the sample itself should control that, not the hpp file. This really should be changed in the generator script, but I do not have access to that within this project.VK_KHR_portability_subsetdevice extension whenVKB_ENABLE_PORTABILITY=ON, b) allocate descriptors from update-after-bind pool for descriptor indexing scalability, and c) destroy images and sampler on exit - all to eliminate validation errors.Fixes #1434
Regression tested for MoltenVK on macOS Ventura on x86_64 + AMD 6600 and on macOS Sequoia on M1 Air using SDK 1.4.328.1 as well as the latest development build of MoltenVK.
@aitor-lunarg if you could review and/or test this functionality with KosmicKrisp that would be great. See macOS build instructions.
Simply addThere are some unknowns regarding project dependencies on components like the Vulkan DynamicLoader and volk, but I am hoping those work as-is for KosmicKrisp.-DVKB_ENABLE_PORTABILITY=OFFto the command line.Once this PR has been verified as working by others, I will add an additional commit for macOS build instructions.
General Checklist:
Please ensure the following points are checked:
Note: The Samples CI runs a number of checks including:
If this PR contains framework changes:
batchcommand line argument to make sure all samples still work properlySample Checklist
If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist: