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

Is there a way to disable features? #393

Closed
HansKristian-Work opened this issue Mar 30, 2023 · 9 comments · Fixed by #397
Closed

Is there a way to disable features? #393

HansKristian-Work opened this issue Mar 30, 2023 · 9 comments · Fixed by #397

Comments

@HansKristian-Work
Copy link

HansKristian-Work commented Mar 30, 2023

I was adding profile support to a project and I ran into some weirdness with features.

My assumption is that features are disabled unless enabled by a profile, but that does not seem to be the case. E.g. given this profile:

{
    "$schema": "https://schema.khronos.org/vulkan/profiles-0.8.0-139.json#",
    "capabilities": {
        "baseline": {
            "extensions": {
                "VK_KHR_16bit_storage": 1,
                "VK_KHR_8bit_storage": 1,
                "VK_KHR_create_renderpass2": 1
            },
            "features": {
                "VkPhysicalDeviceFeatures": {
                    "robustBufferAccess": false
                }
            }
        },
        "externalHost": {
            "extensions": {
                "VK_EXT_external_memory_host": 1
            },
            "features": {
                "VkPhysicalDeviceFeatures": {
                    "robustBufferAccess": false
                }
            },
            "properties": {
                "VkPhysicalDeviceExternalMemoryHostPropertiesEXT": {
                    "minImportedHostPointerAlignment": 65536
                }
            }
        }
    },
    "profiles": {
        "VP_PARALLEL_RDP_baseline": {
            "version": 1,
            "api-version": "1.1.0",
            "label": "parallel-RDP baseline profile",
            "description": "Minimum baseline for running parallel-RDP.",
            "contributors": {},
            "history": [
                {
                    "revision": 1,
                    "date": "2023-03-30",
                    "author": "Themaister",
                    "comment": "First draft"
                }
            ],
            "capabilities": [
                "baseline"
            ]
        },
        "VP_PARALLEL_RDP_optimal": {
            "version": 1,
            "api-version": "1.1.0",
            "label": "parallel-RDP optimal profile",
            "description": "Optimal configuration for running parallel-RDP.",
            "contributors": {},
            "history": [
                {
                    "revision": 1,
                    "date": "2023-03-30",
                    "author": "Themaister",
                    "comment": "First draft"
                }
            ],
            "capabilities": [
                "baseline", "externalHost"
            ]
        }
    }
}

I'm using the profiles layer to create a min-spec device:

export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:VK_LAYER_KHRONOS_profiles
export VK_KHRONOS_PROFILES_PROFILE_FILE=blah.json
export VK_KHRONOS_PROFILES_PROFILE_NAME=VP_PARALLEL_RDP_optimal
export VK_KHRONOS_PROFILES_SIMULATE_CAPABILITIES=SIMULATE_API_VERSION_BIT,SIMULATE_FEATURES_BIT,SIMULATE_PROPERTIES_BIT,SIMULATE_EXTENSIONS_BIT,SIMULATE_FORMATS_BIT,SIMULATE_QUEUE_FAMILY_PROPERTIES_BIT

I get warnings during execution:

PROFILES WARNING: 'robustBufferAccess' profile value is enabled in the profile, but the device does not support it.

I ran vulkaninfo with layer enabled and I get:

