cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

vkCmdEndRenderPass: Vulkan Crash on latest Drivers on

Hi! Vulkan application crashes on latest drivers 

Adrenalin-edition-23.2.2-win10-win11-feb22

VulkanDemo AMD Crash  - arhive has nv_1650.rdc - nVidia RenderDoc capture

I have no problem on nVidia 1650, Intel UHD 630.

Crash happens during call vkCmdEndRenderPass

Exception thrown at 0x00007FFB7C473AA0 (amdvlk64.dll) in VulkanTestd.exe: 0xC0000005: Access violation reading location 0x000001BA983F5F14.

I have no Validation error messages. 

0 Likes
1 Solution

Hey Andrey2007AMD,

Here's the response from Omar Alam, one of our developers:

The app has the following code to select a depth format:

 

 

const VkFormat depthFormats[] = {
#ifdef EMBEDDED_SYSTEM
            VK_FORMAT_D16_UNORM,
            VK_FORMAT_D16_UNORM_S8_UINT,
#endif
            VK_FORMAT_D24_UNORM_S8_UINT,
            VK_FORMAT_D32_SFLOAT,
            VK_FORMAT_D32_SFLOAT_S8_UINT,
        };
        const char* strFormats[] = {
#ifdef EMBEDDED_SYSTEM
            "VK_FORMAT_D16_UNORM",
            "VK_FORMAT_D16_UNORM_S8_UINT",
#endif
            "VK_FORMAT_D24_UNORM_S8_UINT",
            "VK_FORMAT_D32_SFLOAT",
            "VK_FORMAT_D32_SFLOAT_S8_UINT",
        };
        for (size_t i = 0; i < countof(depthFormats); ++i) {
            VkFormatProperties formatProps;
            VkFormat format = depthFormats[i];
            vkPhysicalDevice.GetPhysicalDeviceFormatProperties(format, formatProps);
            // Format must support depth stencil attachment for optimal tiling
            if (formatProps.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) {
                vkDepthSurfaceFormat = format;
                LogMsg("Depth format %s\n", strFormats[i]);
                break;
            }
        }
        return vkDepthSurfaceFormat;
    }

 

 

in the InitImageFormatProperties (VulkanDevice.cpp of provided code).

The format that gets selected based on the conditional in the for loop that iterates over all formats to select a suitable one is: VK_FORMAT_D32_SFLOAT which is a depth only format. 

The problem occurs when the Stencil aspect of the image is being resolved. Basically, when this depth format gets selected it is a depth only format and attempting a stencil resolve causes a segmentation fault since no memory and addresses get allocated for the stencil component and invalid pointers are accessed leading to a crash. An easy fix for the code on the app side is to double check which image formats are selected to make sure a stencil component is also present if stencil resolve is needed.

At present, the Vulkan specification seems to be unclear on the expected behavior and legality of this operation (stencil resolve on a depth only image). I have verified that the crash can be avoided with other hardware configurations such as my current development machine (Ryzen 7 5700G + RX 460 dGPU) using the amd vulkan driver but that is purely down to the underlying implementation and how the resolve is set up. An issue has been filed with Khronos to determine the correct behavior in this scenario, but it is unclear for now.  

 

 

View solution in original post

13 Replies
dipak
Big Boss

Hi @Andrey2007AMD ,

Thanks for reporting the issue and providing the demo application. I have forwarded the issue to the Vulkan team.

Thanks.

Hi @Andrey2007AMD 

Thanks for providing the binary and renderdoc capture. Can you also upload the compilable source code for VulkanTest as well to help us easier debug this issue?

Thanks,

Owen

0 Likes

Hi @Owen_Zhang , I will provide a source code later,  bacause I need some time to extract a source code with minimal test  case from full 3DEngine's source code.

0 Likes

Hi @Owen_Zhang I have uploaded Test with source code: VulkanDemo AMD Crash2  

0 Likes

Thanks @Andrey2007AMD 

I've created a ticket SWDEV-387245 to track this issue, and a dev is looking into it.

Hi @Owen_Zhang 

whql-amd-software-adrenalin-edition-23.3.2-win10-win11-mar22.exe

Crash can be reproduced.

0 Likes

@Owen_Zhang 

Crash can be reproduced on whql-amd-software-adrenalin-edition-23.4.1 driver

0 Likes

Hi @Owen_Zhang 

Do you have any update ? Crash can be reproduced on WHQL-AMD-Software-Adrenalin-Edition-23.4.2-Win10-Win11-Apr20 and WHQL-AMD-Software-Adrenalin-Edition-23.4.3-Win10-Win11-Apr27 driver

0 Likes

@Owen_Zhang 

Crash can be reproduced on whql-amd-software-adrenalin-edition-23.5.1-win10-win11-may24.exe

0 Likes

Hey Andrey2007AMD,

Here's the response from Omar Alam, one of our developers:

The app has the following code to select a depth format:

 

 

const VkFormat depthFormats[] = {
#ifdef EMBEDDED_SYSTEM
            VK_FORMAT_D16_UNORM,
            VK_FORMAT_D16_UNORM_S8_UINT,
#endif
            VK_FORMAT_D24_UNORM_S8_UINT,
            VK_FORMAT_D32_SFLOAT,
            VK_FORMAT_D32_SFLOAT_S8_UINT,
        };
        const char* strFormats[] = {
#ifdef EMBEDDED_SYSTEM
            "VK_FORMAT_D16_UNORM",
            "VK_FORMAT_D16_UNORM_S8_UINT",
#endif
            "VK_FORMAT_D24_UNORM_S8_UINT",
            "VK_FORMAT_D32_SFLOAT",
            "VK_FORMAT_D32_SFLOAT_S8_UINT",
        };
        for (size_t i = 0; i < countof(depthFormats); ++i) {
            VkFormatProperties formatProps;
            VkFormat format = depthFormats[i];
            vkPhysicalDevice.GetPhysicalDeviceFormatProperties(format, formatProps);
            // Format must support depth stencil attachment for optimal tiling
            if (formatProps.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) {
                vkDepthSurfaceFormat = format;
                LogMsg("Depth format %s\n", strFormats[i]);
                break;
            }
        }
        return vkDepthSurfaceFormat;
    }

 

 

in the InitImageFormatProperties (VulkanDevice.cpp of provided code).

The format that gets selected based on the conditional in the for loop that iterates over all formats to select a suitable one is: VK_FORMAT_D32_SFLOAT which is a depth only format. 

The problem occurs when the Stencil aspect of the image is being resolved. Basically, when this depth format gets selected it is a depth only format and attempting a stencil resolve causes a segmentation fault since no memory and addresses get allocated for the stencil component and invalid pointers are accessed leading to a crash. An easy fix for the code on the app side is to double check which image formats are selected to make sure a stencil component is also present if stencil resolve is needed.

At present, the Vulkan specification seems to be unclear on the expected behavior and legality of this operation (stencil resolve on a depth only image). I have verified that the crash can be avoided with other hardware configurations such as my current development machine (Ryzen 7 5700G + RX 460 dGPU) using the amd vulkan driver but that is purely down to the underlying implementation and how the resolve is set up. An issue has been filed with Khronos to determine the correct behavior in this scenario, but it is unclear for now.  

 

 

Hi @Owen_Zhang 

Thank you for your response!

0 Likes

Hi @Owen_Zhang  

Crash can be reproduced on whql-amd-software-adrenalin-edition-23.7.1-win10-win11-july6.exe

0 Likes

H! @Owen_Zhang 

Crash can be reproduced on whql-amd-software-adrenalin-edition-23.7.2-win10-win11-july25.exe

0 Likes