Skip to content

rdna2spirv: track D16 XYZ writes per destination - #701

Open
akimfomin wants to merge 1 commit into
ProjectLeonida:mainfrom
akimfomin:portbridge/d16-xyz-continued
Open

akimfomin wants to merge 1 commit into
ProjectLeonida:mainfrom
akimfomin:portbridge/d16-xyz-continued

Conversation

@akimfomin

Copy link
Copy Markdown
Contributor

Claimed in the Continued coordination thread as the D16 XYZ destination classification follow-up to #265.

PortBridge linked the original Reforge and Continued work and reproduced ecox982745’s correction on Continued. The original contributor is credited below and in the commit. The complete four-file change is carried over, including the two synthetic regressions and design note.

What and why

Track the two destination words separately for full-EXEC three-component D16 buffer loads. X/Y overwrite the first word. Only part of the second word keeps its old value. The tests cover both MUBUF and MTBUF cases and preserve the masked-write controls.

Tested

  • Continued base 21625bca8c67 on Windows 11, Python 3.12.14 (CPU).
  • Base passed 135 focused and neighboring checks. This exact four-file change passed 137/137. Adding the two tests without the classifier change reproduced seven failing subchecks.
  • The receiving-side run checks the classifier on CPU. The original Reforge report has the separate hardware evidence.

PortBridge pilot record · Earlier Continued result

AI-assisted with Codex. Original change by ecox982745. PortBridge prepared the transfer and independent CPU check.

Apply the original fix by ecox982745 on the Continued base. The linked
tests preserve the distinction between the complete first destination and
the partially preserved second destination on full-EXEC loads.

Source-commit: ecox982745/Leonida@a300ba6
Co-authored-by: ecox982745 <196405083+ecox982745@users.noreply.github.com>

@abnalstlll-byte abnalstlll-byte 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.

Reviewed and verified
dna2spirv: track D16 XYZ writes per destination. Accurately distinguishing the destination words of 3-component packed D16 buffer loads under full EXEC—where word 0 (X/Y) is fully overwritten while word 1 (Z) retains prior high 16-bit contents—refines wave64 tier classification without losing conservative tracking on masked or tagged writes. Comprehensive unit tests in \ ests/test_wave64_halves.py\ validate all permutations. Approved.

@GeorgiyDemo

Copy link
Copy Markdown
Contributor

Checked 66dbbf3e on Apple M5 Pro, macOS 26.7.3 (25G342), Python 3.15.2, against main d42773d07:

  • tests/semantic/test_wave64_halves_partial_dst.py: 15 tests OK at this head.
  • The same test file plus tests/semantic/fixtures/ps_wave64_d16_xyz.asm copied onto main: 11 of 15 fail, so the new destination classification is exercised rather than only asserted.

No GPU leg from me: this changes tools/wave64_halves.py, whose fixture here is the semantic interpreter's, and the w64_graphics tier fixtures do not include a D16 XYZ case; I did not rebuild and rerun the full suite on this head. Synthetic fixtures only, no game data. AI-assisted.

@akimfomin

akimfomin commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

I compared the Linux CI result here with the run on its exact base 21625bca8. Both llvmpipe jobs report 166 passed, 2 failures and 80 skipped. The same two cases fail in both jobs (cs_imgload_d16_tfe and cs_imgload_tfe), with 64 mismatches each. The D16 case without TFE passes. Base job · PR job

I also merged the approved head 66dbbf3e into current main at 2d73c242 locally. It merged cleanly, kept the same four-file diff, and passed 267 test_wave64*.py checks in 13 files on Windows. The Linux failures above were already present on the PR base.

PortBridge connected this change with ecox982745’s Reforge fix and kept the source and prior independent runs together. Case and revisions

I also compared the macOS Runtime jobs for this same exact base and PR merge. All 248 test result lines match after removing timestamps and temporary path prefixes: 181 pass, 4 fail, and 63 skip. The four failing cases are the same in both jobs (cs_imgload_d16_tfe, cs_imgload_tfe, cs_fma_fused, and ps_ssharp). The first two TFE expectations are already tracked separately. Base macOS job · PR macOS job · TFE follow-up

@Sangonapou

Copy link
Copy Markdown
Contributor

Tested 66dbbf3 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass, on real hardware

Runtime built at this head with scripts\build_runtime.ps1 (MSVC 19.51); llvm-mc 23.1.6, SPIRV-Tools 2026.4. No game files.

  • CPU: tests/semantic/test_wave64_halves_partial_dst.py 15 OK.
  • w64_graphics.py (shaders from build.py at this head): tier A 9/9 and tier B 8/8 ok as two 32-lane halves; tier C 12/12 SKIP (needs a 64-and-32 device or W64G_REF).
  • GPU suite: 257 shaders, 257 translated, 257 pass spirv-val; native 197/248 passed, 49 skipped; LEONIDA_W64_EMULATE=1 229/248 passed, 17 skipped. The only failures are cs_imgload_tfe / cs_imgload_d16_tfe, which fail the same way on main on this card (tests: correct resident TFE status expectations (SHADER-1266) #892), so nothing new beside the llvmpipe CI comparison above.

@ecox982745

Copy link
Copy Markdown

I reran the 12 synthetic pixel-shader probes from our Reforge D16 review on this PR’s head 66dbbf3e and its parent 21625bca. Both runs used the same vk_harness, built from 66dbbf3e, on an RTX 4090 (Windows 11, NVIDIA 616.64, LLVM 23.1.6, SPIRV-Tools 2026.4).

Check Parent PR head
Default-mode shaders translated and passing SPIR-V validation 12/12 12/12
Shaders accepted by --wave64-graphics error 2/12 8/12

The six newly accepted shaders were the three constant-output cases for each of the typed and untyped D16 XYZ buffer loads. Both lane-dependent loads and both asymmetric row-mask controls were still rejected in strict mode. All eight strict-mode binaries on the PR matched their default-mode counterparts byte for byte.

On hardware, all 12 default-mode outputs matched the expected value sets. The per-case pixel histograms were identical between revisions (4,096 pixels per case, 49,152 per revision). The RTX 4090 exercised 32-lane fragment subgroups; native 64-lane fragment subgroups were unavailable. The PR’s focused CPU regression also passed 15/15.

AI-assisted hardware verification using OpenAI Codex and hand-written synthetic inputs. Original D16 correction

@ecox982745

Copy link
Copy Markdown

I checked the merge conflict GitHub now reports for #701. At main c7e82e26 and PR head 66dbbf3e, only docs/design.md conflicts. Git merges the classifier and both test files automatically.

I tested this resolution locally: take docs/design.md from c7e82e26 and insert the PR's one row headed Wave64 graphics: three-component D16 buffer loads immediately above Out-of-bounds typed buffer loads and DST_SEL=1. This preserves the newer bounds documentation in full. The resulting diff against main touches the original four PR files and adds exactly one documentation row.

  • CPU: all 195 tests in the five test_wave64_halves*.py files passed. The five design-contract checks and 16 docs-link tests also passed.
  • RTX 4090: I rebuilt vk_harness from the resolved tree and ran the 12 synthetic probes on Windows, NVIDIA 616.64. All 12 translated and passed SPIR-V validation in default mode. Strict mode accepted the same eight as the original head, and all twelve 4,096-pixel histograms matched that head exactly.

This was a local merge check. The open PR still needs its branch updated. AI-assisted verification.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants