Skip to content

[rocjitsu] Fix gfx1250 fpsan numerical failures - #7336

Merged
kuhar merged 3 commits into
developfrom
users/kuhar/gfx1250-fpsan-fixes
Jun 18, 2026
Merged

kuhar merged 3 commits into
developfrom
users/kuhar/gfx1250-fpsan-fixes

Conversation

@kuhar

@kuhar kuhar commented Jun 16, 2026 •

Copy link
Copy Markdown
Member

Motivation

Fix gfx1250-specific true16, conversion, atomic, wave, and WMMA/SWMMAC emulation issues found by the hip-fpsan suite.

Technical Details

  • Implemented gfx1250 true16 handling for selected VOP3/VOP2 paths, including correct op_sel source/destination half selection and packed 16-bit VGPR read/write preservation.
  • Fixed FP8/FP6/FP4 narrowing edge cases, especially deepest-subnormal RNE rounding and E5M3 overflow/stochastic-rounding behavior.
  • Added missing gfx1250 execution coverage for DPP8 lane permutation, BF16 WMMA K=32 arithmetic/writeback, WMMA accumulator modifiers, true16 destination-half preservation, and atomic width behavior.
  • Corrected gfx1250-specific E5M3 decode/encode selection so shared RDNA/CDNA generated paths do not reinterpret modifiers incorrectly.
  • Tightened generated mask and GPR-index handling for true16/vector-compare paths, with tests covering wave32 mask writes and indexed packed true16 sources.
  • Clarified the remaining hand-written true16 special lowering path with comments explaining why generic sema lowering cannot yet express those forms.

JIRA ID

N/A

Test Plan

Unit test + iree e2e tests.

Rerun the generator across all isa targets.

Test Result

All good.

Submission Checklist

@kuhar
kuhar force-pushed the users/kuhar/gfx1250-fpsan-fixes branch 2 times, most recently from c8cb76c to ae42f21 Compare June 16, 2026 23:56
@kuhar
kuhar marked this pull request as ready for review June 17, 2026 00:00
@kuhar
kuhar requested review from a team and atgutier as code owners June 17, 2026 00:00
Copilot AI review requested due to automatic review settings June 17, 2026 00:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@kuhar
kuhar force-pushed the users/kuhar/gfx1250-fpsan-fixes branch from ae42f21 to 2d97875 Compare June 17, 2026 00:02
Fix gfx1250-specific true16, conversion, atomic, wave, and WMMA/SWMMAC emulation issues found by the hip-fpsan suite.

Add focused generator and execution regression coverage for the corrected paths. The latest local RocJITsu hip-fpsan matrix has 504 passed, 0 Failed, 17 SIGABRT, 1 SIGSEGV, and 2 skipped entries.
@kuhar
kuhar force-pushed the users/kuhar/gfx1250-fpsan-fixes branch from 2d97875 to b652e77 Compare June 17, 2026 00:53

@atgutier atgutier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some agent comments

@kuhar
kuhar requested a review from lialan June 18, 2026 00:56
@kuhar
kuhar merged commit 3a4e98a into develop Jun 18, 2026
13 checks passed
@kuhar
kuhar deleted the users/kuhar/gfx1250-fpsan-fixes branch June 18, 2026 17:09
kuhar added a commit that referenced this pull request Oct 27, 2026
The CDNA5 descriptor tests in triton-lang/triton#12512 pass on
hardware but fail under Rocjitsu. Crossing raw B128 accesses load and
store one extra DWORD near NUM_RECORDS.

