Repository navigation
Conversation
The 195 "an address in an SGPR that is no root parameter" failures are the GS half of one merged ES+GS stage (fxceless#138). Step 1 of its support, without emitting anything: - StageIo::Gs and io::raise for a geometry program. User data 0 and 1 of the merged stage (s8, s9) are the console runtime's table pointer when the root layout puts nothing there; resource tracking traces a load through it to resource::RUNTIME_TABLE instead of failing. Other stages and other unbound SGPRs fail as before. - merged::pair_es_gs pairs the ES program (vertex container) with the GS program (geometry container): same wave size, one meaning per user-data dword, merged root layout. emit::translate_merged_gs runs the pair as far as emission. - emit refuses a geometry program with GS_EMIT ("GS emit"). `translate` counts those on their own "geometry" line, not among the failures. Not done: DXIL geometry emission, the ES to GS handoff through LDS, the output records, GS_EMIT/GS_CUT, the host pipeline. The runtime table's contents and the GS stage data are not read. Refs fxceless#138 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fxceless#138) pair_es_gs keeps both halves' ranges of one descriptor table pointer instead of calling them a user-data conflict. The runtime table pointer is only inferred through resource::track_merged, i.e. for the merged layout of a pair (translate_merged_gs) or, in victory translate, as a stated assumption for an unpaired geometry program: a geometry program traced alone no longer takes user data 0 and 1 as free. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…s#311) StageIo::Es and StageIo::Gs now carry MergedIo (LDS bytes from the common record). merged::limits counts the vertices a GS program emits along its longest path from its s_sendmsg GS_EMIT / GS_CUT / GS_EMIT_CUT messages, refusing a message in a loop. The runtime table pointer is also resolved for the ES half, which shares the SGPRs. victory translate counts the GS programs with a bounded vertex count. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
) handoff finds the record the ES half writes to LDS (whole-dword writes at one base, then s_barrier and the s_setpc_b64 handover) and the GS half's reads of its input vertices (the halves of the offsets in v0 and v1). The GS half may only read dwords the ES half writes. emit::merged_halves pairs two containers, traces and raises the ES half and checks the handoff; victory translate counts the ES programs on their own line. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…xceless#313) The ES half becomes a DXIL vertex shader: each record dword written to LDS is a channel of a synthetic TEXCOORD register (32-bit integers), s_barrier a nop and the s_setpc_b64 handover an end. The GS half becomes a geometry shader (triangles in, triangle strip out, stream 0): reads of an input vertex record are loadInput, its own LDS writes go to a private array, the k-th GS_EMIT copies record k to the output signature and emits, GS_CUT cuts the strip, the runtime table load reads zero. translate_merged_gs now returns both shaders. Tests use synthetic GCN programs only; the DXIL validator accepts both modules. Assumed, not verified on a title program: record dword 4*row+col is that channel of the output register, emits are numbered in code order, triangle strip topology, one instance, ES vertex id in v0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…unts (fxceless#311) Review fixes: a GS program with an indirect jump has no vertex bound, and the user-data overlap tests saturate the container-supplied SGPR count. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… bits (fxceless#312) Review fixes: an ES half must hand over on every reachable path (a reachable s_endpgm loses the record), the barrier flag holds only when a barrier precedes every handover, v_bfe_u32 offsets are read in five bits, and victory translate reports an ES half whose record analysis fails. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 050913ec1d
ℹ️ 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".
| Fields::Sopp { .. } if name == "s_sendmsg" && self.x.gs.is_some() => { | ||
| self.gs_message(inst, (b, i)) |
There was a problem hiding this comment.
Dispatch
s_sendmsghalt geometry messages
merged::message_of and GsPlan recognize both s_sendmsg and s_sendmsghalt, so a halt-form GS_EMIT or GS_CUT is counted and assigned in the plan. This dispatch only calls gs_message for s_sendmsg; the halt form falls through as a no-op, leaving the returned shader with a reserved vertex or cut that it never emits. Handle both opcodes, including their halt behavior, or refuse the halt form.
Useful? React with 👍 / 👎.
| let args = [self.s.m.i32(id as u32), self.s.m.i32(0), self.s.m.i8(k), value]; | ||
| self.s.op(self.cur, name, Attr::NoUnwind, void, 5, &args); |
There was a problem hiding this comment.
Mark geometry output components as written
When the GS writes outputs through this GS_EMIT path, the elements parsed from OSG1 have usage = 0, and these storeOutput calls never update the corresponding usage bits. Unlike the normal output lowering path, the resulting geometry signature is serialized as if none of those components were used, so it does not describe the values the shader stores and can mislead downstream stage linkage. Mark each component as it is stored.
Useful? React with 👍 / 👎.
| for k in 0..dwords { | ||
| let zero = self.s.m.i32(0); | ||
| self.write(inst, Reg::S(code + k), zero, None); |
There was a problem hiding this comment.
Preserve non-output runtime-table loads
Every scalar load traced to RUNTIME_TABLE reaches this branch without checking its address offset, and every result dword is replaced with zero. Rewriting the GS output array makes its output-base load irrelevant, but a GS that reads another runtime-table field will now use zero in its calculations or control flow and produce different geometry. Restrict this substitution to the identified output-base load or preserve other table reads.
Useful? React with 👍 / 👎.
| let Some(Operand::Vector { reg: d, .. }) = *dst else { | ||
| return Err(unsupported("an LDS read without a destination")); | ||
| }; | ||
| let byte = lin.add.wrapping_add(u32::from(*offset0) | u32::from(*offset1) << 8); |
There was a problem hiding this comment.
Account for the input-offset multiplier
Eval preserves the multiplier for an input-vertex offset, but this mapping computes the record dword using only the additive part and the DS instruction offset. A read using a scale other than the expected byte scale is therefore accepted as the same vertex/dword, then replaced by loadInput for a different component. Validate the multiplier before constructing the VertexRead, or account for it when resolving the record address.
Useful? React with 👍 / 👎.
| outputs, | ||
| }, | ||
| code, | ||
| ..merged.es.clone() |
There was a problem hiding this comment.
Return the ES shader with the vertex stage kind
..merged.es.clone() preserves stage = HwStage::Es; emit_program_with copies that into HostShader.stage even though the emitted DXIL is a vertex shader. Consumers that dispatch on this field, as the existing translator host check does, will treat the returned vertex shader as a non-vertex stage. Keep the ES stage for machine-code and root-data mapping, but set the returned host shader's stage to Vs.
Useful? React with 👍 / 👎.
Step 4 of #138, for #313. Stacked on #373 (#312), itself on #367 (#311) and #309: the diff here includes theirs until they merge; the commit of this step is the last one. Base is
mainbecause the stacked branches are not in this repository.What is in it
translate_merged_gsnow returns two host shaders (MergedShaders): a vertex shader and a geometry shader, instead of stopping atGS emit. Newemit/gs.rsholds the plan and its notes.TEXCOORD<row>register (32-bit integers, dwordk= rowk / 4, channelk % 4). The rewrite is of the machine code:ds_write_b32..b128becomes theexp param<row>of the same size,s_barrieras_nop, thes_setpc_b64handover ans_endpgm.loadInputof that signature; its own LDS writes/reads go to a private array at the offset from the first record written; the k-thGS_EMITcopies record k to the output signature (storeOutput) and callsemitStream;GS_CUTiscutStream; the runtime-table scalar load reads 0. The array andmaxvertexcountcome from the emit count of the code.merged::limits,handoff::own_accesses, anOverrideshook inemit_program_withandShader.geometrycarry this;VsI/O raising also accepts the ES stage.victory translatekeeps counting those on thegeometryline.Tested
cargo build --workspace --locked,cargo test --workspace --locked --no-fail-fast -- --test-threads=4: all green (243 passed in victory-shader, 0 failed).Not tested / assumed (none read from the stage data or checked on a title program)
4 * row + colis that channel of the output with that register, records back to back; the written range must be exactly one record per emit or the program is refused.non verifie.AI use
Written with Claude Code (Claude Sonnet 5.5). The tests are synthetic programs; no title shaders or game files were read.
🤖 Generated with Claude Code