Skip to content

Upstream PR batch 1 U6: shader semantics correctness (ALU, LDS, export) - #481

Merged
RINNECODER merged 26 commits into
mainfrom
upr1/shader-semantics
Oct 14, 2026
Merged

RINNECODER merged 26 commits into
mainfrom
upr1/shader-semantics

Conversation

@RINNECODER

@RINNECODER RINNECODER commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Upstream PR batch 1, U6: shader semantics correctness (ALU, LDS, export)

Ports 14 of the 16 triaged upstream correctness fixes, one commit per upstream PR ("Ported from upstream PR #N"). Frontend and SPIR-V changes feed our Metal bridge; no Vulkan paths are touched.

Ported

Upstream Change
boykopovar#5081 NGG group info in SGPR2 for vertex-path shaders
boykopovar#5214 compute wave index in TG_SIZE[11:6]
boykopovar#5110 32_AR export takes alpha from channel 1
boykopovar#5117 s_barrier orders buffer, workgroup and image memory (acquire-release)
boykopovar#5426 GFX10 scratch offsets decode as one dword
boykopovar#4996 MIMG sampler tuples ending in VCC decode
boykopovar#5450 diagnostic names the attribute of an out-of-range interpolation reference
boykopovar#5471 high-half result (op_sel[3]) of v_interp_p2_f16 decodes
boykopovar#5162 VALU carry-out and v_div_scale masks clear inactive lanes
boykopovar#5159 v_cvt_f32_f64 applies the f32 output modifier and denormal flush
boykopovar#5160 per-invocation LDS updates without atomics (Function storage)
boykopovar#5492 ds_add_f32 flushes denormals and NaNs
boykopovar#5498 DS src2 lanes run one at a time in lane order (new IR opcodes)
boykopovar#907 color compare emulation: NOT_EQUAL unordered, TRUNC_COORD point sampling refused, array layer rounds half to even

Notes on how they landed:

Skipped

Tests (all run on Metal, ctest, GPU for the first group)

Game smoke (one run per side, 280 s wall, eboot lock, on AC power)

Branch vs main, same title image: both reach guest entry, no fault, no uncaught exception, 0 skipped draws or dispatches, no conversion failures, identical open sequence for the first 2600 log lines (intro movies), same single unimplemented import. The branch run was cold-cache (format 35: 60 shaders converted, 0 failures); the main run used the warm cache. The branch run progressed further into asset loading within the wall time; run-to-run timing varies on the shared machine. Screens were not compared pixel by pixel, and neither run was confirmed to reach a 3D map in 280 s.

Performance

Not measured.

Pre-existing issues seen (not touched)

🤖 Generated with Claude Code

Docs: the nine upstream docs hunks (5110, 5117, 5426, 5159, 5162, 5160, 5492, 5498, 907) are ported into docs/dev/TechnicalDebt.md (this tree has no docs/dev/debt/shader.md); the stale DS src2, LDS float atomics, f32 denormal, output modifier and color compare entries are updated, and the ShaderDiskCache history now has a 35 line.

RINNECODER and others added 24 commits October 13, 2026 20:32
Ported from upstream PR boykopovar#5081

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ported from upstream PR boykopovar#5214

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ported from upstream PR boykopovar#5110

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ported from upstream PR boykopovar#5117

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ported from upstream PR boykopovar#5426

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ported from upstream PR boykopovar#4996

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…reference

Ported from upstream PR boykopovar#5450

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ported from upstream PR boykopovar#5471. The Vop3InterpDecode unit-test hunk is not ported (that test file is not on main); the execution test InterpolationF16 carries the coverage.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…_div_scale masks

Ported from upstream PR boykopovar#5162

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…t_f32_f64

Ported from upstream PR boykopovar#5159

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ported from upstream PR boykopovar#5160. Conflicts resolved against main: kept main's barrier condition for non-LDS shared atomics; the unit-test hunk for SRT read patching (a different upstream change, not on main) is dropped.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ported from upstream PR boykopovar#5492

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ported from upstream PR boykopovar#5498

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ing and round the array layer half to even in color compare emulation

Ported from upstream PR boykopovar#907 (follow-up to its predecessor). Hand-applied to main's reworked emitter: NOT_EQUAL uses OpFUnordNotEqual, the array layer is clamp(roundEven(z)), and ResourceMaterializer rejects TRUNC_COORD with point filtering. The upstream execution-test rewrite is not ported (it targets a diverged test file).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The ported DS fixes add MemoryInfo::flushDenormalResults (now encoded in the plan) and new IR opcodes, so cached payloads from format 34 must not load.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…device shim

The upstream execution tests for the ported fixes compile unchanged against a Metal stand-in for the Vulkan test device (guest buffer descriptors are mirrored into shared MTLBuffers). Covers boykopovar#5162 (VALU carry-out masks), boykopovar#5159 (v_cvt_f32_f64 result modes), boykopovar#5492 (ds_add_f32) and boykopovar#5498 (DS src2 lane order). The LdsSrc2 and LdsSrc2Wide tests use device-memory LDS, which the Metal bridge rejects, and are not registered.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…l build

Registers the upstream tests for boykopovar#4996, boykopovar#5426 and boykopovar#5450 (already on main's tree but not built for Metal) and a high-half decode check for boykopovar#5471.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… Metal recompiler

Standalone copy of the boykopovar#5160 verifyFunctionLdsUpdates check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Buffer-store variant of the boykopovar#5214 execution test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Registers boykopovar#5117's upstream test through the device shim.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Guest-replay draw for boykopovar#5110: alpha comes from export channel 1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Guest-replay draw for boykopovar#5081.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…emulation

Recompile-level check for boykopovar#907.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@RINNECODER RINNECODER added the upstream-sync Upstream boykopovar/AnyPS5 intake label Oct 14, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T01:37:25.850885Z c131503 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a41b8e05-ed21-4307-ad87-aef388af145a
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c13150315d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

state.module.AddFunction(spv::OpBranch, pendingMerge);
EmitLabel(state, pendingMerge);
state.module.AddFunction(spv::OpPhi, boolean, doneNext, served, electedMerge, done, loopBody);
state.module.AddFunction(spv::OpMemoryBarrier, ConstantU32(state, spv::ScopeWorkgroup), ConstantU32(state, spv::MemorySemanticsAcquireReleaseMask | LdsMemorySemantics(state)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip lane serialization for function-backed LDS src2

When a vertex or fragment shader uses a DS src2 opcode, LDS is backed by per-invocation Function storage, so different lanes cannot alias each other's data. Nevertheless, both new EmitSharedSrc2U32 and EmitSharedSrc2U64 unconditionally enter this loop, electing every active lane and issuing a workgroup-scoped barrier after each update. This turns each otherwise independent src2 operation into 32/64 sequential iterations and reintroduces the workgroup barrier that the function-LDS path avoids elsewhere; bypass the lane-ordered helper and update directly when InFunctionStorage(state, mem.kind) is true.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot added the build label Oct 14, 2026
@RINNECODER
RINNECODER merged commit 2b4606b into main Oct 14, 2026
5 checks passed
@RINNECODER
RINNECODER deleted the upr1/shader-semantics branch October 14, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc build shader upstream-sync Upstream boykopovar/AnyPS5 intake

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant