[waveasm] Add NonEmittingOp trait and InsertOp to WaveASM dialect#1209
Open
Hardcode84 wants to merge 1 commit intoiree-org:mainfrom
Open
[waveasm] Add NonEmittingOp trait and InsertOp to WaveASM dialect#1209Hardcode84 wants to merge 1 commit intoiree-org:mainfrom
Hardcode84 wants to merge 1 commit intoiree-org:mainfrom
Conversation
harsh-nod
reviewed
Mar 31, 2026
harsh-nod
reviewed
Mar 31, 2026
| auto sourceIt = info.ranges.find(source); | ||
| while (sourceIt == info.ranges.end()) { | ||
| auto defOp = source.getDefiningOp<InsertOp>(); | ||
| if (!defOp) |
Collaborator
There was a problem hiding this comment.
maybe throw a warning or assertion here
Contributor
Author
There was a problem hiding this comment.
No, this is expected behavior, chains are always end on non-insert ops (pack).
Collaborator
There was a problem hiding this comment.
no but if you dont find the defining op, then shouldnt you raise a warning or assert?
harsh-nod
reviewed
Mar 31, 2026
Add NonEmittingOp trait to replace the hardcoded op list in HazardMitigation, and add InsertOp as the dual of ExtractOp for in-place sub-register replacement in wide registers. NonEmittingOp trait is applied to PackOp, ExtractOp, InsertOp, PrecoloredSRegOp, PrecoloredVRegOp, ConstantOp, DCEProtectOp, and YieldOp. HazardMitigation now checks the trait instead of maintaining a manual isa<> list. InsertOp replaces a single element in a wide register without extracting all words and rebuilding via PackOp. Liveness and regalloc handle chained inserts and shared-value copies. Used in handleFatRawBufferCast suppress-swizzle path for PackOp-built SRDs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
ea1b161 to
d4c8ada
Compare
harsh-nod
reviewed
Apr 1, 2026
| << "inserted value register class must match source register class: " | ||
| "source " | ||
| << vectorType << ", value " << valueType; | ||
|
|
Collaborator
There was a problem hiding this comment.
This verify function accepts inserted values wider than 1 register word, but LinearScanPass emits s_mov/v_mov with hardcoded size 1. A multi-word insert would only move the first word. Maybe enforce valueSize == 1?
harsh-nod
reviewed
Apr 1, 2026
| // so new non-emitting ops are covered automatically. | ||
| bool isNonEmittingOp(Operation *op) { | ||
| return isa<ExtractOp, PackOp, PrecoloredSRegOp, PrecoloredVRegOp, ConstantOp, | ||
| DCEProtectOp, YieldOp>(op); |
Collaborator
There was a problem hiding this comment.
why is precoloredAreg op made non emitting when it was not in this list? or was that a bug?
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.
Add NonEmittingOp trait to replace the hardcoded op list in HazardMitigation, and add InsertOp as the dual of ExtractOp for in-place sub-register replacement in wide registers.
NonEmittingOp trait is applied to PackOp, ExtractOp, InsertOp, PrecoloredSRegOp, PrecoloredVRegOp, ConstantOp, DCEProtectOp, and YieldOp. HazardMitigation now checks the trait instead of maintaining a manual isa<> list.
InsertOp replaces a single element in a wide register without extracting all words and rebuilding via PackOp. Liveness and regalloc handle chained inserts and shared-value copies. Used in handleFatRawBufferCast suppress-swizzle path for PackOp-built SRDs.