- CDNA5 buffer bounds (PR #10362, f81f9d4): retain complete
accesses, including exact fits, and apply the PR's stated end + 4 <=
NUM_RECORDS rule to crossing raw vector accesses. Keep SOFFSET in the
check and preserve structured and independent stride bounds.

- GFX12 atomic returns (PR #7336, 3a4e98a): test TH[0]
independently of the non-temporal and cascade bits. Returning modes 3,
5 and 7 otherwise omit the old value and select non-returning metadata
and wait counters.

- Signed scratch operands (CDNA5 PR #6673, f6aec50; RDNA4 PR
#5053, ca4b97e): sign-extend scalar and vector offsets before
combining them and before CDNA5 payload scaling. Compensated negative
operands otherwise become large positive private offsets and fault.

- CDNA GLOBAL operands (PR #5512, 5a107ce): zero-extend the
32-bit VGPR offset when a scalar base is present. High-bit offsets
otherwise resolve four GiB below the intended address. Preserve
absolute VGPR pairs and CDNA5 signed addressing. CDNA1-4 manuals and
LLVM agree on the unsigned rule.

For buffer bounds, the Triton PR measures aligned B128 crossings with
four or eight bytes remaining. Other widths and byte-granular bounds
follow its stated rule as a model choice pending gfx1250
qualification. Record that limit beside the implementation and
regression expectations.

Cover bounds, inactive lanes, signed and unsigned operand
combinations, atomic writeback and wait counters, including image
metadata. Validate 49 Gluon cases with matching ISA and 172 hardware
comparisons each on gfx1201 and gfx1100. Audit gfx942/gfx950 buffer,
scratch and atomic contracts against the manuals. The standard CTest
sweep retains the same 31 baseline failures.
kuhar added a commit that referenced this pull request Oct 27, 2026
The CDNA5 descriptor tests in triton-lang/triton#12512 pass on
hardware but fail under Rocjitsu. Crossing raw B128 accesses load and
store one extra DWORD near NUM_RECORDS.

- CDNA5 buffer bounds (PR #10362, f81f9d4): retain complete
accesses, including exact fits, and apply the PR's stated end + 4 <=
NUM_RECORDS rule to crossing raw vector accesses. Keep SOFFSET in the
check and preserve structured and independent stride bounds.

- GFX12 atomic returns (PR #7336, 3a4e98a): test TH[0]
independently of the non-temporal and cascade bits. Returning modes 3,
5 and 7 otherwise omit the old value and select non-returning metadata
and wait counters.

- Signed scratch operands (CDNA5 PR #6673, f6aec50; RDNA4 PR
#5053, ca4b97e): sign-extend scalar and vector offsets before
combining them and before CDNA5 payload scaling. Compensated negative
operands otherwise become large positive private offsets and fault.

- CDNA GLOBAL operands (PR #5512, 5a107ce): zero-extend the
32-bit VGPR offset when a scalar base is present. High-bit offsets
otherwise resolve four GiB below the intended address. Preserve
absolute VGPR pairs and CDNA5 signed addressing. CDNA1-4 manuals and
LLVM agree on the unsigned rule.

For buffer bounds, the Triton PR measures aligned B128 crossings with
four or eight bytes remaining. Other widths and byte-granular bounds
follow its stated rule as a model choice pending gfx1250
qualification. Record that limit beside the implementation and
regression expectations.

Cover bounds, inactive lanes, signed and unsigned operand
combinations, atomic writeback and wait counters, including image
metadata. Validate 49 Gluon cases with matching ISA and 172 hardware
comparisons each on gfx1201 and gfx1100. Audit gfx942/gfx950 buffer,
scratch and atomic contracts against the manuals. The standard CTest
sweep retains the same 31 baseline failures.
kuhar added a commit that referenced this pull request Oct 27, 2026
The CDNA5 descriptor tests in triton-lang/triton#12512 pass on
hardware but fail under Rocjitsu. Crossing raw B128 accesses load and
store one extra DWORD near NUM_RECORDS.

- CDNA5 buffer bounds (PR #10362, f81f9d4): retain complete
accesses, including exact fits, and apply the PR's stated end + 4 <=
NUM_RECORDS rule to crossing raw vector accesses. Keep SOFFSET in the
check and preserve structured and independent stride bounds.

- GFX12 atomic returns (PR #7336, 3a4e98a): test TH[0]
independently of the non-temporal and cascade bits. Returning modes 3,
5 and 7 otherwise omit the old value and select non-returning metadata
and wait counters.

- Signed scratch operands (CDNA5 PR #6673, f6aec50; RDNA4 PR
#5053, ca4b97e): sign-extend scalar and vector offsets before
combining them and before CDNA5 payload scaling. Compensated negative
operands otherwise become large positive private offsets and fault.

- CDNA GLOBAL operands (PR #5512, 5a107ce): zero-extend the
32-bit VGPR offset when a scalar base is present. High-bit offsets
otherwise resolve four GiB below the intended address. Preserve
absolute VGPR pairs and CDNA5 signed addressing. CDNA1-4 manuals and
LLVM agree on the unsigned rule.

- PC exports and targets (import handling #9844, e5109e3): apply
the architecture's extension rule to
GETPC, CALL and SWAPPC return addresses. RDNA4 zero-extends 48 bits;
older targets sign-extend 48 bits and CDNA5 sign-extends 57 bits.
Keep imported PCs as raw 48/57-bit addresses for instruction fetch,
consistent with RFE, and preserve all CDNA5 target bits. Limit the
positive linked-rel32 tag to 48-bit targets. Remove the negative
tag on every target: it aliases ordinary sign-filled PC exports.
Both forms otherwise corrupt valid 57-bit targets or older high-PC
round trips when a load bias is present.

For buffer bounds, the Triton PR measures aligned B128 crossings with
four or eight bytes remaining. Other widths and byte-granular bounds
follow its stated rule as a model choice pending gfx1250
qualification. Record that limit beside the implementation and
regression expectations.

Cover bounds, inactive lanes, signed and unsigned operand
combinations, atomic writeback and wait counters, including image
metadata. Validate 49 Gluon cases with matching ISA and 172 hardware
comparisons each on gfx1201 and gfx1100. Audit gfx942/gfx950 buffer,
scratch and atomic contracts against the manuals. The standard CTest
sweep retains the same 31 baseline failures.

Decode and execute PC regression cases on gfx1100, gfx1201, gfx950 and
gfx1250, including high address bits, next-PC boundaries and operand
aliasing. Follow SETPC/SWAPPC through real page tables to fetch a high
mapped destination, including both relocation-tag collisions with a
nonzero load bias. Older linked-rel32 debugger coverage is retained.
These are manual/LLVM-backed simulation checks without physical
high-address PC qualification. RDNA3/3.5 sign-filled exports follow
LLVM against conflicting manual tables; record that choice beside
the generator and test oracle. Add explicit test braces for GCC.
kuhar added a commit that referenced this pull request Oct 27, 2026
The CDNA5 descriptor tests in triton-lang/triton#12512 pass on
hardware but fail under Rocjitsu. Crossing raw B128 accesses load and
store one extra DWORD near NUM_RECORDS.

- CDNA5 buffer bounds (PR #10362, f81f9d4): retain complete
accesses, including exact fits, and apply the PR's stated end + 4 <=
NUM_RECORDS rule to crossing raw vector accesses. Keep SOFFSET in the
check and preserve structured and independent stride bounds.

- GFX12 atomic returns (PR #7336, 3a4e98a): test TH[0]
independently of the non-temporal and cascade bits. Returning modes 3,
5 and 7 otherwise omit the old value and select non-returning metadata
and wait counters.

- Signed scratch operands (CDNA5 PR #6673, f6aec50; RDNA4 PR
#5053, ca4b97e): sign-extend scalar and vector offsets before
combining them and before CDNA5 payload scaling. Compensated negative
operands otherwise become large positive private offsets and fault.

- CDNA GLOBAL operands (PR #5512, 5a107ce): zero-extend the
32-bit VGPR offset when a scalar base is present. High-bit offsets
otherwise resolve four GiB below the intended address. Preserve
absolute VGPR pairs and CDNA5 signed addressing. CDNA1-4 manuals and
LLVM agree on the unsigned rule.

- PC exports and targets (import handling #9844, e5109e3): apply
the architecture's extension rule to
GETPC, CALL and SWAPPC return addresses. RDNA4 zero-extends 48 bits;
older targets sign-extend 48 bits and CDNA5 sign-extends 57 bits.
Keep imported PCs as raw 48/57-bit addresses for instruction fetch,
consistent with RFE, and preserve all CDNA5 target bits. Limit the
positive linked-rel32 tag to 48-bit targets. Remove the negative
tag on every target: it aliases ordinary sign-filled PC exports.
Both forms otherwise corrupt valid 57-bit targets or older high-PC
round trips when a load bias is present.

For buffer bounds, the Triton PR measures aligned B128 crossings with
four or eight bytes remaining. Other widths and byte-granular bounds
follow its stated rule as a model choice pending gfx1250
qualification. Record that limit beside the implementation and
regression expectations.

Cover bounds, inactive lanes, signed and unsigned operand
combinations, atomic writeback and wait counters, including image
metadata. Validate 49 Gluon cases with matching ISA and 172 hardware
comparisons each on gfx1201 and gfx1100. Audit gfx942/gfx950 buffer,
scratch and atomic contracts against the manuals. The standard CTest
sweep retains the same 31 baseline failures.

Decode and execute PC regression cases on gfx1100, gfx1201, gfx950 and
gfx1250, including high address bits, next-PC boundaries and operand
aliasing. Follow SETPC/SWAPPC through real page tables to fetch a high
mapped destination, including both relocation-tag collisions with a
nonzero load bias. Older linked-rel32 debugger coverage is retained.
These are manual/LLVM-backed simulation checks without physical
high-address PC qualification. RDNA3/3.5 sign-filled exports follow
LLVM against conflicting manual tables; record that choice beside
the generator and test oracle. Add explicit test braces for GCC.
kuhar added a commit that referenced this pull request Oct 27, 2026
…14352)

The CDNA5 descriptor tests in
[triton-lang/triton#12512](triton-lang/triton#12512)
pass on hardware but fail under Rocjitsu. Crossing raw B128 accesses
load and store one extra DWORD near `NUM_RECORDS`. Auditing neighboring
instructions and extension rules across gfx942/gfx950, gfx1100/gfx1201
and gfx1250 exposed further address and return defects.

- **CDNA5 buffer bounds** (introduced by #10362, `f81f9d40db67`): keep
complete accesses, including exact fits, and apply the Triton PR's
stated `end + 4 <= NUM_RECORDS` rule to crossing raw vector accesses.
Count `SOFFSET` and preserve structured and independent stride checks.
- **GFX12 atomic returns** (introduced by #7336, `3a4e98a167e6`): test
`TH[0]` independently of the non-temporal and cascade bits. Return modes
3, 5 and 7 otherwise omit the old value and select non-returning
metadata and wait counters.
- **GFX12 scratch operands** (CDNA5 #6673, `f6aec5064565`; RDNA4 #5053,
`ca4b97ef2cc6`): sign-extend scalar/vector inputs before combining them
and before CDNA5 payload scaling. Compensated negative inputs otherwise
become large positive private offsets and fault.
- **CDNA1–4 GLOBAL operands** (introduced by #5512, `5a107cebd601`):
zero-extend the 32-bit VGPR offset when a scalar base is present.
High-bit offsets otherwise address four GiB below the intended location.
Preserve absolute VGPR pairs and the separate CDNA5 signed rule.


- **PC extension and width**: GETPC, CALL and SWAPPC now export signed
48-bit PCs on older targets, zero-filled 48-bit PCs on RDNA4, and signed
57-bit PCs on CDNA5. SETPC/SWAPPC use raw masked 48/57-bit internal
addresses so high targets remain fetchable through page tables. CDNA5
keeps all 57 target bits and bypasses linked-rel32 tags. The ambiguous
negative tag is removed on every target so sign-filled PC exports
round-trip with a load bias; 48-bit targets retain the positive tag
covered by gfx950 debugger integration. Previously high PCs exposed the
wrong upper bits or lost valid target bits. The generator and its 40
emitted PC handlers agree. RDNA3/3.5 sign-filled exports follow LLVM
against conflicting manual tables; high-address PC behavior has no
physical qualification.

The gfx1250 buffer evidence covers aligned B128 crossings with
four/eight bytes remaining. Other widths and byte-granular bounds follow
the Triton PR's stated rule as model choices pending gfx1250 hardware
qualification; the source and tests say so explicitly. The gfx942/gfx950
manual audit preserves the existing legacy scratch policy where no legal
allocated-input mismatch was demonstrated.

Local validation:

- 49 Gluon cases pass through matching descriptor/instruction ISA. The
installed Triton predates the new descriptor frontend API, so this is an
ISA-equivalent replay, not a rebuild of that API.
- 172 saved physical gfx1201 comparisons and 172 physical gfx1100
comparisons match simulation: buffer bounds, atomic return controls,
legal scratch operands and GLOBAL offsets. The buffer-clamp rule remains
CDNA5-specific.
- gfx942 and gfx950 buffer/atomic/scratch/GLOBAL contracts were checked
against their manuals and LLVM. All eight compiled HIP GLOBAL load/store
simulation cases pass; no physical gfx942/gfx950 qualification is
claimed.
- 28 PC test groups cover gfx1100/gfx1201/gfx950/gfx1250, including
next-PC boundaries, target width and SWAPPC operand aliasing. The
original handlers fail 11 of the initial 16 groups. Page-table-backed
fetch and nonzero-load-bias tests also reproduce the additional
import/relocation gaps; all 28 final PC groups pass, including
GETPC-to-SETPC/SWAPPC round trips with a nonzero load bias. Encodings
were independently verified with LLVM. Four groups execute the
destination through real page tables, including both 57-bit
relocation-tag collisions. These are source-backed simulation checks
without physical high-address PC qualification.
- After rebasing onto current `develop`, the project builds and all
2,851 generator checks pass, with 46 skipped. Earlier GCC syntax checks
cover the atomic and PC test translation units with
`-Werror=dangling-else`; explicit braces fix the reported CI build
error. Changed-file formatting hooks pass.
- Rebase validation passes all 313 focused CTests, including PC,
address, atomic and newly landed fork/join coverage. Standard CTest
retains exactly the same 31 baseline failure names and classifications:
31/9181 after rebasing versus 31/9010 before rebasing. No new failure
names.
ywang103-amd pushed a commit that referenced this pull request Oct 28, 2026
…14352)

The CDNA5 descriptor tests in
[triton-lang/triton#12512](triton-lang/triton#12512)
pass on hardware but fail under Rocjitsu. Crossing raw B128 accesses
load and store one extra DWORD near `NUM_RECORDS`. Auditing neighboring
instructions and extension rules across gfx942/gfx950, gfx1100/gfx1201
and gfx1250 exposed further address and return defects.

- **CDNA5 buffer bounds** (introduced by #10362, `f81f9d40db67`): keep
complete accesses, including exact fits, and apply the Triton PR's
stated `end + 4 <= NUM_RECORDS` rule to crossing raw vector accesses.
Count `SOFFSET` and preserve structured and independent stride checks.
- **GFX12 atomic returns** (introduced by #7336, `3a4e98a167e6`): test
`TH[0]` independently of the non-temporal and cascade bits. Return modes
3, 5 and 7 otherwise omit the old value and select non-returning
metadata and wait counters.
- **GFX12 scratch operands** (CDNA5 #6673, `f6aec5064565`; RDNA4 #5053,
`ca4b97ef2cc6`): sign-extend scalar/vector inputs before combining them
and before CDNA5 payload scaling. Compensated negative inputs otherwise
become large positive private offsets and fault.
- **CDNA1–4 GLOBAL operands** (introduced by #5512, `5a107cebd601`):
zero-extend the 32-bit VGPR offset when a scalar base is present.
High-bit offsets otherwise address four GiB below the intended location.
Preserve absolute VGPR pairs and the separate CDNA5 signed rule.


- **PC extension and width**: GETPC, CALL and SWAPPC now export signed
48-bit PCs on older targets, zero-filled 48-bit PCs on RDNA4, and signed
57-bit PCs on CDNA5. SETPC/SWAPPC use raw masked 48/57-bit internal
addresses so high targets remain fetchable through page tables. CDNA5
keeps all 57 target bits and bypasses linked-rel32 tags. The ambiguous
negative tag is removed on every target so sign-filled PC exports
round-trip with a load bias; 48-bit targets retain the positive tag
covered by gfx950 debugger integration. Previously high PCs exposed the
wrong upper bits or lost valid target bits. The generator and its 40
emitted PC handlers agree. RDNA3/3.5 sign-filled exports follow LLVM
against conflicting manual tables; high-address PC behavior has no
physical qualification.

The gfx1250 buffer evidence covers aligned B128 crossings with
four/eight bytes remaining. Other widths and byte-granular bounds follow
the Triton PR's stated rule as model choices pending gfx1250 hardware
qualification; the source and tests say so explicitly. The gfx942/gfx950
manual audit preserves the existing legacy scratch policy where no legal
allocated-input mismatch was demonstrated.

Local validation:

- 49 Gluon cases pass through matching descriptor/instruction ISA. The
installed Triton predates the new descriptor frontend API, so this is an
ISA-equivalent replay, not a rebuild of that API.
- 172 saved physical gfx1201 comparisons and 172 physical gfx1100
comparisons match simulation: buffer bounds, atomic return controls,
legal scratch operands and GLOBAL offsets. The buffer-clamp rule remains
CDNA5-specific.
- gfx942 and gfx950 buffer/atomic/scratch/GLOBAL contracts were checked
against their manuals and LLVM. All eight compiled HIP GLOBAL load/store
simulation cases pass; no physical gfx942/gfx950 qualification is
claimed.
- 28 PC test groups cover gfx1100/gfx1201/gfx950/gfx1250, including
next-PC boundaries, target width and SWAPPC operand aliasing. The
original handlers fail 11 of the initial 16 groups. Page-table-backed
fetch and nonzero-load-bias tests also reproduce the additional
import/relocation gaps; all 28 final PC groups pass, including
GETPC-to-SETPC/SWAPPC round trips with a nonzero load bias. Encodings
were independently verified with LLVM. Four groups execute the
destination through real page tables, including both 57-bit
relocation-tag collisions. These are source-backed simulation checks
without physical high-address PC qualification.
- After rebasing onto current `develop`, the project builds and all
2,851 generator checks pass, with 46 skipped. Earlier GCC syntax checks
cover the atomic and PC test translation units with
`-Werror=dangling-else`; explicit braces fix the reported CI build
error. Changed-file formatting hooks pass.
- Rebase validation passes all 313 focused CTests, including PC,
address, atomic and newly landed fork/join coverage. Standard CTest
retains exactly the same 31 baseline failure names and classifications:
31/9181 after rebasing versus 31/9010 before rebasing. No new failure
names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants