zeux / niagara

A Vulkan renderer written from scratch on stream
MIT License
1.26k stars 72 forks source link

SEGFAULT on an AMD 6900XT when enabling `VK_EXT_mesh_shader` #31

Closed expenses closed 1 year ago

expenses commented 2 years ago

Hi Arseny, thanks for the quick demo using VK_EXT_mesh_shader! Unfortunately for whatever I'm getting a SEGFAULT with I run it with RADV_PERFTEST=ext_ms. Have you encountered this? Is there another environment variable I should be using? Here's the full log from GDB (running via sh is the only way so far that I've figured out how to force RADV_PERFTEST=ext_ms):

gdb --args sh -c 'RADV_PERFTEST=ext_ms ./niagara ../data/kitten.obj'
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from sh...
(No debugging symbols found in sh)
(gdb) r
Starting program: /usr/bin/sh -c RADV_PERFTEST=ext_ms\ ./niagara\ ../data/kitten.obj
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
process 67360 is executing new program: /home/ashley/projects/niagara/build/niagara
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffec8e66c0 (LWP 67364)]
[New Thread 0x7fffe7ebe6c0 (LWP 67365)]
GPU0: Intel(R) Xe Graphics (TGL GT2)
GPU1: AMD Radeon RX 6900 XT (RADV NAVI21)
GPU2: llvmpipe (LLVM 14.0.6, 256 bits)
Selected GPU AMD Radeon RX 6900 XT (RADV NAVI21)

Thread 1 "niagara" received signal SIGSEGV, Segmentation fault.
0x00007fffecc7a974 in ?? () from /usr/lib/libvulkan_radeon.so
(gdb) bt
#0  0x00007fffecc7a974 in ?? () from /usr/lib/libvulkan_radeon.so
#1  0x00007fffecc5a9d2 in ?? () from /usr/lib/libvulkan_radeon.so
#2  0x00007fffecc5df7b in ?? () from /usr/lib/libvulkan_radeon.so
#3  0x00007fffecc61521 in ?? () from /usr/lib/libvulkan_radeon.so
#4  0x00007fffecc616e2 in ?? () from /usr/lib/libvulkan_radeon.so
#5  0x00005555555772f4 in createGraphicsPipeline(VkDevice_T*, VkPipelineCache_T*, VkPipelineRenderingCreateInfo const&, std::initializer_list<Shader const*>, VkPipelineLayout_T*, std::initializer_list<int>) ()
#6  0x0000555555565259 in main ()
(gdb)

Here's the device info from vulkaninfo --summary:

GPU1:
    apiVersion         = 4206818 (1.3.226)
    driverVersion      = 92282979 (0x5802063)
    vendorID           = 0x1002
    deviceID           = 0x73bf
    deviceType         = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
    deviceName         = AMD Radeon RX 6900 XT (RADV NAVI21)
    driverID           = DRIVER_ID_MESA_RADV
    driverName         = radv
    driverInfo         = Mesa 22.3.0-devel (git-c93b72d045)
    conformanceVersion = 1.3.0.0
    deviceUUID         = 00000000-8400-0000-0000-000000000000
    driverUUID         = 414d442d-4d45-5341-2d44-525600000000
expenses commented 2 years ago

I'll try and figure out how to do a debug build of mesa and get back to this.

expenses commented 2 years ago

(creating a debug build was just a case of adding options=(debug !strip) to the Arch Linux PKGBUILD).

Thread 1 "niagara" received signal SIGSEGV, Segmentation fault.
0x00007fffecc7a974 in radv_shader_spirv_to_nir (device=device@entry=0x555555a88d10, stage=stage@entry=0x7ffffffee7a0, key=key@entry=0x7fffffffc1b0) at ../mesa/src/amd/vulkan/radv_shader.c:792
792 ../mesa/src/amd/vulkan/radv_shader.c: No such file or directory.
(gdb) bt
#0  0x00007fffecc7a974 in radv_shader_spirv_to_nir (device=device@entry=0x555555a88d10,
    stage=stage@entry=0x7ffffffee7a0, key=key@entry=0x7fffffffc1b0)
    at ../mesa/src/amd/vulkan/radv_shader.c:792
#1  0x00007fffecc5a9d2 in radv_pipeline_get_nir (retain_shaders=false, pipeline_key=0x7fffffffc1b0,
    stages=0x7ffffffe47b0, pipeline=0x555556292e00) at ../mesa/src/amd/vulkan/radv_pipeline.c:3644
#2  radv_create_shaders (pipeline=0x555556292e00, pipeline_layout=0x7fffffffbf40, device=0x555555a88d10,
    cache=0x0, pipeline_key=0x7fffffffc1b0, pStages=0x555555fa9030, stageCount=3, flags=0,
    custom_hash=0x0, creation_feedback=0x0, stack_sizes=0x0, num_stack_sizes=0x0,
    last_vgt_api_stage=0x5555562937e4) at ../mesa/src/amd/vulkan/radv_pipeline.c:3948
#3  0x00007fffecc5df7b in radv_graphics_pipeline_init (pipeline=pipeline@entry=0x555556292e00,
    device=device@entry=0x555555a88d10, cache=cache@entry=0x0,
    pCreateInfo=pCreateInfo@entry=0x7fffffffc780, extra=extra@entry=0x0)
    at ../mesa/src/amd/vulkan/radv_pipeline.c:6046
#4  0x00007fffecc61521 in radv_graphics_pipeline_create (_device=_device@entry=0x555555a88d10,
    _cache=_cache@entry=0x0, pCreateInfo=pCreateInfo@entry=0x7fffffffc780, extra=extra@entry=0x0,
    pAllocator=pAllocator@entry=0x0, pPipeline=pPipeline@entry=0x7fffffffc558)
    at ../mesa/src/amd/vulkan/radv_pipeline.c:6170
--Type <RET> for more, q to quit, c to continue without paging--
#5  0x00007fffecc616e2 in radv_CreateGraphicsPipelines (_device=0x555555a88d10, pipelineCache=<optimized out>, count=<optimized out>, pCreateInfos=<optimized out>, pAllocator=0x0, pPipelines=<optimized out>)
    at ../mesa/src/amd/vulkan/radv_pipeline.c:6328
#6  0x00005555555772f4 in createGraphicsPipeline(VkDevice_T*, VkPipelineCache_T*, VkPipelineRenderingCreateInfo const&, std::initializer_list<Shader const*>, VkPipelineLayout_T*, std::initializer_list<int>) ()
#7  0x0000555555565259 in main ()

hmm lol

zeux commented 2 years ago

I think I might have seen this with slightly earlier Mesa versions; you need the absolute latest commit from Mesa repository (or, latest as of a week or two ago at least). Just checked with Mesa c93b72d0455f1487fa3fb65a6691ff44a2fbcd35 and it works fine with RADV_PERFTEST env var, no extra variables should be necessary. This is on Ubuntu. Note that you'd also need the absolute latest glslang built & installed for shaders to compile to SPIRV properly.