Skip to content
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

opt: add OpExtInst forward ref fixup pass #5708

Merged
merged 6 commits into from
Jun 13, 2024

Conversation

Keenuts
Copy link
Contributor

@Keenuts Keenuts commented Jun 12, 2024

This pass fixups the opcode used for OpExtInst instructions to use OpExtInstWithForwardRefsKHR when it contains a forward reference.
This pass is agnostic to the extension used, hence the validity of the code depends of the validity of the usage:

If a forward reference is used on a non-semantic extended instruction, the generated code will remain invalid, but the opcode will change. What this pass guarantees is valid code won't become invalid.

This pass fixups the opcode used for OpExtInst instructions
to use OpExtInstWithForwardRefsKHR when it contains a forward
reference.
This pass is agnostic to the extension used, hence the validity
of the code depends of the validity of the usage:

If a forward reference is used on a non-semantic extended instruction,
the generated code will remain invalid, but the opcode will change.
What this pass guarantees is valid code won't become invalid.

Signed-off-by: Nathan Gauër <brioche@google.com>
source/opt/optimizer.cpp Show resolved Hide resolved
test/opt/opextinst_forward_ref_fixup_pass_test.cpp Outdated Show resolved Hide resolved
source/opt/opextinst_forward_ref_fixup_pass.h Outdated Show resolved Hide resolved
source/opt/opextinst_forward_ref_fixup_pass.cpp Outdated Show resolved Hide resolved
test/opt/opextinst_forward_ref_fixup_pass_test.cpp Outdated Show resolved Hide resolved
source/opt/opextinst_forward_ref_fixup_pass.cpp Outdated Show resolved Hide resolved
source/opt/opextinst_forward_ref_fixup_pass.cpp Outdated Show resolved Hide resolved
source/opt/opextinst_forward_ref_fixup_pass.cpp Outdated Show resolved Hide resolved
source/opt/opextinst_forward_ref_fixup_pass.cpp Outdated Show resolved Hide resolved
include/spirv-tools/optimizer.hpp Outdated Show resolved Hide resolved
Signed-off-by: Nathan Gauër <brioche@google.com>
Signed-off-by: Nathan Gauër <brioche@google.com>
Signed-off-by: Nathan Gauër <brioche@google.com>
@Keenuts Keenuts requested a review from s-perron June 12, 2024 16:35
Co-authored-by: Steven Perron <stevenperron@google.com>
@Keenuts Keenuts enabled auto-merge (squash) June 13, 2024 07:22
@Keenuts Keenuts merged commit bc28ac7 into KhronosGroup:main Jun 13, 2024
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants