Skip to content

[AMDGPU] Detect VALU-after-MFMA hazard in post-RA scheduler's getHaza…#1614

Open
gandhi56 wants to merge 1 commit intoamd-stagingfrom
amd/dev/angandhi/triton-issue/gcnhazardrec
Open

[AMDGPU] Detect VALU-after-MFMA hazard in post-RA scheduler's getHaza…#1614
gandhi56 wants to merge 1 commit intoamd-stagingfrom
amd/dev/angandhi/triton-issue/gcnhazardrec

Conversation

@gandhi56
Copy link
Copy Markdown

@gandhi56 gandhi56 commented Mar 2, 2026

Add a check for the VALU-immediately-after-MFMA hazard in getHazardType so the
post-RA scheduler can avoid scheduling a non-MFMA VALU instruction immediately
after an MFMA with no intervening stall cycle.

Previously this hazard was only handled in PreEmitNoopsCommon (used by the
PostRAHazardRecognizer pass). The scheduler path did not consider it, so the
scheduler could place a VALU right after an MFMA and rely on later noop
insertion. By checking in getHazardType, the scheduler can prefer other
instructions or add stall cycles instead.

Introduce checkVALUImmediatelyAfterMFMAHazard to centralize the logic. It walks
EmittedInstrs in emission order and returns 1 if an MFMA was the last emitted
instruction with no stall cycle in between, otherwise 0.

@gandhi56 gandhi56 self-assigned this Mar 2, 2026
@z1-cciauto
Copy link
Copy Markdown
Collaborator

…rdType

Add a check for the VALU-immediately-after-MFMA hazard in getHazardType so the
post-RA scheduler can avoid scheduling a non-MFMA VALU instruction immediately
after an MFMA with no intervening stall cycle.

Previously this hazard was only handled in PreEmitNoopsCommon (used by the
PostRAHazardRecognizer pass). The scheduler path did not consider it, so the
scheduler could place a VALU right after an MFMA and rely on later noop
insertion. By checking in getHazardType, the scheduler can prefer other
instructions or add stall cycles instead.

Introduce checkVALUImmediatelyAfterMFMAHazard to centralize the logic. It walks
EmittedInstrs in emission order and returns 1 if an MFMA was the last emitted
instruction with no stall cycle in between, otherwise 0.
@gandhi56 gandhi56 force-pushed the amd/dev/angandhi/triton-issue/gcnhazardrec branch from 591875e to 2538e39 Compare March 5, 2026 13:52
@z1-cciauto
Copy link
Copy Markdown
Collaborator

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.

2 participants