[WIP] spirv-opt: Fix when ConvertToHalfPass relaxes a image operand#6480
Open
spencer-lunarg wants to merge 1 commit intoKhronosGroup:mainfrom
Open
[WIP] spirv-opt: Fix when ConvertToHalfPass relaxes a image operand#6480spencer-lunarg wants to merge 1 commit intoKhronosGroup:mainfrom
spencer-lunarg wants to merge 1 commit intoKhronosGroup:mainfrom
Conversation
s-perron
reviewed
Jan 5, 2026
Collaborator
s-perron
left a comment
There was a problem hiding this comment.
Please add some tests as well.
Comment on lines
+288
to
+306
| uint32_t dy_update_operand = next_operand++; | ||
| const uint32_t dy_ref_id = inst->GetSingleWordOperand(dy_update_operand); | ||
| Instruction* dy_ref_inst = get_def_use_mgr()->GetDef(dy_ref_id); | ||
| Instruction* dy_type_inst = | ||
| get_def_use_mgr()->GetDef(dy_ref_inst->type_id()); | ||
| assert(dy_type_inst->opcode() == spv::Op::OpTypeFloat); | ||
| if (dy_type_inst->GetSingleWordInOperand(0) != 32) { | ||
| Instruction* dy_cvt_inst = | ||
| builder.AddUnaryOp(float32_type, spv::Op::OpFConvert, ref_id); | ||
| if (dy_cvt_inst == nullptr) { | ||
| status_ = Status::Failure; | ||
| return false; | ||
| } | ||
| inst->SetOperand(dy_update_operand, {dy_cvt_inst->result_id()}); | ||
| get_def_use_mgr()->AnalyzeInstUse(inst); | ||
| modified = true; | ||
| } |
Collaborator
There was a problem hiding this comment.
This seems to repeat a lot of the code above, could it be factored out into a function that modifies the given operand?
Contributor
Author
There was a problem hiding this comment.
debated about it, probably better, especially if a new operand is ever added doing something similar (or worse)
Contributor
Author
100%, just was trying to mock something up for Dan to verify it works before committing... could have marked this "Draft" I guess |
1c9f3b6 to
8e632a8
Compare
This was referenced Jan 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My attempt at solving #6476