Skip to content

Recompiler: OMOD / CLAMP on f64 results, conversions and integer ops … - #126

Closed
gbuyssens wants to merge 1 commit into
xcl-dev:mainfrom
gbuyssens:pr/omod-clamp
Closed

gbuyssens wants to merge 1 commit into
xcl-dev:mainfrom
gbuyssens:pr/omod-clamp

Conversation

@gbuyssens

Copy link
Copy Markdown
Contributor

…(#105)

  • f64 results: CLAMP went through saturate(), which has no double overload – the result was rounded to float first (29 bits lost); OMOD was ignored. Both apply to the double now.
  • v_cvt_f32_f64 and v_cvt_f16_f32 apply OMOD / CLAMP.
  • integer CLAMP (saturation) on v_add_nc_u32 / v_sub_nc_u32 / v_subrev_nc_u32, v_add3_u32, the packed v_pk_add / sub / mad / mul_lo u16 / i16 and the dots' accumulation (dropped before).
  • vccz / execz read in a wave32 program look at the low word only (vcc_hi is a free SGPR there).
  • TG_SIZE counts a partial last wave of the group.
  • GPU test gpu_output_modifiers_on_f64_conversions_and_integer_clamp.

…cl-dev#105)

- f64 results: CLAMP went through saturate(), which has no double overload – the result was
  rounded to float first (29 bits lost); OMOD was ignored. Both apply to the double now.
- v_cvt_f32_f64 and v_cvt_f16_f32 apply OMOD / CLAMP.
- integer CLAMP (saturation) on v_add_nc_u32 / v_sub_nc_u32 / v_subrev_nc_u32, v_add3_u32, the
  packed v_pk_add / sub / mad / mul_lo u16 / i16 and the dots' accumulation (dropped before).
- vccz / execz read in a wave32 program look at the low word only (vcc_hi is a free SGPR there).
- TG_SIZE counts a partial last wave of the group.
- GPU test gpu_output_modifiers_on_f64_conversions_and_integer_clamp.
@ivall

ivall commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Thanks – closing as a duplicate of #119 (merged), which covers the OMOD / CLAMP part and showed that f64 clamp keeps double precision (DXIL has a double saturate). The other two items here – vccz / execz in wave32 programs reading only the low word, and TG_SIZE counting a partial last wave – are not in #119: a small PR with just those and a test each would be welcome.

@ivall ivall closed this Nov 23, 2026
Lum7nt added a commit to Lum7nt/xcl that referenced this pull request Nov 23, 2026
… and add console stubs

Scarlett GDK uses subobject type 23 for Amplification Shaders (AS) and 24 for Mesh Shaders (MS), whereas PC Direct3D 12 uses slot 24 for AS and 25 for MS. Console streams passing an MS container in slot 24 previously failed pipeline stream translation as an unsupported AS, returning E_INVALIDARG.

- Disambiguate slot 24 in real.rs and null.rs by checking shader container stage and NGG hardware stage.
- Direct console slot 24 MS containers to mesh shader translation and fallback.
- In fallback_stream, rewrite console slot 24 to PC slot 25 with dummy mesh bytecode so PC drivers accept the SM 6.5 stream.
- Add unit tests for subobject payload and fallback stream rewriting.
- Add console stubs for command list xcl-dev#75, xcl-dev#126, #131, xcl-dev#132, xcl-dev#142, allocator xcl-dev#9, and queue xcl-dev#31 extension.
heretic1321 pushed a commit to heretic1321/xcl that referenced this pull request Nov 23, 2026
… and add console stubs

Scarlett GDK uses subobject type 23 for Amplification Shaders (AS) and 24 for Mesh Shaders (MS), whereas PC Direct3D 12 uses slot 24 for AS and 25 for MS. Console streams passing an MS container in slot 24 previously failed pipeline stream translation as an unsupported AS, returning E_INVALIDARG.

- Disambiguate slot 24 in real.rs and null.rs by checking shader container stage and NGG hardware stage.
- Direct console slot 24 MS containers to mesh shader translation and fallback.
- In fallback_stream, rewrite console slot 24 to PC slot 25 with dummy mesh bytecode so PC drivers accept the SM 6.5 stream.
- Add unit tests for subobject payload and fallback stream rewriting.
- Add console stubs for command list xcl-dev#75, xcl-dev#126, #131, xcl-dev#132, xcl-dev#142, allocator xcl-dev#9, and queue xcl-dev#31 extension.
ivall added a commit that referenced this pull request Nov 25, 2026
Every other method of the newer command list sits two slots after the older one, so #129 is the
older #127, not #126. A retail title's own calls through its list agree with the slots before it:
#126 takes a value and a pointer (RSSetShadingRate), #127 one resource (RSSetShadingRateImage), #128
one pointer. Nothing handles either slot yet; #2092's DispatchMesh is at #127.
JR-Wiederkehr pushed a commit to JR-Wiederkehr/xcl that referenced this pull request Nov 25, 2026
…ecuteIndirect)

Supersedes xcl-dev#724; its commits are kept with their authors.

Conflicts:
- bind.rs State keeps the tree's heap_bound and xcl-dev#1803's heaps next to
  the record buffers and scratch; reset clears the heaps and holds the
  record buffers for the old allocator; forget takes the state out of
  the sharded map (bind::STATES) and holds its buffers. HashMap is
  imported again for the PR's maps.
- console_list.rs Layout keeps xcl-dev#1803's heaps and the PR's inline_ms;
  with_heaps and user_data_ms both stay.
- device_x.rs keeps xcl-dev#1887's log of a refused signature and the PR's
  companion Dispatch signature; the CreateCommandSignature doc is back
  above its function (the merge had put it above indirect_arg_bytes).
- real.rs console slots keep the tree's #131 / xcl-dev#132 FlushCacheRange and
  the PR's DispatchMesh at xcl-dev#127.
- list_x.rs: the PR's bound_heaps test helper removes the list from
  its own part of the sharded recording map.

DispatchMesh slot: xcl-dev#1984 mapped the newer layout's xcl-dev#129 to the older
xcl-dev#126, this PR to xcl-dev#127, where it hooks DispatchMesh. Kept xcl-dev#127: it is
the shift of two slots the other methods have, and xcl-dev#1984's own reading
of the newer layout (xcl-dev#126 / xcl-dev#127 the shading-rate methods, the older
xcl-dev#124 / xcl-dev#125) puts its xcl-dev#128 at the older xcl-dev#126. xcl-dev#1984's test is rewritten
for (129, 127) and checks that the older slot runs bind::dispatch_mesh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants