Repository navigation
Conversation
…ages) Emits signed DXIL containers without HLSL or DXC: LLVM 3.7 bitcode writer, DXBC container with the retail digest, dx.op library (math, memory, atomics, textures, wave ops), VS/PS/MS signatures and PSV0 matching DXC byte for byte. DXC's validator is used as a test oracle only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LLVM's reader only accepted 7 because unknown codes fall back to seq_cst. Adds a test-only reader for our unabbreviated bitstream to check record layouts the validator cannot distinguish. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ypes The validator derives these flags from the code; kernels that built i64 or double instructions with plain Module methods (rather than the Shader helpers that call require) failed with "Flags must match usage". Both finish paths now scan the entry for i64 / double operands and results, and for double division and int <-> double conversions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seeded xorshift generator of random-but-valid kernels (integer / float / i64 / double arithmetic with guards, phis, diamonds, switches, loops with back-edge phis, selects, dx.op integer ops, group-shared exchange and atomics with barriers, wave reads, raw buffer I/O). 2000 modules pass the validator; the exactly-comparable ones (~1200) run on the GPU against a CPU interpreter. Includes the regression test for shader-flag inference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Empty DXC blobs may report a null buffer, which slice::from_raw_parts forbids (UB); error-buffer casts no longer unwrap, and blobs over 4 GiB are an error instead of a truncated length. Adds a malformed-input test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Garbage above a half / float constant's width made equal constants intern twice (and relied on the reader truncating the record). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port of the translator from dxil/core (olympus-based) onto main: CFG/SSA, the EXEC/ballot lane model, SALU/VALU/memory/image/cross-lane lowering, compute/VS/PS/mesh entry points (gpu::dxil::kernel). Hooks re-done against main's recomp: runner (direct_dxil, direct_kernel, direct_kernel_full, switch in run_code/run_code_with), pso (direct compute, VS/PS and mesh pass with logged HLSL fallback; the on-disk translation cache is bypassed while the switch is on), tests (direct_or/direct_check), constant_samplers pub(crate). Translator fixes for tests only main has: f64/cvt output modifiers and clamp, integer/packed/dot clamp, wave32 src_vccz/src_execz, b32 saveexec with m0, SDWA f16 inline constants, cube T#s as cube arrays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The translated cache identity now includes the backend (HLSL / direct compute / direct all) and gpu::dxil::kernel::TRANSLATOR_VERSION when XCL_DIRECT_DXIL is set; the HLSL identity is unchanged, so existing entries stay valid. Caching is re-enabled for the direct path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Translator state is only looked up through hash maps (never iterated into output), so no fix was needed; the test pins it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…guarded) act() and the cross-lane instructions' wave mask can be overridden, so an external control-flow analysis can reuse the per-instruction lowering while deciding EXEC itself. Default behaviour unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Module records the first misuse (forward reference outside phis, instruction after a terminator, GEP/extractvalue/load into wrong types, function redeclared with another type, bad call arity, bad constants, add_incoming to a non-phi, use of a void value) and carries on with a placeholder. New additive API: Module::fail/error/try_to_bitcode, Shader::try_finish, Shader::try_finish_graphics; existing finish / finish_graphics / to_bitcode keep their signatures (panic on a recorded error). The translator uses the try_ variants, so pso.rs routing falls back to HLSL with a log. Regression tests for each former panic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The PR check only accepts binaries under tests/data/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the no-GPU CI runner (WARP / Basic Render Driver) even a DXC-compiled VS/PS draw through runner::draw removes the device, which then fails every later GPU test in the process (mesh_dispatch included). Gate the draw tests the way recomp's gpu_ready() does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NVIDIA Blackwell drivers fail CreateComputePipelineState with E_OUTOFMEMORY for every fuzz module containing a groupshared atomicrmw sub (82/82 failing seeds on an RTX 5070 Ti, 0 of 1141 without it). Neither DXC nor the translator emits that form. debug_seed now prints size and GPU-runs the seed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AMD's driver compiler (amdxc64.dll) crashes at PSO creation on modules without it (RX 9070 / RX 7800 XT reports). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Windows SDK's DXC 1.6/1.7 rejects dx.valver 1.8 before checking anything else. valver stays 1.8 (PSV0 carries PSVRuntimeInfo3, new in 1.8); with an older validator validate() reports a SKIPPED line per test and the GPU parts still run. Malformed containers still fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The translator creates the exit block before the program's blocks and wrote the epilogue into it. The module writer numbers values in block order and refuses a reference to a later value outside a phi, so a vertex or pixel shader whose exports come after a branch or a guarded memory access failed with "direct DXIL builder error: forward reference to value 128 at instruction 90 (blocks must be in dominance order)" and the stage went to the HLSL path. The kernel epilogue was not affected: its stores go into a guard block that is created last. The epilogue now has a block of its own, created after the program's blocks; the exit block keeps the phis and branches to it. The test translates a vertex and a pixel shader that branch on s0 before their exports and compares their draws with the HLSL path's for both directions of the branch. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
DXC 1.9.2609 declares dx.op.waveGetLaneIndex "nounwind readonly" (DXC 1.7.2308 declared it readnone); the emitter declared it readnone. dxil.dll 1.7.2308 and 1.9.2609 accept either, so this only brings the declaration in line with current DXC output. The other dx.op declarations already match DXC 1.9.2609's table. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The two commits before this one change the containers the direct translator emits (an epilogue block of its own; waveGetLaneIndex readonly), and kernel::TRANSLATOR_VERSION is part of the identity of the translation disk cache: entries made by version 1 are not reused. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The writer lays the entry's blocks out in reverse post-order of its CFG and numbers values in that order, so a lowering may create blocks in any order (requested for the per-lane mode). Unreachable blocks and their phi edges are dropped. replace_all_uses rewrites instruction and metadata operands (e.g. to remove trivial phis). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part of xcl-dev#1269. Expose DXIL Module IR types and helpers within gpu::dxil for the optimization passes, and fix Module::uses_double_extensions to scan only live block instructions rather than deleted/unattached entries in insts. Assisted-by: T3 Code / Antigravity (gemini-pro-orchestrator-neon)
Part of xcl-dev#1269. Add the core DXIL SSA optimization module (Shader::optimize / opt::optimize_module, not yet called by kernel translation) covering iterative CFG simplification and RPO re-indexing, dominance-checked trivial/duplicate PHI elimination, iterative mark-and-sweep DCE, dense table compaction, and Shader::features synchronization. Assisted-by: T3 Code / Antigravity (gemini-pro-orchestrator-neon)
Roroca-1
marked this pull request as draft
November 24, 2026 17:28
gut0to
reviewed
Nov 24, 2026
gut0to
left a comment
There was a problem hiding this comment.
The targeted DXIL tests are helpful, and leaving the optimizer unwired avoids enabling it prematurely. CONTRIBUTING.md still requires the full workspace suite on Windows; the current report says that was not run natively. It also requires a paired real-title smoke run for changes under crates/xcl/src, even when the title does not reach the new path. Please add those results before merge, documenting the path coverage. AI-assisted review; I checked the applicable requirements against the guide.
Contributor
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Retired after #1426 merged. Main now handles unreachable blocks, trivial PHIs, dominator CSE and dead instructions during shader finalization. The additional CFG rewrites, compaction and feature synchronization in this draft have no isolated result here against the merged optimizer. The original branch is preserved for follow-up measurements.
Core DXIL SSA IR optimization and compaction passes (
Shader::optimize/opt::optimize_module), left unwired from kernel translation until the stacked InstCombine/CSE and enablement PRs land.Part of #1269.
Stacked on #1544; only the top commit belongs here.
This PR adds ~1,230 non-test lines (~256 test lines) because the iterative CFG/PHI/DCE fixpoint loop,
compact_module, andsync_featuresshare operand-rewriting and dominator helpers and together keepShader::featuresconsistent after dead code removal; InstCombine/CSE andkernel.rswiring are split into the follow-up PRs.The merged #1426 already performs unreachable-block cleanup, trivial PHI elimination and DCE in
module/opt.rs. This branch predates that implementation and conflicts withmain.What is in it
crates/xcl/src/gpu/dxil/opt.rs: addStats,module_stats,optimize,optimize_module, iterativesimplify_cfg(terminator folding, iterative RPO traversal, PHI edge trimming, empty jump-block bypass, single-predecessor merging, dense RPO re-indexing), dominance-checkedsimplify_phis(via iterative Cooper-Harvey-Kennedycompute_idom), iterative mark-and-sweepdce(dead PHI cycles, unusedreadnone/readonlyand pure wave/quad calls), densecompact_module, andsync_featuresplus 5 unit/GPU tests.crates/xcl/src/gpu/dxil/mod.rs,crates/xcl/src/gpu/dxil/shader.rs: exportpub mod optand addShader::optimize(&mut self).Tested
proton-cachyos-slr) + DXVK, cross-built from Linux tox86_64-pc-windows-msvcviacargo-xwin, debug, commit32facfe36b73:TARGET_CFLAGS="/FIstring.h" cargo xwin build --tests -p xcl --target x86_64-pc-windows-msvc: 0 errors, 0 warningswine xcl.exe gpu::dxil::opt --nocapture --test-threads=1: 5 passed, 0 failed, 0 ignored (809 filtered out; 0SKIPPED, includes GPU execution on RX 9070 XT)Regression run
Pending native Windows GPU workspace tests and paired
scripts/smoke.ps1runs on the same retail title and duration at cleanmainand PR head. Path coverage must be recorded with the results. The new pass is unwired on this branch.Not tested
.\scripts\test.ps1workspace test suitedxcompiler.dllDXIL validation and disassembly (unavailable locally under Wine)scripts/smoke.ps1regression run on retail game titlesAI use
opt.rspasses and tests, wiredShader::optimize, drafted this description, and ran thecargo-xwin/ Wine + RX 9070 XT tests.