Skip to content

Translator: ds_read_u8_d16[_hi] and ds_read_i8_d16[_hi] (SHADER-85) - #605

Closed
0xTehuti wants to merge 1 commit into
ItsNotRexed:mainfrom
0xTehuti:feat/ds-read-8bit-d16
Closed

0xTehuti wants to merge 1 commit into
ItsNotRexed:mainfrom
0xTehuti:feat/ds-read-8bit-d16

Conversation

@0xTehuti

Copy link
Copy Markdown
Contributor

Item: SHADER-85

What this does

Implements 8-bit d16 LDS reads in tools/rdna2spirv.py and covers them in tools/lds_fuzz.py:

  • ds_read_u8_d16: reads 8 bits from LDS, zero-extends via OpBitFieldUExtract, and inserts into destination VGPR bits [15:0] via OpBitFieldInsert (preserving bits [31:16]).
  • ds_read_u8_d16_hi: reads 8 bits from LDS, zero-extends via OpBitFieldUExtract, and inserts into destination VGPR bits [31:16] via OpBitFieldInsert (preserving bits [15:0]).
  • ds_read_i8_d16: reads 8 bits from LDS, sign-extends via OpBitFieldSExtract, and inserts into destination VGPR bits [15:0] via OpBitFieldInsert (preserving bits [31:16]).
  • ds_read_i8_d16_hi: reads 8 bits from LDS, sign-extends via OpBitFieldSExtract, and inserts into destination VGPR bits [31:16] via OpBitFieldInsert (preserving bits [15:0]).

Updates docs/design.md and docs/shader_validation.md to document support.

Testing

  • python -m compileall -q make_game.py tools tests: pass
  • pytest tests/test_lds_fuzz.py: 23/23 pass
  • pytest tests/test_translate.py -k test_cs_ds_read_8bit_d16: pass
  • python -I tools/lds_fuzz.py --model-only --programs 200: 400 programs modelled, 0 mismatches
  • dotnet build tools/rpf9dump/rpf9dump.csproj -c Release: pass

Tested on: NVIDIA GeForce RTX 2070 SUPER, driver 595.79, Windows 11.
AI-assisted.

Implement 8-bit LDS reads into a 16-bit half (zero-extended unsigned and
sign-extended signed), cover them in tools/lds_fuzz.py and update docs.

AI-assisted.
@0xTehuti
0xTehuti force-pushed the feat/ds-read-8bit-d16 branch from a7124fb to cdb6e95 Compare November 22, 2026 01:09
@tylerstraub

Copy link
Copy Markdown
Contributor

Replying to @0xTehuti.

@0xTehuti, at the rebased head cdb6e95 the D3D12 changes have dropped out. The remaining overlap is SHADER-85 itself. @esteban-dcp’s open #592 at 8caffe6 already exercises all four byte-read variants in a GPU fixture, including whether the untouched half of the destination survives. Your four focused tests in tests/test_lds_fuzz.py check the fuzzer model directly, a file #592 doesn’t change. Could you compare those assertions with @esteban-dcp and offer the additional model coverage there? Existing GPU fixture · Coordinator’s ownership note

AI-assisted.

@0xTehuti

Copy link
Copy Markdown
Contributor Author

Replying to @tylerstraub.

Thanks for the heads-up! I compared the assertions in tests/test_lds_fuzz.py with @esteban-dcp's #592 fixture (runtime/test/shaders/cs_w32_lds_u8_d16.asm and tests/semantic/test_lds_read_u8_d16.py):

  • Both verify zero-extension into 16 bits for ds_read_u8_d16[_hi].
  • Both verify 8→16 sign-extension for ds_read_i8_d16[_hi].
  • Both verify preservation of the untouched 16-bit half of the destination VGPR.

The semantics match 100%. I've shared the Program.model() unit test coverage over on #592 for @esteban-dcp to incorporate if desired. Closing this PR to keep the review queue clean.

AI-assisted.

@0xTehuti 0xTehuti closed this Nov 22, 2026
esteban-dcp pushed a commit to esteban-dcp/Leonida that referenced this pull request Nov 22, 2026
…NotRexed#605)

Four unit tests for lds_fuzz.Program.model() covering zero- and sign-extension
into the low and the high half, the other half kept. Written by 0xTehuti in
the closed PR ItsNotRexed#605 and added here because ItsNotRexed#592 is the canonical SHADER-85 PR
and it adds these reads to the fuzzer's READS table.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
esteban-dcp pushed a commit to esteban-dcp/Leonida that referenced this pull request Nov 22, 2026
…NotRexed#605)

Four unit tests for lds_fuzz.Program.model() covering zero- and sign-extension
into the low and the high half, the other half kept. Written by 0xTehuti in
the closed PR ItsNotRexed#605 and added here because ItsNotRexed#592 is the canonical SHADER-85 PR
and it adds these reads to the fuzzer's READS table.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
esteban-dcp pushed a commit to esteban-dcp/Leonida that referenced this pull request Nov 22, 2026
…NotRexed#605)

Four unit tests for lds_fuzz.Program.model() covering zero- and sign-extension
into the low and the high half, the other half kept. Written by 0xTehuti in
the closed PR ItsNotRexed#605 and added here because ItsNotRexed#592 is the canonical SHADER-85 PR
and it adds these reads to the fuzzer's READS table.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
esteban-dcp pushed a commit to esteban-dcp/Leonida that referenced this pull request Nov 22, 2026
…NotRexed#605)

Four unit tests for lds_fuzz.Program.model() covering zero- and sign-extension
into the low and the high half, the other half kept. Written by 0xTehuti in
the closed PR ItsNotRexed#605 and added here because ItsNotRexed#592 is the canonical SHADER-85 PR
and it adds these reads to the fuzzer's READS table.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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