-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hitting assert/crash when trying to fold specialization constant #5492
Comments
removing the fold logic is done in the function pointer returned from for (auto rule : GetConstantFoldingRules().GetRulesForInstruction(inst)) {
folded_const = rule(context_, inst, constants); logic instead it gets to if (!inst->IsFloatingPointFoldingAllowed()) {
return nullptr;
} call, which propagates all the badness that causes things to fail |
Yeah, I think this sums it up: SPIRV-Tools/source/opt/instruction.cpp Line 804 in 0d87845
Can we return
new_const_inst is null? Since there are known unsupported cases, it seems like we should, rather than crash.
|
agree, I rather first not crash over anything |
@s-perron if this sounds like an acceptable change, I can put up a PR. |
Yes, please open a PR. |
Remove assertion in FoldWithInstructionFolder; there are cases where folding spec constants is unsupported. Closes KhronosGroup#5492.
Remove assertion in FoldWithInstructionFolder; there are cases where folding spec constants is unsupported. Closes #5492.
Running any CTS test family
dEQP-VK.spirv_assembly.instruction.graphics.opquantize.spec_const_*inf_*
ordEQP-VK.spirv_assembly.instruction.graphics.opquantize.spec_const_*nan_*
with VVL enabled will result in hitting the following assert:opt/fold_spec_constant_op_and_composite_pass.cpp:179: spvtools::opt::Instruction* spvtools::opt::FoldSpecConstantOpAndCompositePass::FoldWithInstructionFolder(spvtools::opt::Module::inst_iterator*): Assertion 'new_const_inst != nullptr && "Failed to fold instruction that must be folded."' failed.
. If run in Release it'll crash.This can be triggered by running
spirv-opt --freeze-spec-const --fold-spec-const-op-composite -o <output_file> <provided_spirv>
.Here's an example SPIR-V shader that triggers the assert:
It would be good not to crash when something cannot be folded.
The text was updated successfully, but these errors were encountered: