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)
Part of xcl-dev#1269. Add constant folding, integer algebraic/reassociation identities, cast chain and bitcast(select) unwrapping, set_scc comparison simplification, pure dx.op folding (unaryBits/bfrev/min/max), and dominator-tree scoped CSE (excluding implicit quad derivatives and non-readnone intrinsics). Assisted-by: T3 Code / Antigravity (gemini-pro-orchestrator-neon)
Part of xcl-dev#1269. Invoke lw.s.optimize() after lowering finishes in translate_on_this_thread and bump kernel::TRANSLATOR_VERSION from 2 to 3 so cached containers from unoptimized runs are not reused. Assisted-by: T3 Code / Antigravity (gemini-pro-orchestrator-neon)
Roroca-1
marked this pull request as draft
November 24, 2026 17:29
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. Compute and graphics shader finalization already call the optimizer, and main already advanced the translator cache version to 4. Enabling this second pass would run both optimizers. The original branch is preserved.
Turns on the DXIL IR optimization and compaction pass in
kernel::translate_on_this_threadand bumpskernel::TRANSLATOR_VERSIONto3so cached unoptimized containers are invalidated.Part of #1269.
Stacked on #1546; only the top commit belongs here.
The merged #1426 already invokes
Module::optimizeduring shader finalization and setsTRANSLATOR_VERSIONto 4. This branch conflicts withmainand its proposed version 3 predates that change.What is in it
crates/xcl/src/gpu/dxil/kernel.rs: bumpTRANSLATOR_VERSIONfrom2to3and calllw.s.optimize();after checkingexchange_errorintranslate_on_this_thread.Tested
proton-cachyos-slr) + DXVK, cross-built from Linux tox86_64-pc-windows-msvcviacargo-xwin, debug, commitf349ef0bbe60: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: 9 passed, 0 failed, 0 ignored (809 filtered out; 0SKIPPED)wine xcl.exe gpu::dxil::module::tests --nocapture: 1 passed, 0 failed, 0 ignoredwine xcl.exe gpu::dxil::bitreader_tests --test-threads=4: 3 passed, 0 failed, 0 ignoredwine xcl.exe gpu::dxil::robustness_tests --test-threads=4: 7 passed, 1 failed (translation_is_byte_identical_across_runs_and_threads:dxcompiler.dll not found), 0 ignoredwine xcl.exe gpu::dxil --test-threads=4: 32 passed, 54 failed, 2 ignored (all 54 failures solely due todxcompiler.dll not foundin Wine;SKIPPED:direct_and_hlsl_graphics_stages_link: no DXC,double_unary_legality_matches_dxil_tables)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.Not tested
.\scripts\test.ps1workspace test suitedxcompiler.dllDXIL validation and disassembly (unavailable locally under Wine)gpu::recomptests withXCL_DIRECT_DXIL=1in debug/test mode (requiresdxcompiler.dllinkernel.rs)scripts/smoke.ps1regression run on retail game titles (marked draft until run on Windows)AI use
lw.s.optimize()andTRANSLATOR_VERSIONbump inkernel.rs, drafted this description, and ran thecargo-xwin/ Wine + RX 9070 XT tests.