Bug 97213

Summary: SIGSEGV - spirv_to_nir - in vkQuake
Product: Mesa Reporter: Groleo Marius <groleo>
Component: Drivers/Vulkan/intelAssignee: Intel 3D Bugs Mailing List <intel-3d-bugs>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: bugs.freedesktop.org, jason
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Groleo Marius 2016-08-05 09:40:19 UTC
I'm trying to run vkQuake (https://github.com/Novum/vkQuake) on a Skylake machine, but it crashes.

The vulkan driver was compiled from commit b521083ffb351b7fe2521a47731a46cdbb614117

(gdb) bt
#0  exec_list_push_tail (n=0x231d2f8, list=0x50) at ../../src/compiler/glsl/list.h:445
#1  nir_function_impl_add_variable (var=0x231d2f8, impl=0x0) at ./nir/nir.h:1931
#2  vtn_handle_variables (b=0x23011d8, opcode=opcode@entry=SpvOpVariable, w=w@entry=0x23077ac, count=<optimized out>) at spirv/vtn_variables.c:1319
#3  0x00007f1caa1bfbed in vtn_handle_variable_or_type_instruction (b=0x23011d8, opcode=SpvOpVariable, w=0x23077ac, count=4) at spirv/spirv_to_nir.c:2608
#4  0x00007f1caa1c1f9f in vtn_foreach_instruction (b=b@entry=0x23011d8, start=start@entry=0x2307738, end=end@entry=0x2307a34, handler=handler@entry=0x7f1caa1bfb60 <vtn_handle_variable_or_type_instruction>)
    at spirv/spirv_to_nir.c:231
#5  0x00007f1caa1c7865 in spirv_to_nir (words=0x2307738, words@entry=0x2307560, word_count=<optimized out>, spec=spec@entry=0x0, num_spec=0, stage=stage@entry=MESA_SHADER_FRAGMENT, 
    entry_point_name=entry_point_name@entry=0x468063 "main", options=0x7f1caa2f8a40 <scalar_nir_options>) at spirv/spirv_to_nir.c:2896
#6  0x00007f1caa0c93cf in anv_shader_compile_to_nir (device=<optimized out>, spec_info=<optimized out>, stage=<optimized out>, entrypoint_name=0x468063 "main", module=0x1f22b98) at anv_pipeline.c:135
#7  anv_pipeline_compile (pipeline=pipeline@entry=0x2388390, module=module@entry=0x2307540, entrypoint=<optimized out>, entrypoint@entry=0x468063 "main", stage=stage@entry=MESA_SHADER_FRAGMENT, spec_info=<optimized out>, 
    prog_data=prog_data@entry=0x7ffe42884100, map=0x7ffe42884010) at anv_pipeline.c:317
#8  0x00007f1caa0c97d8 in anv_pipeline_compile_fs (pipeline=pipeline@entry=0x2388390, cache=cache@entry=0x222eb08, info=info@entry=0x7ffe42886920, extra=extra@entry=0x0, module=module@entry=0x2307540, entrypoint=0x468063 "main", 
    spec_info=0x0) at anv_pipeline.c:608
#9  0x00007f1caa0cad67 in anv_pipeline_init (pipeline=pipeline@entry=0x2388390, device=device@entry=0x222e850, cache=cache@entry=0x222eb08, pCreateInfo=pCreateInfo@entry=0x7ffe42886920, extra=extra@entry=0x0, alloc=0x222e858, 
    alloc@entry=0x0) at anv_pipeline.c:1202
#10 0x00007f1caa2e836d in gen9_graphics_pipeline_create (_device=0x222e850, cache=0x222eb08, pCreateInfo=0x7ffe42886920, extra=0x0, pAllocator=0x0, pPipeline=0x702850) at gen8_pipeline.c:165
#11 0x00007f1caa0cb065 in anv_graphics_pipeline_create (_device=_device@entry=0x222e850, _cache=_cache@entry=0x0, pCreateInfo=pCreateInfo@entry=0x7ffe42886920, extra=extra@entry=0x0, pAllocator=pAllocator@entry=0x0, 
    pPipeline=pPipeline@entry=0x702850) at anv_pipeline.c:1294
#12 0x00007f1caa0cb0ee in anv_CreateGraphicsPipelines (_device=0x222e850, pipelineCache=0x0, count=1, pCreateInfos=<optimized out>, pAllocator=0x0, pPipelines=0x702850) at anv_pipeline.c:1312
Comment 1 Groleo Marius 2016-08-05 13:31:31 UTC
It looks like this line from vkquake/Shaders/postprocess.frag is causing the problem.

layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInput color_input;

Taking out subpassInput and using simple in/out makes it start (though nothing gets rendered)
Comment 2 Vedran Rodic 2016-11-30 05:03:26 UTC
Can you re-test? vkQuake seems to be working fine in current git (for me on RADV that uses the same infrastructure).
Comment 3 Jason Ekstrand 2017-01-20 05:18:57 UTC
This has been fixed since:

commit 1d5ac0a462ac8c7f41e1e1adb1fc5a7db6038d17
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Tue Nov 15 15:25:55 2016 -0800

    anv: Set up binding tables and surface states for input attachments
    
    This commit adds the last remaining bits to support input attachments in
    the Intel Vulkan driver.  For color and depth attachments, we allocate an
    input attachment surface state during vkCmdBeginRenderPass like we do for
    the render target surface states.  This is so that we can incorporate the
    clear color and aux information as used in rendering.  For stencil, we just
    treat it like a regular texture because we don't there is no aux.  Also,
    only having to worry about at most one input attachment surface for each
    attachment makes some of the vkCmdBeginRenderPass code simpler.
    
    Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.