mc-imperial / spirv-control-flow

Formal modelling of SPIR-V control flow using Alloy
Apache License 2.0
2 stars 0 forks source link

Add rule to model to avoid conditional branch on loop header that does not target a merge or continue #56

Closed afd closed 1 year ago

afd commented 1 year ago

This spirv-val PR relates to this rule in the spec:

Selections must be structured. That is, an OpSelectionMerge instruction is required to precede:

an OpSwitch instruction

an OpBranchConditional instruction that has different True Label and False Label operands where neither are declared merge blocks or Continue Targets.

It appears that we do not have a corresponding rule for this.

I think we need a rule to require the following:

Another way of stating this:

afd commented 1 year ago

@vili-1 would you be able to look into adding this, and check that it doesn't lead to any good examples being rejected?

vili-1 commented 1 year ago

@afd I modelled this (and the test case is rejected now of course). I laso checked again most of the CFGs extracted from VK-GL-CTS and no surprises.

afd commented 1 year ago

Great - once we're fully confident that we want this new rule, can you commit it to the model and close this issue? Thanks.