Summary: | Talos Principle Vulkan version crash: spirv_to_nir() returns NULL entry_point | ||
---|---|---|---|
Product: | Mesa | Reporter: | Eero Tamminen <eero.t.tamminen> |
Component: | Drivers/DRI/i965 | Assignee: | Jason Ekstrand <jason> |
Status: | VERIFIED FIXED | QA Contact: | Intel 3D Bugs Mailing List <intel-3d-bugs> |
Severity: | normal | ||
Priority: | medium | ||
Version: | git | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Eero Tamminen
2017-12-13 16:32:09 UTC
Manual git bisect gave following as the first bad commit: --------------------------------------------------------- commit a7c2be9944a9e2028a02fcfbab501891293401b1 Author: Jason Ekstrand <jason.ekstrand@intel.com> AuthorDate: Wed Dec 6 09:14:20 2017 -0800 Commit: Jason Ekstrand <jason.ekstrand@intel.com> CommitDate: Mon Dec 11 22:28:34 2017 -0800 spirv: Add type validation for OpSelect Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> --------------------------------------------------------- FYI: Ever since 94ca8e04adf681b0cad6ade1c9f28856efe35ae6, most SPIR-V errors result in spirv_to_nir bailing cleanly and returning a NULL. anv_pipeline_compile_to_nir then dereferences the NULL and crashes. A more useful backtrace would be if you set a breakpoint on _vtn_fail and gave me the backtrace from there. Arguably, it may be better to add an abort() to _vtn_fail when built in debug mode because the NULL dereference is kind-of mean. My dev SSD was completely corrupted this morning (fsck.ext4 has been listing inodes with issues for the last half an hour). -> I won't be able to provide better backtrace before next year (without working setup it would take too much time, so other stuff than Steam gets more priority until that). :-/ Miraculously, the SSD got into fully working condition eventually (never happened to me before, with that much errors from fsck). Here's the backtrace you asked: ---------------------------------------------- Thread 1 "Talos" hit Breakpoint 1, _vtn_fail (b=b@entry=0x5169c60, file=file@entry=0x7fffe6828cc0 "../../../src/compiler/spirv/spirv_to_nir.c", line=line@entry=3517, fmt=fmt@entry=0x7fffe6829980 "Condition type of OpSelect must be a scalar or vector of Boolean type. It must have the same number of components as Result Type") at ../../../src/compiler/spirv/spirv_to_nir.c:112 112 { (gdb) bt #0 _vtn_fail (b=b@entry=0x5169c60, file=file@entry=0x7fffe6828cc0 "../../../src/compiler/spirv/spirv_to_nir.c", line=line@entry=3517, fmt=fmt@entry=0x7fffe6829980 "Condition type of OpSelect must be a scalar or vector of Boolean type. It must have the same number of components as Result Type") at ../../../src/compiler/spirv/spirv_to_nir.c:112 #1 0x00007fffe67b5f0c in vtn_handle_body_instruction (b=0x5169c60, opcode=<optimized out>, w=0x3c67bfc, count=<optimized out>) at ../../../src/compiler/spirv/spirv_to_nir.c:3514 #2 0x00007fffe67ae7a6 in vtn_foreach_instruction (b=b@entry=0x5169c60, start=<optimized out>, end=end@entry=0x3c67c60, handler=handler@entry=0x7fffe67b4a00 <vtn_handle_body_instruction>) at ../../../src/compiler/spirv/spirv_to_nir.c:323 #3 0x00007fffe67c31e1 in vtn_emit_cf_list (b=b@entry=0x5169c60, cf_list=cf_list@entry=0x5121f38, switch_fall_var=switch_fall_var@entry=0x0, has_switch_break=has_switch_break@entry=0x0, handler=handler@entry=0x7fffe67b4a00 <vtn_handle_body_instruction>) at ../../../src/compiler/spirv/vtn_cfg.c:703 #4 0x00007fffe67c3562 in vtn_function_emit (b=b@entry=0x5169c60, func=func@entry=0x5121f10, instruction_handler=instruction_handler@entry=0x7fffe67b4a00 <vtn_handle_body_instruction>) at ../../../src/compiler/spirv/vtn_cfg.c:878 #5 0x00007fffe67b6394 in spirv_to_nir (words=<optimized out>, words@entry=0x3c675e8, word_count=416, spec=spec@entry=0x0, num_spec=num_spec@entry=0, stage=stage@entry=MESA_SHADER_FRAGMENT, entry_point_name=<optimized out>, options=0x7fffffff8c80, nir_options=0x7fffe6806fc0 <scalar_nir_options>) at ../../../src/compiler/spirv/spirv_to_nir.c:3742 #6 0x00007fffe6411a55 in anv_shader_compile_to_nir (pipeline=0x5123fd0, pipeline=0x5123fd0, spec_info=0x0, stage=MESA_SHADER_FRAGMENT, entrypoint_name=0x7fffffff8e40 "", module=0x3c675d0, mem_ctx=0x3c674b0) at ../../../src/intel/vulkan/anv_pipeline.c:149 #7 anv_pipeline_compile (pipeline=pipeline@entry=0x5123fd0, mem_ctx=mem_ctx@entry=0x3c674b0, module=module@entry=0x3c675d0, entrypoint=entrypoint@entry=0x237b915 "main", stage=stage@entry=MESA_SHADER_FRAGMENT, spec_info=spec_info@entry=0x0, prog_data=0x7fffffff8e40, map=0x7fffffff8d60) at ../../../src/intel/vulkan/anv_pipeline.c:395 #8 0x00007fffe6412162 in anv_pipeline_compile_fs (pipeline=pipeline@entry=0x5123fd0, cache=cache@entry=0x3af2090, info=info@entry=0x7fffec7ac9b0, module=module@entry=0x3c675d0, entrypoint=0x237b915 "main", spec_info=0x0) at ../../../src/intel/vulkan/anv_pipeline.c:871 #9 0x00007fffe641393e in anv_pipeline_init (pipeline=pipeline@entry=0x5123fd0, device=device@entry=0x3bfde10, cache=cache@entry=0x3af2090, pCreateInfo=pCreateInfo@entry=0x7fffec7ac9b0, alloc=0x3bfde18, alloc@entry=0x0) at ../../../src/intel/vulkan/anv_pipeline.c:1347 #10 0x00007fffe65ae8cf in gen9_graphics_pipeline_create (pPipeline=0x7fffffffcaf0, pAllocator=0x0, pCreateInfo=0x7fffec7ac9b0, cache=0x3af2090, _device=0x3bfde10) at ../../../src/intel/vulkan/genX_pipeline.c:1661 #11 gen9_CreateGraphicsPipelines (_device=0x3bfde10, pipelineCache=0x3af2090, count=1, pCreateInfos=<optimized out>, pAllocator=0x0, pPipelines=0x7fffffffcaf0) at ../../../src/intel/vulkan/genX_pipeline.c:1864 (gdb) up #1 0x00007fffe67b5f0c in vtn_handle_body_instruction (b=0x5169c60, opcode=<optimized out>, w=0x3c67bfc, count=<optimized out>) at ../../../src/compiler/spirv/spirv_to_nir.c:3514 3514 vtn_fail_if(sel_val->type->type != sel_type, (gdb) info locals ssa = <optimized out> sel_type = <optimized out> res_type = <optimized out> (gdb) print *b $1 = {nb = {cursor = {option = nir_cursor_after_instr, {block = 0x516a5d0, instr = 0x516a5d0}}, exact = false, shader = 0x5125820, impl = 0x51220d0}, fail_jump = {{__jmpbuf = {37206293, -845490108815733866, 85082064, 140737488326208, 63337960, 63337960, 845490111369350038, 845546221558336406}, __mask_was_saved = 0, __saved_mask = {__val = {0 <repeats 16 times>}}}}, spirv = 0x3c675e8, shader = 0x5125820, options = 0x7fffffff8c80, block = 0x0, spirv_offset = 1556, file = 0x0, line = -1, col = -1, const_table = 0x5122830, phi_table = 0x5122950, num_specializations = 0, specializations = 0x0, value_id_bound = 24916, values = 0x516e490, entry_point_stage = MESA_SHADER_FRAGMENT, entry_point_name = 0x237b915 "main", entry_point = 0x51a5968, origin_upper_left = true, pixel_center_integer = false, func = 0x0, functions = {head_sentinel = {next = 0x5121f10, prev = 0x0}, tail_sentinel = {next = 0x0, prev = 0x5121f10}}, func_param_idx = 0, has_loop_continue = false} (gdb) c Continuing. Thread 1 "Talos" received signal SIGSEGV, Segmentation fault. anv_shader_compile_to_nir (pipeline=0x5123fd0, pipeline=0x5123fd0, spec_info=0x0, stage=MESA_SHADER_FRAGMENT, entrypoint_name=0x7fffffff8e40 "", module=0x3c675d0, mem_ctx=0x3c674b0) at ../../../src/intel/vulkan/anv_pipeline.c:153 153 nir_shader *nir = entry_point->shader; ---------------------------------------------- There's a patch on the list to fix this: https://patchwork.freedesktop.org/patch/193453/ This is fixed by the following commit: commit 3be382cd7cb637f463a4618dc19d87d66a644b0e Author: Jason Ekstrand <jason.ekstrand@intel.com> Date: Thu Dec 14 19:53:05 2017 -0800 spirv: Relax the validation conditions of OpSelect The Talos Principle contains shaders with an OpSelect between two vectors where the condition is a scalar boolean. This is technically against the spec bout nir_builder gracefully handles it by splatting out the condition to all the channels. So long as the condition is a boolean, just emit a warning instead of failing. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104246 Verified with Mesa git tip. |
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.