VkPhysicalDeviceFeatures:
=========================
        robustBufferAccess                      = false              <- This is overridden to false.
        fullDrawIndexUint32                     = true
        imageCubeArray                          = true
        independentBlend                        = true
        geometryShader                          = true
        tessellationShader                      = true
        sampleRateShading                       = true
        dualSrcBlend                            = true
        logicOp                                 = true
        multiDrawIndirect                       = true
        drawIndirectFirstInstance               = true
        depthClamp                              = true
        depthBiasClamp                          = true
        fillModeNonSolid                        = true
        depthBounds                             = true
        wideLines                               = true
        largePoints                             = true
        alphaToOne                              = false
        multiViewport                           = true
        samplerAnisotropy                       = true
        textureCompressionETC2                  = false
        textureCompressionASTC_LDR              = false
        textureCompressionBC                    = true
        occlusionQueryPrecise                   = true
        pipelineStatisticsQuery                 = true
        vertexPipelineStoresAndAtomics          = true
        fragmentStoresAndAtomics                = true
        shaderTessellationAndGeometryPointSize  = true
        shaderImageGatherExtended               = true
        shaderStorageImageExtendedFormats       = true
        shaderStorageImageMultisample           = true
        shaderStorageImageReadWithoutFormat     = true
        shaderStorageImageWriteWithoutFormat    = true
        shaderUniformBufferArrayDynamicIndexing = true
        shaderSampledImageArrayDynamicIndexing  = true
        shaderStorageBufferArrayDynamicIndexing = true
        shaderStorageImageArrayDynamicIndexing  = true
        shaderClipDistance                      = true
        shaderCullDistance                      = true
        shaderFloat64                           = true
        shaderInt64                             = true
        shaderInt16                             = true
        shaderResourceResidency                 = true
        shaderResourceMinLod                    = true
        sparseBinding                           = true
        sparseResidencyBuffer                   = true
        sparseResidencyImage2D                  = true
        sparseResidencyImage3D                  = true
        sparseResidency2Samples                 = false
        sparseResidency4Samples                 = false
        sparseResidency8Samples                 = false
        sparseResidency16Samples                = false
        sparseResidencyAliased                  = true
        variableMultisampleRate                 = true
        inheritedQueries                        = true
@christophe-lunarg
Copy link
Collaborator

Thanks to the vulkaninfo log I am guessing that your bug report is actually that the warning message is not correct? And should not be displayed at all.

Or am I missing something?

@HansKristian-Work
Copy link
Author

HansKristian-Work commented Mar 30, 2023

There's two issues here I think:

  • Layer warns about feature not being supported, which is weird, because I explicitly disabled it. It also says "feature was enabled", which is not true either.
  • I cannot find a way to make physical device features opt-in, only opt-out. Is this intentional? It would be possible to force every feature bit to false perhaps, but feels counter-intuitive, given the purpose of the profile system in the first place.

@christophe-lunarg
Copy link
Collaborator

christophe-lunarg commented Mar 30, 2023

  • I'll resolve the incorrect message.

  • I cannot find a way to make physical device features opt-in, only opt-out I am not 100% sure about what you mean here.
    The profiles layer work by overriding the physical device features with the value in the used profiles. If the feature is not used in the profiles JSON file then the value of the physcial device is used. So do you want a mode that everything not declare in the profiles would be set false or true by default?

@HansKristian-Work
Copy link
Author

The profiles layer work by overriding the physical device features with the value in the used profiles. If the feature is not used in the profiles JSON file then the value of the physcial device is used.

Ok. If an application were to use the vpCreateDevice API would it work like "false by default"? If that's the case, it seems reasonable to add an option to profile layer to assume any feature is not supported unless it's required by an enabled extension in question.

@christophe-lunarg
Copy link
Collaborator

I think I have a beginning of a solution here: #397

I am still unsure how to handle properties considering that there is no programmable way to get Vulkan specification default/min requirement values and zeros could be misleading or incorrect... Well I'll continous investigating!

@christophe-lunarg
Copy link
Collaborator

christophe-lunarg commented Apr 5, 2023

I think the feature is ready: #397

Considering that appearly you choose to not use Vulkan Configurator, you can use the environment variable VK_KHRONOS_PROFILES_DEFAULT_FEATURE_VALUES with the value DEFAULT_FEATURE_VALUES_DEVICE to load the device feature values or DEFAULT_FEATURE_VALUES_FALSE to set this value to VK_FALSE when a value is not specified in the profile.

I hope I understood well enough the problem you where trying to resolve which led me to this solution.

Let me know if you are experiencing any issue!

@HansKristian-Work
Copy link
Author

Thanks. I'll look into this when I'm back from holidays.

@HansKristian-Work
Copy link
Author

@christophe-lunarg Seems to work as intended. Thanks!

@christophe-lunarg
Copy link
Collaborator

Welcome @HansKristian-Work ! :)

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 a pull request may close this issue.

2 participants