Skip to content

fix(kyty): align scalar load operands independently - #364

Open
mjnhbg3 wants to merge 2 commits into
simnJS:AnyKytyfrom
mjnhbg3:fix/kyty-scalar-load-offset-bounds
Open

mjnhbg3 wants to merge 2 commits into
simnJS:AnyKytyfrom
mjnhbg3:fix/kyty-scalar-load-offset-bounds

Conversation

@mjnhbg3

@mjnhbg3 mjnhbg3 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What

Fixes the scalar-load offset point of #216. s_buffer_load_* and s_load_* align the register soffset and encoded immediate independently to a dword before adding them. The previous final-address alignment could advance to the next dword when the discarded low bits carried. The same rule now reaches direct and indirect SPIR-V reads, the SRT walker, descriptor and table materialization, and ray-query resource evaluation.

Raw-word replay checks the carry and bound with distinct source dwords. A synthetic two-row record-table fixture checks descriptor planning, materialization, and valid SPIR-V. The rule follows #216 and Mesa ACO; the differing RDNA2 ISA pseudocode and the need for a PS5 hardware oracle are recorded in the debt fragment and #217. This addresses one point of #216, so the issue remains open.

The review follow-up makes wave-result classification prove the low three bits of the completed register expression before aligning it. Unknown expressions remain unclassified. A focused IR regression covers carry within that register expression, aligned and masked dynamic offsets, and a select whose branches differ.

Tested

  • Windows 11 Pro build 26200; NVIDIA GeForce RTX 5070 Ti, driver 616.64; Vulkan validation layer 1.4.350 (newer than the repository's Vulkan-Headers 1.4.335).
  • Identical final fixtures on exact AnyKyty base 0dea7e8b96 and this commit: ctest --test-dir H:\AnyPS5-ScalarLoad216-base-build -R '^kyty_shim_uniform_scalar_(loads|replay)$' -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, and VK_LOADER_DEBUG=layer. The base failed both tests (two offset replay cases and nine unit assertions); this change passed both tests, including all eight replay cases and the record-table fixture.
  • All 16 complete replay child logs on each side show Insert instance layer "VK_LAYER_KHRONOS_validation", unfinished=0, no missing-layer message, and zero VUID- errors. The initial differential builds produced the same 107 PGO profile-hash warnings in changed shader sources on each side and no other warning category.
  • Review follow-up 8a26fbfd3a: focused build succeeded and ctest --test-dir H:\AnyPS5-ScalarLoad216-base-build -R '^(kyty_shim_rt_oracle|kyty_shim_uniform_scalar_(loads|replay))$' -V passed 3/3 with the same Vulkan environment. All 16 replay child logs again show layer insertion, unfinished=0, no missing-layer message, and zero VUID- errors. The revised ray-query source emitted only the existing PGO profile-hash warning class.
  • Genuine warning fixture suites: 23/23 passed locally (7 PGO, 2 debt length, 5 debt labels, 9 relinker). The exact-base CI run at 0dea7e8b96 currently passes Linux, Windows, ASan, TSan, and conventions.
  • python3 tools/check_conventions.py --base upstream/AnyKyty, python3 tools/check_kyty_settings.py, python3 tools/debt_fold.py --check, and python3 tools/pr_overlap.py --repo simnJS/AnyPS5 --base AnyKyty --branch fix/kyty-scalar-load-offset-bounds passed on the final head. The overlap check found no overlap with an open PR. No title, homebrew, or external ray-query corpus run and no AMD or PS5 hardware oracle measurement were available.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 616.64, Windows 11 Pro build 26200
  • AI-assisted: yes

@mjnhbg3
mjnhbg3 deployed to repository-maintenance November 27, 2026 12:18 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

The scalar WaveResultKind matcher masks the immediate inside IAdd32 separately from the other addend. The load masks the completed register operand, so this rewrite is only valid if the other addend is known to be dword-aligned. With addends of 3 and 1 and an encoded offset of 0, the load selects byte 4, but the matcher can classify it as byte 0. Require an alignment proof before folding the add, or leave the result unclassified. Please add a regression for carry within the register operand, distinct from carry between the register operand and the encoded offset.

@mjnhbg3
mjnhbg3 deployed to repository-maintenance November 27, 2026 12:33 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
repository-maintenance — 8a26fbfd Deployed Nov 27, 2026 by mjnhbg3 via review #268
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.

1 participant