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

video: adjust device_limits/features to the updated profiles #829

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

alichraghi
Copy link
Member

Description

Testing

TODO list:

Comment on lines 397 to 422
if (!vulkan12Properties.shaderSignedZeroInfNanPreserveFloat64)
return nullptr;
if (!vulkan12Properties.shaderDenormPreserveFloat16)
return nullptr;
if (!vulkan12Properties.shaderDenormPreserveFloat32)
return nullptr;
if (!vulkan12Properties.shaderDenormPreserveFloat64)
return nullptr;
if (!vulkan12Properties.shaderDenormFlushToZeroFloat16)
return nullptr;
if (!vulkan12Properties.shaderDenormFlushToZeroFloat32)
return nullptr;
if (!vulkan12Properties.shaderDenormFlushToZeroFloat64)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTEFloat16)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTEFloat32)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTEFloat64)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTZFloat16)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTZFloat32)
return nullptr;
if (!vulkan12Properties.shaderRoundingModeRTZFloat64)
return nullptr;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 16 and 32 should only be checked if the float16 and float64 feature is available.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but properties are declared before features (in a different scope). wanna move them out?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you want to move the checks of the limits into where the features are already known, yes

Comment on lines 905 to 991
},
{
"type": "bool",
"name": "shaderSignedZeroInfNanPreserveFloat32",
"value": true,
"expose": "DISABLE"
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderSignedZeroInfNanPreserveFloat64",
"value": false
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderDenormPreserveFloat16",
"value": false
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderDenormPreserveFloat32",
"value": false
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderDenormPreserveFloat64",
"value": false
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderDenormFlushToZeroFloat16",
"value": false
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderDenormFlushToZeroFloat32",
"value": false
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderDenormFlushToZeroFloat64",
"value": false
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderRoundingModeRTEFloat16",
"value": false,
"comment": ["ROADMAP2024 but no good support yet"]
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderRoundingModeRTEFloat32",
"value": false,
"comment": ["ROADMAP2024 but no good support yet"]
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderRoundingModeRTEFloat64",
"value": false
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderRoundingModeRTZFloat16",
"value": false
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderRoundingModeRTZFloat32",
"value": false
"value": true,
"expose": "REQUIRE"
},
{
"type": "bool",
"name": "shaderRoundingModeRTZFloat64",
"value": false
"value": true,
"expose": "REQUIRE"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not require limits that are contingent on features (in this case shaderFloat16 and shaderFloat32)

Comment on lines 904 to +976
"type": "bool",
"name": "shaderSignedZeroInfNanPreserveFloat16",
"value": true,
"expose": "DISABLE"
"value": true
},
{
"type": "bool",
"name": "shaderSignedZeroInfNanPreserveFloat32",
"value": true,
"expose": "DISABLE"
"value": true
},
{
"type": "bool",
"name": "shaderSignedZeroInfNanPreserveFloat64",
"value": false
"value": true
},
{
"type": "bool",
"name": "shaderDenormPreserveFloat16",
"value": false
"value": true
},
{
"type": "bool",
"name": "shaderDenormPreserveFloat32",
"value": false
"value": true
},
{
"type": "bool",
"name": "shaderDenormPreserveFloat64",
"value": false
"value": true
},
{
"type": "bool",
"name": "shaderDenormFlushToZeroFloat16",
"value": false
"value": true
},
{
"type": "bool",
"name": "shaderDenormFlushToZeroFloat32",
"value": false
"value": true
},
{
"type": "bool",
"name": "shaderDenormFlushToZeroFloat64",
"value": false
"value": true
},
{
"type": "bool",
"name": "shaderRoundingModeRTEFloat16",
"value": false,
"comment": ["ROADMAP2024 but no good support yet"]
"value": true
},
{
"type": "bool",
"name": "shaderRoundingModeRTEFloat32",
"value": false,
"comment": ["ROADMAP2024 but no good support yet"]
"value": true
},
{
"type": "bool",
"name": "shaderRoundingModeRTEFloat64",
"value": false
"value": true
},
{
"type": "bool",
"name": "shaderRoundingModeRTZFloat16",
"value": false
"value": true
},
{
"type": "bool",
"name": "shaderRoundingModeRTZFloat32",
"value": false
"value": true
},
{
"type": "bool",
"name": "shaderRoundingModeRTZFloat64",
"value": false
"value": true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a mess and needs to get fixed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can only DISABLE and value=true the 32bit ones, rest you need to DISABLE and value=false

Comment on lines -417 to -420
properties.limits.shaderUniformBufferArrayNonUniformIndexingNative = vulkan12Properties.shaderUniformBufferArrayNonUniformIndexingNative;
properties.limits.shaderSampledImageArrayNonUniformIndexingNative = vulkan12Properties.shaderSampledImageArrayNonUniformIndexingNative;
properties.limits.shaderStorageBufferArrayNonUniformIndexingNative = vulkan12Properties.shaderStorageBufferArrayNonUniformIndexingNative;
properties.limits.shaderStorageImageArrayNonUniformIndexingNative = vulkan12Properties.shaderStorageImageArrayNonUniformIndexingNative;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do you check they're not false?

Comment on lines +901 to +936
if (!properties.limits.shaderSignedZeroInfNanPreserveFloat32)
return nullptr;
if (!properties.limits.shaderDenormPreserveFloat32)
return nullptr;
if (!properties.limits.shaderDenormFlushToZeroFloat32)
return nullptr;
if (!properties.limits.shaderRoundingModeRTEFloat32)
return nullptr;
if (!properties.limits.shaderRoundingModeRTZFloat32)
return nullptr;

if (vulkan12Features.shaderFloat16) {
if (!properties.limits.shaderSignedZeroInfNanPreserveFloat16)
return nullptr;
if (!properties.limits.shaderDenormPreserveFloat16)
return nullptr;
if (!properties.limits.shaderDenormFlushToZeroFloat16)
return nullptr;
if (!properties.limits.shaderRoundingModeRTEFloat16)
return nullptr;
if (!properties.limits.shaderRoundingModeRTZFloat16)
return nullptr;
}

if (deviceFeatures.features.shaderFloat64) {
if (!properties.limits.shaderSignedZeroInfNanPreserveFloat64)
return nullptr;
if (!properties.limits.shaderDenormPreserveFloat64)
return nullptr;
if (!properties.limits.shaderDenormFlushToZeroFloat64)
return nullptr;
if (!properties.limits.shaderRoundingModeRTEFloat64)
return nullptr;
if (!properties.limits.shaderRoundingModeRTZFloat64)
return nullptr;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you don't expose them, then you need to move up the Vk Structs and check from the VkStructs, not our own limits struct

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so query vk features in Get physical device's limits/properties scope?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for a limit thats required pending a feature, don't do Vulkan Limits -> Nabla Limit to then check Nabla Feature Predicate && not Nabla Limit do Nabla Feature && ! Vulkan Limit

because keeping it as is, would require you to expose a limit to Nabla which has no business being exposed (i.e. we can assume the limit is fullfilled if we have the feature).

Example in plain english, if you have 16 bit floats, you can acount on having float controls for float16 type ops. If you don't then whether you would have had controls is irrelevant because you can't use 16bit floats.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by "Nabla feature", you mean features defined in device_features.json? shaderFloat16/64 are not defined there but in device_limit.json so they are a limit

// Enable maintenance5 and graphics pipeline libraries as backup if available
if (!enableExtensionIfAvailable(VK_KHR_MAINTENANCE_5_EXTENSION_NAME, &maintenance5Features))
{
enableExtensionIfAvailable(VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME, nullptr);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need to enable the pipeline library extension? does the Graphics Pipeline Lib Extension require it?

btw I think its best to actually pass a struct pointer, not sure how well passing nullptr works on the pNext chains :uneasy_smile:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i saw it being added in Vulkan-Samples. also passing nullptr here is fine. it won't be added to pNext chains but the extension will be inserted.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i saw it being added in Vulkan-Samples.

image

its better to quote straight from the spec, instead of relying on someone else not messing up

P.S. unrelated note, this is why I dislike devs trusting ChatGPT and asking it to distil the WebGPU spec for them

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok in this case I think its best to enable the pipeline_library extension independently if its there and pass the struct, because at some point someone will want to add that extensions and add it a second time 500 lines away and we'll have a debugging nightmare why the feature struct isn't in pNext (we have a sentinel that prevents double add)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VK_KHR_pipeline_library has no property/feature structs btw
image

Comment on lines +1874 to +1875
maintenance5Features.maintenance5 = true;
graphicsPipelineLibraryFeatures.graphicsPipelineLibrary = maintenance5Features.maintenance5 == 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

erm but you just set maintenance5 to true, maybe you should incorporate the feature struct bool setting into the ig statements at https://github.com/Devsh-Graphics-Programming/Nabla/pull/829/files#r1947966841

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

Successfully merging this pull request may close these issues.

2 participants