mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-26 11:00:43 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2713c9e049 | ||
|
|
bd13b17f30 | ||
|
|
5b99b6bd63 | ||
|
|
b23e6fd6e5 | ||
|
|
d2ca4c3995 |
No files matched your search
+2
-1
@@ -10,8 +10,9 @@ Guest execution uses original, purpose-built test programs. Commercial Xbox game
|
||||
remains unsupported.
|
||||
|
||||
### Added
|
||||
- Review follow-up on the proposed `victory-shader` import (#394): `translate_native` now reports immediate samplers as static samplers (a sampled texel read 0 on the GPU before), BetterXen's GPU tests use a host that `VICTORY_WARP` cannot redirect, the double-precision probes take run-time operands and were rerun (same result), and a per-file provenance review records that the crate was developed against one commercial title's shaders. **The import is not approved; a maintainer decision is required** (`docs/research/victory-shader-provenance.md`). Earlier statements that the crate had nothing game-specific are withdrawn.
|
||||
- Fixed the two wave-operation failures the vendored victory-shader tests showed under D3DMetal (`docs/research/shader-wave-semantics.md`). Device capabilities were measured with a new original D3D12 host (`workloads/d3d12-wave-probe`): shader model 6.6, wave operations, waves exactly 32 lanes, no double-precision shader operations. One failure was a wrong test precondition (a 64-lane lowering run on the 32-lane device); the test now checks the device width and asserts the recompiler's refusal. The other was unsupported double-precision operations: shaders compiled from original HLSL by Microsoft's DXC that use a `double` ran without writing anything, while float wave operations worked. The recompiler's one native-double site (`active_f64_sum`) now builds the console's balanced sum tree with its existing integer fp64 add and no longer declares doubles. Local results on one Apple M4 under CrossOver 26.3, not independently reproduced: the whole suite passes (229 passed, 3 ignored; the vendored original had 2 failures); 24 new GPU cases compare full 64-bit sums with a CPU model of the tree; both regression tests fail against the original lowering. Cost not measured; tree-order fidelity relies on the recompiler's own recognizer.
|
||||
- Added `scripts/hybrid/run-shader-gpu-tests.sh`, which cross-builds the vendored `victory-shader` test executable for Windows and runs it under CrossOver through `betterxen-hybrid run` (supervision, memory guard, stall detection, JSON record), either BetterXen's four fixture tests or the whole upstream suite. It takes the test executable's path from cargo's own build message instead of guessing the target layout (the first version looked in `debug/build/.../out/`; the usual location is `debug/deps/`, which is the fallback). It needs the runner from #384 and #388. Verified on the Apple M4 with CrossOver 26.3: fixtures pass; the whole suite shows the known failures; the `debug/deps` fallback is untested on this machine, whose cargo layout puts the executable elsewhere. Not independently reviewed.
|
||||
- Added `scripts/hybrid/run-shader-gpu-tests.sh`, which cross-builds the vendored `victory-shader` test executable for Windows and runs it under CrossOver through `betterxen-hybrid run` (supervision, memory guard, stall detection, JSON record), either BetterXen's ten tests or the whole upstream suite. It takes both the runner and the test executable from the messages of the cargo invocations that built them, and stops if a build fails (review fix: an earlier version piped cargo into the parser, so a failed build exited 0 and ran a stale executable, and it assumed the runner was under `target/`). `scripts/hybrid/test-run-shader-gpu-tests.sh` is a stubbed regression test for both. It needs the runner from #384 and #388. Verified on the Apple M4 with CrossOver 26.3: fixtures pass; the whole suite shows the known failures; there is no fallback to a guessed path. Not independently reviewed.
|
||||
- Integrated skakwy's `victory-shader` (GFX10/RDNA 2 machine code to DXIL SM 6.6 recompiler, about 43,500 lines of Rust) as `crates/victory-shader`, with provenance in its `UPSTREAM.md`, the Mesa notice preserved and 19 lines of lint-only edits to upstream files. Added `translate_native` and tests that translate BetterXen's own gfx1030 fixtures to DXIL and, on Windows targets, run them on the GPU through D3D12. Local results on one Apple M4 with CrossOver 26.3 (D3DMetal), not independently reproduced: 177 upstream CPU-side tests pass on macOS; all 6 fixtures with expected words matched the manifest on the GPU, with a negative control; the GPU tests fail without D3D12 instead of skipping; the full upstream suite under CrossOver has 224 passed, 2 failed, 3 ignored. DXIL validation by `dxil.dll` was not run. The native RDNA-to-Metal compiler is unchanged. See `docs/research/victory-shader-integration.md`.
|
||||
- Added the upstream research registry and component reuse matrix (`docs/research/`), a public-documentation review (evidence class D, nothing executed) of CrossOver, Wine, DXMT, DXVK, VKD3D-Proton, MoltenVK, FEX, VIctory, VIctory-macOS and PortWatch. VIctory-family projects are excluded from reuse on provenance grounds. The GitHub project board is not yet configured because the token lacks the `project` scope (#346).
|
||||
- Added hybrid research records: `docs/research/hybrid-backlog-research-2026-11-25.md` (findings and registry candidates, from search summaries) and `docs/research/primary-source-verification-2026-11-25.md` (re-check against CodeWeavers, Apple, DXMT and Wine primary pages). It confirms CrossOver's backend list, finds no public documentation of `CX_GRAPHICS_BACKEND`, and records that two Apple notices on Rosetta's end disagree; D3DMetal's license text and CrossOver's Rosetta and ARM64 plans remain unverified. Eleven issues created from the research were reviewed the same day: #364 and #365 stay in Phase 1, the others are parked and recorded under "Parked ideas" in the roadmap. Rust 1.100.0 (already installed) is the required toolchain; the default `stable` was 1.94.1. Planning only; nothing was installed or run.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Upstream provenance: victory-shader
|
||||
|
||||
**Not approved for merge.** This crate was developed against one commercial title's shaders; the per-file review and the open maintainer decision are in `docs/research/victory-shader-provenance.md`.
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| Source | <https://github.com/skakwy/victory-mac>, directory `crates/victory-shader/` (Cargo.toml and `src/`) |
|
||||
@@ -25,9 +27,10 @@ Changes to upstream files (19 lines, nothing functional) and files BetterXen add
|
||||
|
||||
- `src/emit/lower.rs` (`active_f64_sum`, about 90 lines): the whole-wave f64 sum no longer emits a native `double` wave operation (`makeDouble`, `waveActiveOp.f64`, `splitDouble`); it builds the console's balanced tree over the lanes with the crate's own integer `add_f64`, reading partner runs through `waveReadLaneAt` and a ballot for lanes that are not present, and no longer sets the doubles feature flag. Why: D3DMetal reports no double-precision shader operations and a shader that uses a `double` ran without writing anything (docs/research/shader-wave-semantics.md).
|
||||
- `src/emit/bitcode.rs`: two `#[allow(dead_code)]` for the double type, now never constructed.
|
||||
- `src/emit/host.rs`: `Host::wave_lane_count_max()` (test host only).
|
||||
- `src/emit/host.rs`: `Host::wave_lane_count_max()` and `Host::hardware()` (test host only; `hardware()` ignores `VICTORY_WARP`).
|
||||
- `src/emit/mod.rs`: the static-sampler construction is factored into `static_samplers()` so `translate_native` reports immediate samplers.
|
||||
- `src/emit/wave64_tests.rs`: `a_sum_of_halves_where_lanes_have_left_is_the_consoles_tree_bit_for_bit` checks the device's wave width and, on a device narrower than 64 lanes, asserts the recompiler's refusal instead of running a 64-lane lowering.
|
||||
|
||||
## Not carried
|
||||
|
||||
The upstream repository's other crates (`victory-gpu`, `victory-loader`, `victory-hle`, ...), which are tied to one console title and its runtime, and `mac/`, `tools/`. The shader inputs the upstream project was built for are not included; BetterXen validates this crate only with its own synthetic fixtures (see `docs/research/` for the validation record).
|
||||
The upstream repository's other crates (`victory-gpu`, `victory-loader`, `victory-hle`, ...), which are tied to one console title and its runtime, and `mac/`, `tools/`. No shader binaries or dumps of the title the upstream project targets are included, but comments and behaviour in this crate refer to that title's shaders; BetterXen validates this crate only with its own synthetic fixtures (see `docs/research/` for the validation record).
|
||||
@@ -38,8 +38,8 @@ pub fn translate_native(native: &NativeProgram) -> Result<HostShader, ShaderErro
|
||||
stage: native.stage,
|
||||
dxil: lowered.dxil,
|
||||
user_data: lowered.user_data,
|
||||
static_samplers: super::static_samplers(&lowered.samplers, lowered.cmp_samplers),
|
||||
samplers: lowered.samplers,
|
||||
static_samplers: Vec::new(),
|
||||
root_cbvs: lowered.root_cbvs,
|
||||
root_srvs: lowered.root_srvs,
|
||||
root_uavs: lowered.root_uavs,
|
||||
|
||||
@@ -191,7 +191,7 @@ mod on_the_gpu {
|
||||
let _one = crate::emit::valu_tests::ONE_AT_A_TIME
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner());
|
||||
let host = Host::new(false).expect("no SM 6.6 D3D12 hardware device: not verified");
|
||||
let host = Host::hardware().expect("no SM 6.6 D3D12 hardware device: not verified");
|
||||
let mut ran = 0;
|
||||
for f in fixtures() {
|
||||
let got = run_on_gpu(&host, &f);
|
||||
@@ -210,7 +210,7 @@ mod on_the_gpu {
|
||||
let _one = crate::emit::valu_tests::ONE_AT_A_TIME
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner());
|
||||
let host = Host::new(false).expect("no SM 6.6 D3D12 hardware device: not verified");
|
||||
let host = Host::hardware().expect("no SM 6.6 D3D12 hardware device: not verified");
|
||||
for f in fixtures() {
|
||||
let got = run_on_gpu(&host, &f);
|
||||
let mut wrong = f.expected.clone();
|
||||
@@ -357,7 +357,7 @@ mod f64_on_the_gpu {
|
||||
#[test]
|
||||
fn f64_wave_sums_match_the_cpu_tree_bit_for_bit() {
|
||||
let _one = crate::emit::valu_tests::ONE_AT_A_TIME.lock().unwrap_or_else(|e| e.into_inner());
|
||||
let host = Host::new(false).expect("no SM 6.6 D3D12 hardware device: not verified");
|
||||
let host = Host::hardware().expect("no SM 6.6 D3D12 hardware device: not verified");
|
||||
let mut ran = 0;
|
||||
for threads in [1u32, 4, 20, 32] {
|
||||
let shader = translate_native(&f64_wave_sum_program(threads)).expect("translate");
|
||||
@@ -394,3 +394,98 @@ mod f64_on_the_gpu {
|
||||
eprintln!("betterxen: {ran} f64 wave sums ran on the GPU and matched the CPU tree bit for bit");
|
||||
}
|
||||
}
|
||||
|
||||
// ---- immediate samplers through translate_native ---------------------------------------------
|
||||
//
|
||||
// A compute program that builds its sampler from constants in the code (an immediate sampler)
|
||||
// needs a static sampler in the host's root signature. `translate_native` must report it, as the
|
||||
// container path does; the buffer-only fixtures above cannot notice.
|
||||
|
||||
/// Samples texel (0.5, 0.5) of the 2D texture in table slot 0 with an immediate sampler and stores
|
||||
/// the red channel to the raw UAV in table slot 1.
|
||||
fn immediate_sampler_program() -> NativeProgram {
|
||||
let s_mov_lit = |dst: u8, lit: u32| [0xBE80_03FF | (dst as u32) << 16, lit];
|
||||
let smem = |op: u32, dst: u32, base: u32, off: u32| [0x3D << 26 | op << 18 | dst << 6 | base >> 1, 125 << 25 | off];
|
||||
let mut w: Vec<u32> = Vec::new();
|
||||
w.push(0xBE80_0300 | 2 << 16); // s_mov_b32 s2, s0 (table address)
|
||||
w.push(0xBE80_0380 | 3 << 16); // s_mov_b32 s3, 0
|
||||
w.extend(smem(0x03, 8, 2, 0)); // s_load_dwordx8 s[8:15]: the texture SRV
|
||||
w.extend(smem(0x02, 20, 2, 32)); // s_load_dwordx4 s[20:23]: the UAV
|
||||
w.push(0x7E00_02F0 | 2 << 17); // v_mov_b32 v2, 0.5
|
||||
w.push(0x7E00_02F0 | 3 << 17); // v_mov_b32 v3, 0.5
|
||||
for (i, word) in [0x0000_0092u32, 0x00C0_0000, 0x1850_0000, 0].into_iter().enumerate() {
|
||||
w.extend(s_mov_lit(16 + i as u8, word)); // s[16:19]: the sampler, as constants
|
||||
}
|
||||
// image_sample_lz v4, v[2:3], s[8:15], s[16:19] dmask:0x1 dim:2D
|
||||
w.extend([0x3C << 26 | 0x21 << 18 | 1 << 8 | 1 << 3, (16u32 >> 2) << 21 | (8u32 >> 2) << 16 | 4 << 8 | 2]);
|
||||
w.extend([0x38 << 26 | 0x1C << 18, 0x80 << 24 | (20u32 >> 2) << 16 | 4 << 8]); // buffer_store_dword v4
|
||||
w.push(0xBF81_0000); // s_endpgm
|
||||
let used = |kind, table_offset_dwords, dwords| UsedResource {
|
||||
kind,
|
||||
root: RootType::Table,
|
||||
table_offset_dwords,
|
||||
lower_bound: 0,
|
||||
stride: 0,
|
||||
dwords,
|
||||
user_data: 0,
|
||||
slot: 0,
|
||||
};
|
||||
NativeProgram {
|
||||
stage: HwStage::Cs,
|
||||
wave64: false,
|
||||
vgprs: 8,
|
||||
layout: vec![RootParam {
|
||||
root: RootType::Table,
|
||||
table_offset_dwords: 0,
|
||||
sgprs: 1,
|
||||
base_register: 0,
|
||||
user_data: 0,
|
||||
slot: 0,
|
||||
}],
|
||||
used: vec![used(ResourceType::Srv, 0, 8), used(ResourceType::Uav, 8, 4)],
|
||||
io: StageIo::Cs(ComputeIo { rsrc2: 1 << 1, threads: [1, 1, 1] }),
|
||||
code: w.iter().flat_map(|x| x.to_le_bytes()).collect(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn translate_native_reports_immediate_samplers_as_static_samplers() {
|
||||
let shader = translate_native(&immediate_sampler_program()).expect("translate");
|
||||
assert_eq!(shader.samplers.len(), 1, "the program has one immediate sampler");
|
||||
assert_eq!(shader.static_samplers.len(), 1, "the host builds s0 from this list");
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn immediate_sampler_samples_the_texture_on_the_gpu() {
|
||||
use crate::emit::host::{Dispatch, Host, Root, View};
|
||||
let _one = crate::emit::valu_tests::ONE_AT_A_TIME.lock().unwrap_or_else(|e| e.into_inner());
|
||||
let host = Host::hardware().expect("no SM 6.6 D3D12 hardware device: not verified");
|
||||
let shader = translate_native(&immediate_sampler_program()).expect("translate");
|
||||
let (root, pso) = host.compute_pipeline(&shader).expect("compute pipeline");
|
||||
let ud = vec![0u32; shader.user_data_dwords().max(1) as usize];
|
||||
let texels = [[0.25f32, 0.5, 0.75, 1.0]];
|
||||
let out = host
|
||||
.dispatch(
|
||||
&root,
|
||||
&pso,
|
||||
&Dispatch {
|
||||
roots: vec![(0, Root::Constants(ud))],
|
||||
views: &[View::Texture(1, 1, &texels), View::RawUav(1)],
|
||||
samplers: &[],
|
||||
groups: [1, 1, 1],
|
||||
},
|
||||
)
|
||||
.expect("dispatch");
|
||||
assert_eq!(out[0][0], 0.25f32.to_bits(), "red of the only texel");
|
||||
eprintln!("betterxen: the immediate-sampler program sampled the texture on the GPU");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn static_samplers_keep_the_comparison_filter_flag() {
|
||||
let words = [0x0000_0092u32, 0x00C0_0000, 0x1850_0000, 0];
|
||||
let list = super::static_samplers(&[words, words], 0b10);
|
||||
assert_eq!(list.len(), 2);
|
||||
assert_eq!(list[0].filter & 0x80, 0, "sampler 0 is not a comparison sampler");
|
||||
assert_ne!(list[1].filter & 0x80, 0, "sampler 1 is");
|
||||
}
|
||||
@@ -103,6 +103,17 @@ impl Host {
|
||||
/// The default adapter, or WARP with `warp` (or `VICTORY_WARP=1`).
|
||||
pub fn new(warp: bool) -> Result<Self, String> {
|
||||
let warp = warp || std::env::var("VICTORY_WARP").is_ok_and(|v| v == "1");
|
||||
Self::create(warp)
|
||||
}
|
||||
|
||||
/// The default hardware adapter, whatever `VICTORY_WARP` says; an error when the default
|
||||
/// device is the software adapter. BetterXen addition: a test that reports GPU verification
|
||||
/// must not be redirectable to WARP by the environment.
|
||||
pub fn hardware() -> Result<Self, String> {
|
||||
Self::create(false)
|
||||
}
|
||||
|
||||
fn create(warp: bool) -> Result<Self, String> {
|
||||
// SAFETY: plain D3D12/DXGI calls with valid out pointers.
|
||||
unsafe {
|
||||
// `VICTORY_D3D12_DEBUG`: the debug layer, whose messages a
|
||||
|
||||
@@ -646,18 +646,7 @@ fn emit_program(
|
||||
stage: native.stage,
|
||||
dxil: l.dxil,
|
||||
user_data: l.user_data,
|
||||
static_samplers: l
|
||||
.samplers
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(n, &w)| {
|
||||
let mut s = StaticSampler::from_words(w);
|
||||
if l.cmp_samplers >> n & 1 != 0 {
|
||||
s.filter |= 0x80;
|
||||
}
|
||||
s
|
||||
})
|
||||
.collect(),
|
||||
static_samplers: static_samplers(&l.samplers, l.cmp_samplers),
|
||||
samplers: l.samplers,
|
||||
root_cbvs: l.root_cbvs,
|
||||
root_srvs: l.root_srvs,
|
||||
@@ -667,6 +656,23 @@ fn emit_program(
|
||||
Ok((shader, wave_size))
|
||||
}
|
||||
|
||||
/// The static sampler descriptions for the immediate samplers a shader uses (`s<n>` at position
|
||||
/// n); bit n of `cmp` marks a sampler used for comparisons. BetterXen change: factored out so
|
||||
/// `translate_native` builds the same list as the container path.
|
||||
fn static_samplers(samplers: &[[u32; 4]], cmp: u64) -> Vec<StaticSampler> {
|
||||
samplers
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(n, &w)| {
|
||||
let mut s = StaticSampler::from_words(w);
|
||||
if cmp >> n & 1 != 0 {
|
||||
s.filter |= 0x80;
|
||||
}
|
||||
s
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The rows of an `ISG1`/`OSG1` part.
|
||||
fn signature(part: &[u8]) -> Result<Vec<container::SigElement>, ShaderError> {
|
||||
use crate::dxbc::u32_at;
|
||||
|
||||
@@ -242,7 +242,7 @@ fn a_sum_of_halves_where_lanes_have_left_is_the_consoles_tree_bit_for_bit() {
|
||||
// this program ("a wave sum of 16-bit floats where not every lane runs"): the test then
|
||||
// asserts that refusal, which is the correct behaviour, rather than reporting a failure
|
||||
// or silently skipping.
|
||||
if let Some(w) = Host::new(false).ok().and_then(|h| h.wave_lane_count_max()).filter(|&w| w < 64) {
|
||||
if let Some(w) = Host::hardware().ok().and_then(|h| h.wave_lane_count_max()).filter(|&w| w < 64) {
|
||||
let refused = lowered_on(&native, &p, &HashSet::new(), w);
|
||||
assert!(
|
||||
matches!(&refused, Err(ShaderError::Unsupported { what, .. }) if what.contains("16-bit floats where not every lane runs")),
|
||||
|
||||
@@ -68,6 +68,7 @@ checkpoints retain their original evidence scope.
|
||||
|
||||
- [Public sources](research/sources.md), [RDNA 2 notes](research/rdna2.md), and [Xbox GPU evidence](research/xbox-gpu.md) — Specifications, evidence scope, and unknown console behavior.
|
||||
- [Shader inputs](research/shader-containers.md) and [risk register](risk-register.md) — Input provenance and unresolved engineering risks.
|
||||
- [victory-shader provenance review](research/victory-shader-provenance.md) — Per-file licence and origin record for the proposed import; not approved, maintainer decision pending.
|
||||
- [victory-shader integration](research/victory-shader-integration.md) — The vendored GFX10-to-DXIL recompiler, how BetterXen's fixtures run through it on the GPU under CrossOver, and what is not verified.
|
||||
- [Shader wave-semantics investigation](research/shader-wave-semantics.md) — Why two upstream wave tests failed under D3DMetal: device capabilities, independent probes, the fix and its limits.
|
||||
- [Texture format inventory](research/texture-formats.md) — Formats and layouts by stage (decode, layout, native upload, sampling, guest), their public specifications, unknowns and ranked follow-ups.
|
||||
|
||||
@@ -14,6 +14,7 @@ Companion to the [upstream registry](upstream-registry.md); same evidence limits
|
||||
| Direct3D 12 to Vulkan | VKD3D-Proton | **Evaluate**; blocked on a Vulkan 1.3 provider | Depends on MoltenVK feature coverage, unknown. |
|
||||
| Vulkan on Metal | MoltenVK | **Evaluate** | Apache-2.0 (compatible with GPLv3). Subset of Vulkan; coverage vs consumers unknown. |
|
||||
| Shader compiler / runtime | VIctory, VIctory-macOS | **Rejected for reuse** | Built for a specific commercial game's Xbox Series build whose provenance is not established as authorized. Ideas only. |
|
||||
| GFX10 to DXIL recompiler | victory-mac `crates/victory-shader` (VIctory family) | **Not approved: maintainer decision pending** (the rejection above stands until then) | PR #394 proposes vendoring it. The [per-file review](victory-shader-provenance.md) finds GPL-3.0 licensing but development against one commercial title's shaders; read plainly, the engineering rules exclude it. |
|
||||
| Project discovery | PortWatch VI | Reference only | Editorial tracker; not engineering evidence; nothing imported. |
|
||||
| x86-64 decode and ARM64 translation, runtime, gfx1030 compiler, Metal backend | BetterXen native implementation | **Preserved, paused** | Reuse only where hybrid needs it and it shows a demonstrated advantage; not forced into the architecture. |
|
||||
| Test and diagnostics methodology | BetterXen existing audits, benchmark harness, claims registry | **Reuse** | Existing evidence classes, claims audit and benchmark gating apply to hybrid work (Phase 1 onward). |
|
||||
|
||||
@@ -37,15 +37,18 @@ Observed: a Wave32 program with 4 launched threads, each contributing 1.25, shou
|
||||
| --- | --- | --- |
|
||||
| `lanes4`: wave size and lane index, 4 threads | `0x2000`..`0x2003` (wave of 32) | exactly that |
|
||||
| `sum_f32_4`: `WaveActiveSum(1.25f)`, 4 threads | `0x40a00000` in every lane | exactly that |
|
||||
| `add_f64_4`: a plain `double` add (no wave operation) | low `0x00000000`, high `0x40000000` | **every dword still `0xDEADBEEF`: the shader wrote nothing** |
|
||||
| `sum_f64_4`: `WaveActiveSum` over a `double` | low `0x00000000`, high `0x40140000` | **every dword still `0xDEADBEEF`: the shader wrote nothing** |
|
||||
| `add_f32_4`: control, run-time load, float add, store | `0x40000000`, `0` per thread | exactly that |
|
||||
| `add_f64_4`: a `double` add of run-time operands (DXIL contains `fadd fast double`) | low `0x00000000`, high `0x40000000` | **every dword still `0xDEADBEEF`: the shader wrote nothing** |
|
||||
| `sum_f64_4`: `WaveActiveSum` over a run-time `double` (DXIL `waveActiveOp.f64`) | low `0x00000000`, high `0x40140000` | **every dword still `0xDEADBEEF`: the shader wrote nothing** |
|
||||
|
||||
An earlier version of `add_f64_4` used constant operands: the compiler folded the addition to `splitDouble(2.0)` with no `fadd` (reviewer finding by atesahmet0, confirmed with `dxc -dumpbin`), so it did not show a double *addition* failing. The probes above take their operands from the buffer at run time and were rerun; the result is the same.
|
||||
|
||||
So wave operations, wave width and partial waves are fine on this device. Any shader that uses a `double` runs without effect: pipeline creation succeeds, the dispatch completes, and nothing is stored. That matches the capability record (`DoublePrecisionFloatShaderOps = 0`; Metal has no fp64). Upstream's test harness zero-fills its output buffer, which is why it saw `0` instead of the sentinel. **Conclusion:** the failure comes from unsupported double-precision operations in the backend, combined with the recompiler emitting a native `double` in one place (`active_f64_sum`) while using integer emulation everywhere else. It is not a mistranslation of the wave operation and not a wave-semantics problem.
|
||||
|
||||
**Fix (recompiler, `active_f64_sum`):** the existing integer fp64 add (`add_f64`, checked upstream against the CPU's doubles) is reused to build the console's sum, which is the balanced tree over the lanes in their order. Each lane adds its partner run's partial sum, read through `waveReadLaneAt` from the first lane of that run that is present (found with a ballot, as `half_sum_present` already does for 16-bit sums), `+0.0` where none is, which is what a lane outside EXEC adds on the console. No `double` type is emitted and the doubles feature flag is no longer set. The same code covers the console wave64 on two host waves of 32 (an integer add for the last step).
|
||||
|
||||
**Validation** (M4, CrossOver 26.3, default backend; one machine, not independently reproduced):
|
||||
- Whole suite under CrossOver: **229 passed, 0 failed, 3 ignored** (was 224 passed, 2 failed). macOS: 179 + new tests pass (`cargo test -p victory-shader`).
|
||||
- Whole suite under CrossOver: **232 passed, 0 failed, 3 ignored** (229 before the review's sampler tests) (was 224 passed, 2 failed). macOS: 179 + new tests pass (`cargo test -p victory-shader`).
|
||||
- New test `f64_wave_sums_match_the_cpu_tree_bit_for_bit`: 24 cases (1, 4, 20 and 32 launched threads; six values including ones that round: 0.1, 123456.789, a value one ulp above 1.0, -3.75e10, 1e-300), comparing all 64 bits with a CPU model of the balanced tree using the CPU's own f64 additions and `+0.0` for lanes that are not launched. All 24 match. The model is independent of the recompiler.
|
||||
- Negative controls: against the **original** lowering this GPU test fails (`got 0x0000000000000000, want 0x3ff4000000000000`) and the new `the_f64_wave_sum_is_lowered_without_native_doubles` test (the container's feature word must declare wave operations but not doubles) fails too; both pass with the fix.
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@ Reviewed 2026-11-25. Every entry is **evidence class D** (non-normative official
|
||||
| VIctory-macOS | [pragyaangaur/VIctory-macOS](https://github.com/pragyaangaur/VIctory-macOS) | `485b230ef596` | GPL-3.0 (GitHub) | Discovery reference only | A macOS port of VIctory using Rosetta, CrossOver Wine and D3DMetal per its README (also noted in [portwatch-native-macos.md](portwatch-native-macos.md)). Same input concern. Its test and "works" claims are self-reported and not verified here. The repository has no parent fork, so the "canonical upstream" is VIctory. |
|
||||
| PortWatch VI | [portwatch-vi.xyz](https://portwatch-vi.xyz/), [4lwayz/portwatch-vi](https://github.com/4lwayz/portwatch-vi) | `ed00263cc0c9` | NOASSERTION | Project discovery reference | A tracker of community efforts; progress figures are editorial, with self-reported claims labelled. Not engineering evidence; flagged and ignored queues are not endorsed. |
|
||||
|
||||
## victory-shader import under review
|
||||
|
||||
`skakwy/victory-mac` `crates/victory-shader` at `22b3f8e45a59` is proposed for vendoring in PR #394. **Not approved.** See the [per-file provenance and licence review](victory-shader-provenance.md); the provenance decision below stands until a maintainer changes it.
|
||||
|
||||
## Additional candidates found by search (not reviewed)
|
||||
|
||||
Found by GitHub search on 2026-11-25. Only repository metadata was read; none was evaluated, installed or run, and none is a recommendation. Licenses are what GitHub reported.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# victory-shader integration (GFX10 to DXIL recompiler)
|
||||
|
||||
Evidence: classes noted per row. Everything ran on one machine (Apple M4, 24 GiB, macOS 27.0, CrossOver 26.3.0.39832, bottle `betterxen-test`, default backend) and has **not been independently reproduced**. No game, console title or leaked material was used.
|
||||
Evidence: classes noted per row. Everything ran on one machine (Apple M4, 24 GiB, macOS 27.0, CrossOver 26.3.0.39832, bottle `betterxen-test`, default backend) and has **not been independently reproduced**. BetterXen's runs used no game files or leaked material. **The vendored code itself was developed against one commercial title's shaders** and is not approved for merge: see [victory-shader-provenance.md](victory-shader-provenance.md).
|
||||
|
||||
## What was integrated
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
# victory-shader: per-file provenance and licence review
|
||||
|
||||
**Status: NOT APPROVED. A maintainer decision is required before PR #394 can merge.** This is the review the engineering rules require for VIctory-family code. It records facts; it does not grant approval, and its author is the person who proposed the import, so it is not an independent review.
|
||||
|
||||
Upstream: <https://github.com/skakwy/victory-mac>, revision `22b3f8e45a59f7d11fef7718988c58d0b3f1d0f9`. Method: every tracked file of `crates/victory-shader/` at that revision; authors from `git shortlog`; licence from the repository `LICENSE` and a search of each file for other notices; title references by searching for shader names of the form `module:CS_Name` and the words title, titles, game, games. The search finds references, not every dependence: a file without one may still have been developed against the same title.
|
||||
|
||||
## Findings
|
||||
|
||||
1. **Licence:** GPL-3.0, compatible with BetterXen's GPL-3.0-or-later. One third-party notice (Mesa-derived opcode names, MIT, Valve) in `src/gfx10/opcodes.rs`, kept. Some comments cite Mesa behaviour and LLVM definitions. skakwy and the VIctory-macOS maintainer authorized reuse of their own contributions (relayed by the maintainer); other authors' lines rest on the repository licence.
|
||||
2. **The crate was developed against one commercial title's shaders.** 17 of 36 files refer to "the title" or "the game"; comments describe that title's programs, layouts and structures, and four places cite its shaders by name (`wave64_tests.rs`, `wave.rs`, `own_bits.rs`). The upstream project's stated purpose is to run that title's Xbox Series build; this registry and PortWatch record that build as leaked.
|
||||
3. **What is not in the crate:** a search found no shader binaries, shader dumps, game assets, keys or decryption code. The references are in comments, test descriptions and handling of shader constructs.
|
||||
4. **Earlier statements that were wrong:** the integration record and PR descriptions said the crate had nothing game-specific. That claim came from searching only for the game's and publisher's names. It is withdrawn.
|
||||
|
||||
## How this meets the engineering rules (`AGENTS.md`)
|
||||
|
||||
| Rule | Assessment |
|
||||
| --- | --- |
|
||||
| "Projects whose stated purpose depends on leaked or unauthorized builds ... are discovery references at documentation level; adopt nothing from them without a per-file provenance and license review recorded in the registry." | This file is that record. Recording it does not by itself approve adoption. |
|
||||
| "Game-specific, asset-specific and decryption-related code is never adopted." | Handling written for and documented against one title's shaders is present in at least some files. Whether that makes a file "game-specific code" is the decision to make; it is a general GFX10 recompiler in structure, with title-driven behaviour inside it. |
|
||||
| "Provenance first: exclude anything derived from leaked proprietary material or unauthorized software." | Layouts "as observed in shipped titles" (`native.rs`) and behaviour tuned to the title's programs are plausibly derived from that material. |
|
||||
| "Never copy, port, translate or adapt source from emulator projects built for leaked or unauthorized material." | Read plainly, this applies to this import. Author permission does not change it. |
|
||||
|
||||
**Reviewer's recommendation to the maintainer:** under the rules as written, do not merge the import. Either decline it (keep the crate as a documentation-level reference; BetterXen's own fixtures, probes and findings stand on their own), or change the rule explicitly in `AGENTS.md` with the legal question considered, and then decide file by file. This is not legal advice.
|
||||
|
||||
## Per-file record
|
||||
|
||||
| File (under `crates/victory-shader/`) | Lines | Upstream authors (commits) | Licence and third-party notes | Shader names of a title | Lines saying title/game |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| `Cargo.toml` | 40 | Marvis (2), fxceless (1) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/bvh.rs` | 696 | fxceless (2) | GPL-3.0 (repository licence) | - | 5 |
|
||||
| `src/dxbc.rs` | 181 | Marvis (2) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/dxil.rs` | 211 | Marvis (1) | GPL-3.0 (repository licence); cites LLVM | - | - |
|
||||
| `src/emit/bitcode.rs` | 1240 | Marvis (3), fxceless (2), Lyrnc (1) +2 more | GPL-3.0 (repository licence); cites LLVM | - | - |
|
||||
| `src/emit/bitcode/census.rs` | 174 | fxceless (1) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/emit/bitcode/opt.rs` | 2140 | armin (1), fxceless (1) | GPL-3.0 (repository licence) | - | 1 |
|
||||
| `src/emit/container.rs` | 419 | Duff (1), Marvis (1), fxceless (1) +1 more | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/emit/diff_tests.rs` | 1287 | Marvis (3), fxceless (1) | GPL-3.0 (repository licence) | - | 5 |
|
||||
| `src/emit/f64.rs` | 409 | skakwy (1) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/emit/host.rs` | 1472 | fxceless (3), Marvis (1), skakwy (1) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/emit/intersect.rs` | 557 | fxceless (1) | GPL-3.0 (repository licence) | - | 12 |
|
||||
| `src/emit/intersect_tests.rs` | 690 | fxceless (1) | GPL-3.0 (repository licence) | - | 15 |
|
||||
| `src/emit/lower.rs` | 12268 | Marvis (21), skakwy (9), fxceless (6) +23 more | GPL-3.0 (repository licence); comment cites Mesa behaviour; cites LLVM | - | 18 |
|
||||
| `src/emit/mod.rs` | 1755 | Marvis (7), fxceless (6), skakwy (4) +8 more | GPL-3.0 (repository licence) | - | 16 |
|
||||
| `src/emit/own_bits.rs` | 914 | fxceless (1) | GPL-3.0 (repository licence) | 1 | 3 |
|
||||
| `src/emit/rect.rs` | 484 | fxceless (2) | GPL-3.0 (repository licence) | - | 2 |
|
||||
| `src/emit/sampler.rs` | 125 | Marvis (1) | GPL-3.0 (repository licence) | - | 1 |
|
||||
| `src/emit/shader.rs` | 908 | fxceless (4), Claude (1), Duff (1) +4 more | GPL-3.0 (repository licence) | - | 8 |
|
||||
| `src/emit/threading.rs` | 218 | fxceless (1) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/emit/validator.rs` | 221 | Marvis (1), lameloball2813-ui (1) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/emit/valu_tests.rs` | 1624 | Marvis (6), r4. (5), fxceless (4) +6 more | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/emit/waterfall_tests.rs` | 435 | r4. (3), Marvis (1), Noname0202 (1) +1 more | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/emit/wave.rs` | 1228 | fxceless (3), skakwy (2), AscilCH (1) +1 more | GPL-3.0 (repository licence) | 1 | - |
|
||||
| `src/emit/wave64_tests.rs` | 532 | fxceless (1), triippywhale (1) | GPL-3.0 (repository licence) | 2 | - |
|
||||
| `src/gfx10/fields.rs` | 815 | Marvis (1), fxceless (1) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/gfx10/mod.rs` | 496 | Marvis (3), tedin7 (1) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/gfx10/opcodes.rs` | 1333 | Duff (1), Marvis (1) | GPL-3.0 (repository licence); Mesa-derived, MIT (Valve), notice in header; cites LLVM | - | - |
|
||||
| `src/gfx10/sp3.rs` | 784 | Marvis (1) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/io.rs` | 826 | Marvis (1), fxceless (1), local (1) | GPL-3.0 (repository licence) | - | - |
|
||||
| `src/ir.rs` | 1791 | fxceless (4), Marvis (2), Yaekai (1) +1 more | GPL-3.0 (repository licence) | - | 1 |
|
||||
| `src/lib.rs` | 38 | Marvis (3), fxceless (1) | GPL-3.0 (repository licence); cites LLVM | - | - |
|
||||
| `src/native.rs` | 1103 | Marvis (4), fxceless (1), local (1) | GPL-3.0 (repository licence) | - | 1 |
|
||||
| `src/resource.rs` | 3848 | Claude (3), fxceless (3), Marvis (2) +2 more | GPL-3.0 (repository licence); cites LLVM | - | 10 |
|
||||
| `src/spill.rs` | 380 | fxceless (2) | GPL-3.0 (repository licence) | - | 1 |
|
||||
| `src/structure.rs` | 1899 | Marvis (2), fxceless (2), DexNom (1) +2 more | GPL-3.0 (repository licence) | - | - |
|
||||
|
||||
BetterXen's additions (`src/emit/betterxen.rs`, `src/emit/betterxen_tests.rs`, `Cargo.toml`, `UPSTREAM.md`) are original, GPL-3.0-or-later. Functional edits to upstream files are listed in `crates/victory-shader/UPSTREAM.md`.
|
||||
@@ -16,37 +16,52 @@ BOTTLE=${2:-betterxen-test}
|
||||
WHICH=${3:-fixtures}
|
||||
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
cd "$ROOT"
|
||||
# Build the host tool first, into the normal target directory, before the Windows build redirects it.
|
||||
rustup run 1.100.0 cargo build -q -p betterxen-hybrid
|
||||
export PATH="$TC/bin:$PATH"
|
||||
export CARGO_TARGET_X86_64_PC_WINDOWS_GNULLVM_LINKER="$TC/bin/x86_64-w64-mingw32-clang"
|
||||
export CARGO_TARGET_DIR="$ROOT/artifacts/victory-win"
|
||||
# Build the Windows test executable and take its path from cargo's own build message. It normally
|
||||
# lands in <target>/x86_64-pc-windows-gnullvm/debug/deps/, but cargo's layout can differ with the
|
||||
# build configuration, so the path is not guessed; `deps/` is only the fallback.
|
||||
EXE=$(rustup run 1.100.0 cargo test -q -p victory-shader --target x86_64-pc-windows-gnullvm --no-run \
|
||||
--message-format=json | python3 -I -c '
|
||||
# Both executables are taken from the messages of the cargo invocation that built them, and only
|
||||
# when that invocation succeeded: no path is guessed and nothing left over from an earlier build can
|
||||
# be run. (Cargo is not piped into the parser: under /bin/sh a pipeline reports only the parser's
|
||||
# exit status.)
|
||||
LOG=$(mktemp)
|
||||
trap 'rm -f "$LOG"' EXIT
|
||||
# built_exe <target name> <is test: true|false>: the executable named in $LOG.
|
||||
built_exe() {
|
||||
python3 -I -c '
|
||||
import json, sys
|
||||
exe = None
|
||||
for line in sys.stdin:
|
||||
name, test, exe = sys.argv[1], sys.argv[2] == "true", ""
|
||||
for line in open(sys.argv[3]):
|
||||
try:
|
||||
m = json.loads(line)
|
||||
except ValueError:
|
||||
continue
|
||||
if m.get("reason") == "compiler-artifact" and m.get("profile", {}).get("test") \
|
||||
and m.get("target", {}).get("name") in ("victory_shader", "victory-shader") and m.get("executable"):
|
||||
t = m.get("target", {})
|
||||
if (m.get("reason") == "compiler-artifact" and m.get("executable")
|
||||
and t.get("name", "").replace("-", "_") == name
|
||||
and bool(m.get("profile", {}).get("test")) == test):
|
||||
exe = m["executable"]
|
||||
print(exe or "")')
|
||||
if [ -z "$EXE" ]; then
|
||||
EXE=$(ls -t "$CARGO_TARGET_DIR"/x86_64-pc-windows-gnullvm/debug/deps/victory_shader-*.exe 2>/dev/null | head -1)
|
||||
fi
|
||||
[ -n "$EXE" ] && [ -f "$EXE" ] || { echo "could not find the victory-shader test executable" >&2; exit 1; }
|
||||
print(exe)' "$1" "$2" "$LOG"
|
||||
}
|
||||
|
||||
# The host tool first, before the environment is pointed at the Windows toolchain.
|
||||
rustup run 1.100.0 cargo build -q -p betterxen-hybrid --message-format=json-render-diagnostics >"$LOG" \
|
||||
|| { echo "building betterxen-hybrid failed" >&2; exit 1; }
|
||||
B=$(built_exe betterxen_hybrid false)
|
||||
[ -n "$B" ] && [ -x "$B" ] || { echo "the host build named no betterxen-hybrid executable" >&2; exit 1; }
|
||||
|
||||
export PATH="$TC/bin:$PATH"
|
||||
export CARGO_TARGET_X86_64_PC_WINDOWS_GNULLVM_LINKER="$TC/bin/x86_64-w64-mingw32-clang"
|
||||
export CARGO_TARGET_DIR="$ROOT/artifacts/victory-win"
|
||||
rustup run 1.100.0 cargo test -q -p victory-shader --target x86_64-pc-windows-gnullvm --no-run \
|
||||
--message-format=json-render-diagnostics >"$LOG" \
|
||||
|| { echo "building the victory-shader test executable failed" >&2; exit 1; }
|
||||
EXE=$(built_exe victory_shader true)
|
||||
[ -n "$EXE" ] && [ -f "$EXE" ] || { echo "the build named no victory-shader test executable" >&2; exit 1; }
|
||||
file "$EXE" | grep -q "PE32+ executable.*x86-64" || { echo "not an x86-64 PE: $EXE" >&2; exit 1; }
|
||||
B="$ROOT/target/debug/betterxen-hybrid"
|
||||
rm -f "$LOG"
|
||||
if [ "$WHICH" = all ]; then
|
||||
exec "$B" run --bottle "$BOTTLE" --timeout 900 --stall-timeout 120 --expect "test result: ok" \
|
||||
--out artifacts/hybrid-runs -- "$EXE" --test-threads=1
|
||||
else
|
||||
exec "$B" run --bottle "$BOTTLE" --timeout 300 --stall-timeout 120 --expect "test result: ok. 4 passed" \
|
||||
# The exact count is deliberate: a looser marker would also accept a filter that matches nothing
|
||||
# ("0 passed"). Update it when BetterXen adds or removes tests in emit/betterxen_tests.rs.
|
||||
exec "$B" run --bottle "$BOTTLE" --timeout 300 --stall-timeout 120 --expect "test result: ok. 10 passed" \
|
||||
--out artifacts/hybrid-runs -- "$EXE" betterxen --test-threads=1
|
||||
fi
|
||||
Executable
+79
@@ -0,0 +1,79 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Regression test for run-shader-gpu-tests.sh with a stubbed `rustup`/cargo and a stubbed runner:
|
||||
# no toolchain, CrossOver or GPU is needed. Checks that
|
||||
# 1. a failed Windows test build stops the script and the runner is never invoked, even when an
|
||||
# older test executable is lying in the target directory;
|
||||
# 2. a successful build runs exactly the executable that build named;
|
||||
# 3. the host runner is the one the host build named, also with an inherited CARGO_TARGET_DIR.
|
||||
set -u
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
T=$(mktemp -d)
|
||||
trap 'rm -rf "$T"' EXIT
|
||||
fails=0
|
||||
check() { if eval "$2"; then echo "ok $1"; else echo "FAIL $1"; fails=1; fi; }
|
||||
|
||||
# A file `file` reports as an x86-64 PE32+ executable.
|
||||
make_pe() {
|
||||
python3 -I -c '
|
||||
import struct, sys
|
||||
b = bytearray(512); b[0:2] = b"MZ"; struct.pack_into("<I", b, 0x3C, 0x80)
|
||||
b[0x80:0x84] = b"PE\0\0"; struct.pack_into("<HHIIIHH", b, 0x84, 0x8664, 0, 0, 0, 0, 240, 0x22)
|
||||
struct.pack_into("<H", b, 0x98, 0x20B); struct.pack_into("<H", b, 0x98 + 68, 3)
|
||||
open(sys.argv[1], "wb").write(b)' "$1"
|
||||
}
|
||||
|
||||
setup() { # $1 = case directory
|
||||
R=$1/repo
|
||||
mkdir -p "$R/scripts/hybrid" "$1/bin" "$1/tc/bin"
|
||||
cp "$HERE/run-shader-gpu-tests.sh" "$R/scripts/hybrid/"
|
||||
: > "$1/tc/bin/x86_64-w64-mingw32-clang"; chmod +x "$1/tc/bin/x86_64-w64-mingw32-clang"
|
||||
# The stub runner records how it was called.
|
||||
runner() { mkdir -p "$(dirname "$1")"; printf '#!/bin/sh\necho "$0 $*" >> "%s"\n' "$2" > "$1"; chmod +x "$1"; }
|
||||
# A runner left over from an earlier build at the old hard-coded place.
|
||||
runner "$R/target/debug/betterxen-hybrid" "$1/stale-runner.log"
|
||||
# An older test executable lying around in the target directory.
|
||||
old="$R/artifacts/victory-win/x86_64-pc-windows-gnullvm/debug/deps"
|
||||
mkdir -p "$old"; make_pe "$old/victory_shader-0000stale.exe"
|
||||
cat > "$1/bin/rustup" <<STUB
|
||||
#!/bin/sh
|
||||
# stands in for: rustup run 1.100.0 cargo <build|test> ...
|
||||
shift 3
|
||||
cmd=\$1
|
||||
dir=\${CARGO_TARGET_DIR:-$R/target}
|
||||
case "\$cmd" in
|
||||
build)
|
||||
mkdir -p "\$dir/debug"
|
||||
printf '#!/bin/sh\necho "\$0 \$*" >> "%s"\n' "$1/runner.log" > "\$dir/debug/betterxen-hybrid"
|
||||
chmod +x "\$dir/debug/betterxen-hybrid"
|
||||
echo "{\"reason\":\"compiler-artifact\",\"target\":{\"name\":\"betterxen-hybrid\",\"kind\":[\"bin\"]},\"profile\":{\"test\":false},\"executable\":\"\$dir/debug/betterxen-hybrid\"}"
|
||||
;;
|
||||
test)
|
||||
[ "\${STUB_TEST_BUILD_FAILS:-0}" = 1 ] && exit 101
|
||||
mkdir -p "\$dir/fresh"; cp "$old/victory_shader-0000stale.exe" "\$dir/fresh/victory_shader-1111new.exe"
|
||||
echo "{\"reason\":\"compiler-artifact\",\"target\":{\"name\":\"victory_shader\",\"kind\":[\"lib\"]},\"profile\":{\"test\":true},\"executable\":\"\$dir/fresh/victory_shader-1111new.exe\"}"
|
||||
;;
|
||||
esac
|
||||
STUB
|
||||
chmod +x "$1/bin/rustup"
|
||||
}
|
||||
|
||||
# 1. failed test build
|
||||
c=$T/fail; setup "$c"
|
||||
STUB_TEST_BUILD_FAILS=1 PATH="$c/bin:$PATH" sh "$c/repo/scripts/hybrid/run-shader-gpu-tests.sh" "$c/tc" >/dev/null 2>&1; rc=$?
|
||||
check "failed build: script exits non-zero (got $rc)" "[ $rc -ne 0 ]"
|
||||
check "failed build: no runner is invoked" "[ ! -e '$c/runner.log' ] && [ ! -e '$c/stale-runner.log' ]"
|
||||
|
||||
# 2. successful build
|
||||
c=$T/ok; setup "$c"
|
||||
PATH="$c/bin:$PATH" sh "$c/repo/scripts/hybrid/run-shader-gpu-tests.sh" "$c/tc" >/dev/null 2>&1; rc=$?
|
||||
check "good build: script succeeds (got $rc)" "[ $rc -eq 0 ]"
|
||||
check "good build: runs the executable this build named" "grep -q 'victory_shader-1111new.exe' '$c/runner.log' 2>/dev/null"
|
||||
|
||||
# 3. inherited CARGO_TARGET_DIR
|
||||
c=$T/dir; setup "$c"
|
||||
CARGO_TARGET_DIR="$c/elsewhere" PATH="$c/bin:$PATH" sh "$c/repo/scripts/hybrid/run-shader-gpu-tests.sh" "$c/tc" >/dev/null 2>&1; rc=$?
|
||||
check "inherited target dir: script succeeds (got $rc)" "[ $rc -eq 0 ]"
|
||||
check "inherited target dir: the freshly built runner is used" "grep -q '$c/elsewhere/debug/betterxen-hybrid' '$c/runner.log' 2>/dev/null"
|
||||
check "inherited target dir: the stale runner is not used" "[ ! -e '$c/stale-runner.log' ]"
|
||||
exit $fails
|
||||
@@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Control for add_f64_4: the same run-time load, add and store in single precision. If this writes
|
||||
// and the double version does not, the load/store path is not the cause.
|
||||
// Expected (by hand): word 0 = 2.0f (0x40000000), word 1 = 0 for each of the 4 threads.
|
||||
RWByteAddressBuffer o : register(u0);
|
||||
[numthreads(4, 1, 1)]
|
||||
void main(uint t : SV_GroupIndex) {
|
||||
uint z = o.Load(t * 8) ^ 0xDEADBEEF;
|
||||
float s = asfloat(z ^ 0x3FA00000) + asfloat(z ^ 0x3F400000); // 1.25 + 0.75
|
||||
o.Store2(t * 8, uint2(asuint(s), z));
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// No wave operation: a plain double addition 1.25 + 0.75 = 2.0 (0x4000000000000000), to separate
|
||||
// "doubles unsupported" from "wave operations on doubles unsupported".
|
||||
// Expected (by hand): low word 0x00000000, high word 0x40000000.
|
||||
// No wave operation: a double addition 1.25 + 0.75 = 2.0 (0x4000000000000000) whose operands are
|
||||
// only known at run time, so the compiler cannot fold it. The host fills the buffer with
|
||||
// 0xDEADBEEF; `z` is therefore 0 when the shader runs, but not at compile time. The compiled DXIL
|
||||
// must contain `fadd ... double` (check with `dxc -dumpbin`). Separates "doubles unsupported" from
|
||||
// "wave operations on doubles unsupported".
|
||||
// Expected (by hand): low word 0x00000000, high word 0x40000000 for each of the 4 threads.
|
||||
RWByteAddressBuffer o : register(u0);
|
||||
[numthreads(4, 1, 1)]
|
||||
void main(uint t : SV_GroupIndex) {
|
||||
double a = 1.25, b = 0.75 + (double)(t - t);
|
||||
uint z = o.Load(t * 8) ^ 0xDEADBEEF;
|
||||
double a = asdouble(z, z ^ 0x3FF40000); // 1.25
|
||||
double b = asdouble(z, z ^ 0x3FE80000); // 0.75
|
||||
double s = a + b;
|
||||
uint lo, hi;
|
||||
asuint(s, lo, hi);
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Expected (by hand): 4 threads each add the double 1.25; the sum is 5.0, whose bit pattern is
|
||||
// 0x4014000000000000, so each lane stores low word 0x00000000 and high word 0x40140000.
|
||||
// A wave sum over a double that is only known at run time (see add_f64_4.hlsl).
|
||||
// Expected (by hand): 4 threads each add 1.25, sum 5.0 = 0x4014000000000000, so each stores low
|
||||
// word 0x00000000 and high word 0x40140000.
|
||||
// The device reports DoublePrecisionFloatShaderOps = 0; this probe shows what actually happens.
|
||||
RWByteAddressBuffer o : register(u0);
|
||||
[numthreads(4, 1, 1)]
|
||||
void main(uint t : SV_GroupIndex) {
|
||||
double s = WaveActiveSum(1.25);
|
||||
uint z = o.Load(t * 8) ^ 0xDEADBEEF;
|
||||
double s = WaveActiveSum(asdouble(z, z ^ 0x3FF40000));
|
||||
uint lo, hi;
|
||||
asuint(s, lo, hi);
|
||||
o.Store2(t * 8, uint2(lo, hi));
|
||||
|
||||
Reference in new issue
Block a user