spirv: Make vtn_fail and friends trap in debug mode
authorCaio Oliveira <caio.oliveira@intel.com>
Tue, 8 Nov 2022 18:40:00 +0000 (10:40 -0800)
committerMarge Bot <emma+marge@anholt.net>
Sun, 13 Nov 2022 07:07:56 +0000 (07:07 +0000)
The SPIR-V parser catches its failures and failed assertions, clean up
and return a failure to the caller.  This is a good default behavior, but
when debugging sometimes is useful to hook the debugger right in the
failed assertion.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19663>

src/compiler/spirv/spirv_to_nir.c
src/microsoft/ci/spirv2dxil_reference.txt

index bb96455..827ad82 100644 (file)
@@ -202,6 +202,10 @@ _vtn_fail(struct vtn_builder *b, const char *file, unsigned line,
    if (dump_path)
       vtn_dump_shader(b, dump_path, "fail");
 
+#ifndef NDEBUG
+   os_break();
+#endif
+
    vtn_longjmp(b->fail_jump, 1);
 }
 
index 9a9face..5e4fe23 100644 (file)
@@ -495,7 +495,6 @@ SPIR-V parsing FAILED:
 
     Invalid back or cross-edge in the CFG
     0 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm:main|Fragment: Pass
@@ -542,7 +541,6 @@ SPIR-V parsing FAILED:
 
     Invalid back or cross-edge in the CFG
     0 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm:main|Fragment: Pass
@@ -609,7 +607,6 @@ SPIR-V parsing FAILED:
 
     Invalid back or cross-edge in the CFG
     0 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserCFGTest_EmitBody_If_Empty.spvasm:main|Fragment: Pass
@@ -621,7 +618,6 @@ SPIR-V parsing FAILED:
 
     Invalid back or cross-edge in the CFG
     0 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm:main|Fragment: Pass
@@ -630,7 +626,6 @@ SPIR-V parsing FAILED:
 
     Invalid back or cross-edge in the CFG
     0 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm:main|Fragment: Pass
@@ -640,7 +635,6 @@ SPIR-V parsing FAILED:
 
     Invalid back or cross-edge in the CFG
     0 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm:main|Fragment: Pass
@@ -696,7 +690,6 @@ SPIR-V parsing FAILED:
 
     Invalid back or cross-edge in the CFG
     0 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm:main|Fragment: Fail
@@ -704,7 +697,6 @@ SPIR-V parsing FAILED:
 
     Invalid back or cross-edge in the CFG
     0 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm:main|Fragment: Fail
@@ -712,7 +704,6 @@ SPIR-V parsing FAILED:
 
     Invalid back or cross-edge in the CFG
     0 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm:main|Fragment: Pass
@@ -1002,7 +993,6 @@ SPIR-V parsing FAILED:
 
     Vulkan memory model is unsupported by this driver
     68 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserTest_Impl_Source_InvalidId.spvasm:main|GLCompute: Pass
@@ -1152,7 +1142,6 @@ SPIR-V parsing FAILED:
 
     Invalid type for an SSA value
     408 bytes into the SPIR-V binary
-Compilation failed
 
 
 Test:SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm:main|GLCompute: Pass