Repository navigation
Conversation
KelboLive
left a comment
There was a problem hiding this comment.
LGTM — clean addition for an otherwise unreachable format.
Adds BUF_FMT_10_10_10_2_SSCALED (FORMAT 47) decode to gfx2hlsl.py: four signed fields packed in one dword (x=2-bit, y/z/w=10-bit each), sign-extended and converted to float without division. No DXGI typed view has this layout, so only hardware descriptors reach it. Runtime formatted_buffer.h now accepts FORMAT 47. Test fixture checks 16 elements bit-exact against CPU reference, with mutations (case removed, sign extension dropped, wrong field order) all failing correctly.
Ready to land.
KelboLive
left a comment
There was a problem hiding this comment.
LGTM — clean extension of MTBUF formatted loads to the SRV byte window.
Extends the SRV byte window path to formatted loads (tbuffer_load_format_x). requires_identity_dst_sel threads from manifest through cache encoding, binder, and dispatch refusal. indirect_table_buffer checks identity DST_SEL and component mapping before binding. gfx1013_compute_mtbuf.inl detects the zero-stride rewrite and routes through byte_window_srv. Writable MTBUF byte windows refuse without a verified view contract. New test startup_compute_mtbuf_window_check.py covers identity readback, swapped X/Y refusal, CBV-token refusal, and cold/warm cache manifest equality. Existing tests updated for raw and formatted window loads.
Ready to land.
|
Merged current Verification (Windows Server 2025, D3D12 WARP, head KelboLive approved @MasterDomino ready for review and merge when you have time. AI-assisted; commands listed were executed locally. |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0abb4b2083
ℹ️ 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".
| switch (code) { | ||
| case 1: case 5: case 14: case 22: case 23: case 24: case 27: | ||
| case 29: case 50: case 56: case 60: case 64: case 71: case 74: case 77: | ||
| case 29: case 47: case 50: case 56: case 60: case 64: case 71: case 74: case 77: |
There was a problem hiding this comment.
Invalidate cached translations before accepting FORMAT 47
When reusing a shader cache containing an already-translated buffer_load_format_* pipeline, this gate now accepts FORMAT 47 even though the cached bytecode has no corresponding switch case and returns DESC_FORMAT_UNKNOWN NaNs for identity selectors. The Python and runtime cache revisions remain unchanged: the source-built MUBUF fixture retains key 170fc67bcc26ed98 across this commit, load_translation() loads the existing bytecode, and pending_keys() skips complete results. Consequently, upgrading the runtime and translator can replace the previous explicit refusal with incorrect shader results without ever running the new decoder. Bump the synchronized cache revisions or otherwise invalidate existing translations alongside this acceptance change.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Revision 30 (already on this branch) changes the graphics and compute cache keys, so results translated before FORMAT 47 support are not reused. 0a7b7b1 adds a check to tests/startup_shader_cache_rekey_check.py: completed revision 29 results stay pending under the current revision. Linux: startup_shader_cache_rekey_check passes; the revision 29 negative control fails as expected.
| 'BUF_FMT_32_32_FLOAT': 64, 'BUF_FMT_16_16_16_16_FLOAT': 71, 'BUF_FMT_32_32_32_FLOAT': 74, | ||
| 'BUF_FMT_32_32_32_32_FLOAT': 77} | ||
| # Formats only a hardware descriptor reaches: no DXGI typed view has their layout. | ||
| DESCRIPTOR_ONLY_FORMATS = frozenset({'BUF_FMT_10_10_10_2_SSCALED'}) |
There was a problem hiding this comment.
Document FORMAT 47 support and its reproduction tests
This introduces the first descriptor-only decoded format, changing a public capability without the documentation update required by AGENTS.md. A repository-wide search for SSCALED and startup_vertex_fetch_sscaled finds no README or experiment entry; docs/experiments.md still states that the DXGI table equals DESC_FORMAT_CODES, and its documented vertex-fetch filter excludes the new fixture. Update the capability documentation to explain descriptor-only FORMAT 47 support and provide the new reproduction command.
AGENTS.md reference: AGENTS.md:L329-L330
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
FORMAT 47 is documented in docs/experiments.md with its reproduction commands. 0a7b7b1 also corrects the table description: the DXGI table agrees with FETCH_DXGI and maps to DESC_FORMAT_CODES, and descriptor-only FORMAT 47 has no DXGI entry.
…ched before FORMAT 47 are redone, and document FORMAT 47
|
Both findings are addressed in
Verification (Windows Server 2025, D3D12 WARP, dev and release, head AI-assisted; commands listed were executed locally. |
Leyukaka
left a comment
There was a problem hiding this comment.
Comment at 025f16d, no blocking finding. Reading only: the diff and the code around it, against main 212d4b5. Nothing was built or run.
Semantics. Code 47 is BUF_FMT_10_10_10_2_SSCALED (tools/disasm_rdna2.py:1281). docs/experiments.md:6599 says AMD names list fields from the most significant bit, so x is bits 1:0, y 11:2, z 21:12, w 31:22. gfx2hlsl.py:146-147 extracts those fields with an arithmetic >> on int and no division. DST_SEL 1 gives 1.0, since the format is not in DESC_ONE_INTEGER (:181).
Scope not in the body. tbuffer() / load_format() (gfx2hlsl.py:7714-7731) accept any FETCH_FORMATS name, so tbuffer_load_format_* format:[BUF_FMT_10_10_10_2_SSCALED] is now translated as well. No test covers that path.
Cache revision. 29/29cs become 30/30cs in d3d12_draw.inl:393-394, shader_compute_request.cpp:180/191, gfx2hlsl.py:12973/12983, tools/patch_manifest.py:24 and the pinned tests. Side effect: the request readers called by compile_dxil compare against the current revision and 28 only, so a revision-29 capture is now rejected while a revision-28 one is still accepted (shader_compute_request.cpp:295-298, :317-318):
if (x2w::compute_request_key(code, data, root, desc, sa, sb) != expected &&
x2w::compute_request_key(code, data, root, desc, sa, sb, "x2w-startup-shader-28cs") != expected)
throw std::runtime_error("compute request key mismatch");Docs still stale.
- docs/experiments.md:618 says the word3 table check "checks that the DXGI table equals
DESC_FORMAT_CODES"; the check now addsDESCRIPTOR_ONLY_FORMATS(startup_buffer_format_word3_table_check.py:37). - docs/startup-runtime.md:209 names revision 30, but :210-213 describe 29 and the following lines 28 and 25. No line says what 30 invalidates.
- docs/experiments/patch-manifests.md:103 still uses
x2w-startup-shader-29bin its example.
Tests (tests/startup_vertex_fetch_sscaled_check.py).
- "case removed" and "sign extension dropped" (:99-100) edit the translated source, and the data has a negative and a non-negative value in every channel (:79-81). Both can fail only through the translation.
- "wrong field order" (:108) runs the unmodified translation against
expected(order=(1, 0, 2, 3)). Only the reference is swapped, so it shows that x and y differ in the data, which :82 already asserts. The reference decodes withFIELDS(:25), written from the same reading of the name as the translation, so a misread layout would pass on both sides. The layout rests on experiments.md:6599, not on this test. - The device case writes
descword3straight into the constants (:68) and never reachesformatted_buffer_supported(d3d12_draw.inl:2677). Droppingcase 47:from formatted_buffer.h is caught only by text matches on the header (:84, startup_vertex_fetch_formats_check.py:299, startup_buffer_format_word3_table_check.py:33). startup_buffer_format_word3_check.cpp:91-92 executes the function for 0, 2 and 77; adding 47 there would cover it.
CI. Neither the pr filter (CMakePresets.json:51) nor the Linux Python list (windows.yml python-linux, tests/checks/python-linux) selects startup_vertex_fetch_sscaled_*, startup_vertex_fetch_formats_controls, startup_gfx2hlsl_fract or native_compile_dxil_rekey, so the checks on this PR do not run the new tests. The recomputed keys do run there: startup_shader_cache_key (pr filter), startup_compute_request_offline and startup_buffer_format_word3_table (windows.yml:304, :389).
Merge. git merge-tree against main 212d4b5 is clean; main is still at revision 29. #3410 (24755d1) adds key_parts = G.fnv(b'x2w-startup-shader-29') in tests/startup_gfx2hlsl_ps57in_check.py and compares it with pipeline_key(), and its gfx2hlsl.py hunk edits the lines directly around the revision literal (:12973 here). Whichever merges second has to resolve that hunk and move the test literal to 30.
|
Also open: #3435 needs a bump of the same revision (main is at |
|
Review of MUST
NIT
Checks I ran: Linux, Python 3.13, the pure-Python checks above. No Windows, WARP or GPU run. AI-assisted. |
# Conflicts: # docs/experiments/native-startup-request-cache.md # tools/startup/gfx2hlsl.py
|
Merged current |
Part of #870
What this unblocks: buffer_load_format_* from a hardware descriptor whose FORMAT field is 47 (BUF_FMT_10_10_10_2_SSCALED), which was refused as an unsupported FORMAT.
What changed:
tools/startup/gfx2hlsl.py: newBUF_FMT_10_10_10_2_SSCALEDentry (FORMAT 47). Each field is sign-extended and converted to a float without dividing; x is the 2-bit field in bits 1:0, y, z and w are the 10-bit fields above it. No DXGI typed view has this layout, so it is listed inDESCRIPTOR_ONLY_FORMATS.src/startup_stubs/formatted_buffer.h: the runtime accepts code 47.startup_vertex_fetch_sscaled_{controls,warp,hardware}(sixteen elements at an unaligned stride read back bit for bit against a CPU reference, plus mutants for the removed case, dropped sign extension and wrong field order); the sibling format-count check and the word3 table check account for the descriptor-only format.Verification:
python3 -B tests/startup_vertex_fetch_sscaled_check.py controls,python3 -B tests/startup_vertex_fetch_formats_check.py controls,python3 -B tests/startup_buffer_format_word3_table_check.py: pass.x2w_pipe.py win2025 3382 --host aws-1 --targets offscreen_check,startup_buffer_format_word3_check --regex '^startup_(vertex_fetch|buffer_format_word3)' --force: dev 9/9 and release 9/9 passed (includesstartup_vertex_fetch_sscaled_warpand_hardware).float(int(w << 30) >> 30)->float(uint(w << 30) >> 30)in the SSCALED entry),x2w_pipe.py win2025 3382 --host aws-1 --patch <mutant> --skip-release --regex '^startup_vertex_fetch':startup_vertex_fetch_sscaled_warpandstartup_vertex_fetch_sscaled_hardwarefail (4/6 pass).Draft until an independent peer review and the Win2025 WARP gate pass.
Thanks to @Makto94 for the testing that found this.
AI-assisted; commands listed were executed locally.