-
Notifications
You must be signed in to change notification settings - Fork 200
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
[WIP] Add VKD3D profiles to express vulkan requirements #1210
[WIP] Add VKD3D profiles to express vulkan requirements #1210
Conversation
I think the main problem here is that we need multiple code paths to implement various features, and therefore end up doing different things based on the driver we're running on, primarily because D3D12 has requirements that Vulkan drivers don't necessaril fulfill. D3D12 is also a moving target, so optional features that we'll use will constantly change (see mesh shaders). I'm also expecting that we move to Vulkan 1.3 in the near-ish future to clean up the whole extension mess a bit and hard-require some features that are semi-optional right now (esp. BDA), so I'm not sure how useful it is to do the whole profile thing right now. Maybe we should gather baseline requirements for Feature Level 12_0 (in practice this is what new D3D12 games require to run at all) and start from there - "optimal" profiles are probably not useful here at all since we'll basically take what we can get, and vendor support for some features, especially regarding the binding model (i.e. descriptor indexing properties etc), is unlikely to converge. There are some fairly major differences even on the Windows D3D12 side of things. |
Hi,
Thanks for you feedback ! |
Where would this profile be hosted? Is it intended that it's pulled automatically from our repo? |
Hi @HansKristian-Work ! |
278149c
to
5f1d8ab
Compare
Hi, any update on this MR? I'm asking because having a checked-in, maintained profile file would simplify the task of gathering Vulkan requirements for Chrome OS. (I'm Chad Versace in Khronos). |
I haven't seen any which to Vulkan 1.3 at the moment. Should we more forward with Vulkan 1.1 + extensions? |
@christophe-lunarg Things have been hectic and this never bubbled up. @doitsujin I suppose we should just do the transition to 1.3 now? |
Yeah, we should be able to do this now without too many problems. |
Great! I'll be happy to follow this and work on profiles proposals. :) |
Vulkan 1.3 cleanup has been merged now. |
5f1d8ab
to
1912f3f
Compare
I started to update the file, you should have something soon! |
026aadb
to
0e7ac9b
Compare
"vulkan11requirements": { | ||
"features": { | ||
"VkPhysicalDeviceVulkan11Features": { | ||
"multiview": true |
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 don't think we use multiview?
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.
The vulkanXXrequirements
section list the requirements of each Vulkan version. We can disable each capabilities if you want be we can expect that all Vulkan 1.3 drivers will have these capabilities.
"features": { | ||
"VkPhysicalDeviceVulkan12Features": { | ||
"uniformBufferStandardLayout": true, | ||
"subgroupBroadcastDynamicId": true, |
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.
Unused.
"VkPhysicalDeviceVulkan12Features": { | ||
"uniformBufferStandardLayout": true, | ||
"subgroupBroadcastDynamicId": true, | ||
"imagelessFramebuffer": true, |
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.
Unused.
"profiles": { | ||
"VP_VKD3D_d3d12_level_11_0_baseline": { | ||
"version": 1, | ||
"api-version": "1.3.204", |
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.
Why 204 in particular? I figure this should just be 1.3 core.
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.
Because api-version
refers to a specific Vulkan Header version, it indicates what's the minimum Vulkan API revision the Vulkan drivers must supports for the necessary to be potentially exposed and supported.
204 is the first Vulkan 1.3 Vulkan Header version and this profile only requires Vulkan 1.3 and not additional extensions or capabilities added in following Vulkan Header revision.
This said, you can decide that you want to require new Vulkan API version if you want just to explicitly claim that you don't want to support Vulkan drivers that old.
I used the Profiles JSON schemas here https://schema.khronos.org/vulkan/ to figure out these api-version
for each profile.
"properties": { | ||
"VkPhysicalDeviceProperties": { | ||
"limits": { | ||
"maxPerStageDescriptorStorageBuffers": 64, |
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 is somewhat redundant since we rely on update-after-bind.
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 comes from here:
static void d3d12_device_caps_init_feature_level(struct d3d12_device *device)
{
const VkPhysicalDeviceFeatures *features = &device->device_info.features2.features;
const struct vkd3d_vulkan_info *vk_info = &device->vk_info;
struct d3d12_caps *caps = &device->d3d12_caps;
caps->max_feature_level = D3D_FEATURE_LEVEL_11_0;
if (caps->options.OutputMergerLogicOp && features->vertexPipelineStoresAndAtomics &&
vk_info->device_limits.maxPerStageDescriptorStorageBuffers >= D3D12_UAV_SLOT_COUNT &&
vk_info->device_limits.maxPerStageDescriptorStorageImages >= D3D12_UAV_SLOT_COUNT)
caps->max_feature_level = D3D_FEATURE_LEVEL_11_1;
So I am wondering, if this code is correct but it's hard for me to really know.
"limits": { | ||
"maxPerStageDescriptorStorageBuffers": 64, | ||
"maxPerStageDescriptorStorageImages": 64, | ||
"minStorageBufferOffsetAlignment": 4 |
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.
Is this an exact requirement or "must be less-or-equal to 4"?
Some overall comments:
Fixing all issues that comes up will likely take 20+ roundtrips to sort out all micro details, so finding a way to hand this over seems like a good idea. |
dc35997
to
d6d01f0
Compare
Yes, that's exactly the idea with the Profiles layer, running together with the validation layer to get error reports for Vulkan capabilities infringement.
Yes, I am using the Profiles schemas here https://schema.khronos.org/vulkan/ that we (LunarG) keep updating for each Vulkan Header revisions. It's validated with any generic JSON schema validator. I am using this one online https://www.jsonschemavalidator.net/ and https://github.com/tristanpenman/valijson in C++ typically.
You can use
Unfortunately, we don't have a script at the moment to check if all the capabilities in one profile is present in another profile. I agree this could be useful.
I agree, digging into VKD3D-Proton to really understand the feature requirements is not trivial. Part of the way capabilities are handle is by considering the features are available by default and disabling features the project is not using. I am happy to hand this over and review changes to ensure things remain correct or to resolve specific issues. |
I think I need the opposite thing here kind of? For example, if a profile declares various tiers, I should be able to do something like get a report for every feature level and see if it's supported or not, and if not supported, which features are missing to make it supported. I assume this is a normal use case for an IHV going "do I support the profile this app declares, what are we missing?" Maybe some intersection tool would work here? Profile JSON and Profile JSON from a device/vulkaninfo could be analyzed. |
Vulkan Hardware Capability Viewer but also IHVs typically used the Vulkan Profiles API library (C++) for this use case. This is how this table is populated: https://vulkan.gpuinfo.org/listprofiles.php The Vulkan Profiles API library that ship in the Vulkan SDK is using the following profiles that you certainly don't care about:
But the Vulkan Profiles API library is generated from a Python script (part of the Vulkan SDK) and available here with the following command:
Then the library is used to check whether the profiles are supported using this API, eg:
This is probably not ideal in your scenario... I expect this is how IHVs do it because they asked for that a library... |
Thanks, that is helpful. I'll experiment with this in some simpler projects first to make sure the flow works.
Running custom code for this is fine, sounds like it would work for my purposes. |
Ok! let me know how it goes! |
Feathermore, you may want to automatically document your profiles in a human friendly matter and we do have such a tool. You can find an instance of result here: https://vulkan.lunarg.com/doc/sdk/1.3.239.0/windows/profiles_definitions.html This is done using the This is how the script is used:
This was ask by DXVK, interestingly, it looks like you have very similar use cases. ^_^ |
Got around to experimenting with this finally. Hit some stumbling blocks while adding profiles to a simpler project. Filed two bugs: |
Got through the self-study session now. Added profiles support to Granite so that if a program using Granite wants to use profiles to initialize stuff, it can. Used the generate_solution scripts for that. Themaister/Granite#112. Added a profile to parallel-rdp as well. https://github.com/Themaister/parallel-rdp/tree/vulkan-profile Verified that I can use the profile layer to restrict feature sets (using the new default=false env-variable), and combine that with validation worked well enough to ensure the profile is sound. I think the next step is to start making vkd3d-proton profiles and test them against the profile layer. |
There were some issues in the profile layer:
Using alternative caps |
What version of the script are you using? The Using alternative caps ["foo", "bar"] should work if you are using the "main" branch version. I'll have at your profiles look tomorrow and investigate these issues, thanks! |
Superseded by master. |
I created a Vulkan profiles JSON file to express VKD3D minimum requirements for each D3D level. This JSON files are defined by Vulkan Profiles schemas avaiable here and can be used as part of the Vulkan SDK Profiles Toolset. (PDF, Presentation)
I based myself on the repository source code as the main page requirements seem pretty sparsed.
This is an equivalent work from what we did for DXVK with this PR: doitsujin/dxvk#2826
This PR is really for discussion purposes at this point so that I understand if you would be interested in such idea and the direction you would like it to take.
A couple of caveats :
This is something we were pushing to avoid in the profiles concept because depending who produces and consumes a profile it can make things very hard for Vulkan application developers: "How to know what APIs to use when a profile is reported supported on a platform but has multiple variants to claim it reported?" The issue doesn't happen here because because it's VKD3D that creates the VkDevice instance.
Eg:
Means
VP_VKD3D_d3d12_level_11_0_baseline
requires "vulkan10requirements" AND "vulkan11requirements" AND "d3d12_level_11_0" AND ("d3d12_level_11_0_bindless_uniform" OR "d3d12_level_11_0_bindless_storage")Looking forward your inputs!