shader: probe native gfx1030 FP32 BVH box readback #1616

Merged
stan495 merged 2 commits from upstream-pr/1623 into main 2026-11-25 05:51:01 +00:00
stan495 commented 2026-11-24 15:13:18 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T15:13:18Z.


Summary

Add a native Linux HIP readback fixture for image_bvh_intersect_ray and image_bvh64_intersect_ray on gfx1030. The kernel returns all four raw DWORDs. Five rays per opcode cover ordered hits, clipping, a disabled child, all-miss and a four-hit node. The runner logs the descriptor, typed pointer, readback and first mismatch with the CPU candidate.

Verification

Tested commit 7e7fa40eceba735214574b705cd8163dd90bd699.

sh tests/gfx1030_bvh_box/build.sh
python3 -B tests/gfx1030_bvh_box/check.py --model-only
llvm-readelf-15 --notes out/native-gfx1030-bvh-box/box.hsaco
python3 -B tests/docs_links_check.py
python3 -B tests/bidi_controls_check.py
python3 -B tests/form_coverage_check.py

LLVM and LLD 15 assembled and linked the code object, with one instance of each opcode in disassembly and 80-byte kernel argument segments. Code object SHA-256 9b2e3470f1fef2cd5eea243097dc412d7b36601264d095eaf65c3f612ca796aa. All five CPU ray witnesses and both mutation checks passed. The reversed sort first changes word 0 from 0000001d to 00000025. Substituting zero for the all-miss fill changes word 0 from ffffffff to 00000000. The three Python regressions passed.

git diff --check origin/main...HEAD and git merge-tree --write-tree origin/main HEAD passed against 71be6f0f5bec7729a259b8090dbb8374e22b3f9a. A merge simulation with the comparison stack and #1587 produced the same tree with this probe applied first or last.

Native capture

Volunteers with a Linux HIP gfx1030 adapter can post their readback in #1639.

The draft awaits a Linux HIP run on a physical gfx1030 adapter. Use rocminfo to confirm the target. Build the code object and select the corresponding HIP ordinal.

python3 -B tests/gfx1030_bvh_box/check.py --device 0

Please include the adapter target, driver and runtime, command, and all raw DWORDs in the report. The CPU candidate for miss and disabled slots requires native readback before it can be used to justify translator coverage.

Windows host follow-up

Reproduced the LLVM and LLD 15.0.7 build for 7e7fa40eceba735214574b705cd8163dd90bd699 in Ubuntu 24.04.4 on WSL2. The code object matched the SHA-256 above, disassembly showed one instance of each BVH opcode, and both kernels reported an 80-byte argument segment. --model-only passed all five CPU witnesses and both negative controls. The documentation link, bidi-control and form-coverage checks passed using the Windows development Python environment.

The host runs Windows 11 build 26200.9974 with a Radeon RX 7900 XTX (gfx1100, Windows driver 32.0.32029.2010). In its existing ROCm 7.2.1 WSL environment, /opt/rocm/bin/rocminfo reported hsa_init Failed, possibly no supported GPU devices, and hipInit(0) returned error 100 (no ROCm-capable device is detected). Native capture remains pending on a physical Linux HIP gfx1030 adapter for all ten cases.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6585002790 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1623). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T15:13:18Z. --- ## Summary Add a native Linux HIP readback fixture for `image_bvh_intersect_ray` and `image_bvh64_intersect_ray` on gfx1030. The kernel returns all four raw DWORDs. Five rays per opcode cover ordered hits, clipping, a disabled child, all-miss and a four-hit node. The runner logs the descriptor, typed pointer, readback and first mismatch with the CPU candidate. ## Verification Tested commit `7e7fa40eceba735214574b705cd8163dd90bd699`. ```sh sh tests/gfx1030_bvh_box/build.sh python3 -B tests/gfx1030_bvh_box/check.py --model-only llvm-readelf-15 --notes out/native-gfx1030-bvh-box/box.hsaco python3 -B tests/docs_links_check.py python3 -B tests/bidi_controls_check.py python3 -B tests/form_coverage_check.py ``` LLVM and LLD 15 assembled and linked the code object, with one instance of each opcode in disassembly and 80-byte kernel argument segments. Code object SHA-256 `9b2e3470f1fef2cd5eea243097dc412d7b36601264d095eaf65c3f612ca796aa`. All five CPU ray witnesses and both mutation checks passed. The reversed sort first changes word 0 from `0000001d` to `00000025`. Substituting zero for the all-miss fill changes word 0 from `ffffffff` to `00000000`. The three Python regressions passed. `git diff --check origin/main...HEAD` and `git merge-tree --write-tree origin/main HEAD` passed against `71be6f0f5bec7729a259b8090dbb8374e22b3f9a`. A merge simulation with the comparison stack and #1587 produced the same tree with this probe applied first or last. ## Native capture Volunteers with a Linux HIP `gfx1030` adapter can post their readback in #1639. The draft awaits a Linux HIP run on a physical `gfx1030` adapter. Use `rocminfo` to confirm the target. Build the code object and select the corresponding HIP ordinal. ```sh python3 -B tests/gfx1030_bvh_box/check.py --device 0 ``` Please include the adapter target, driver and runtime, command, and all raw DWORDs in the report. The CPU candidate for miss and disabled slots requires native readback before it can be used to justify translator coverage. ## Windows host follow-up Reproduced the LLVM and LLD 15.0.7 build for `7e7fa40eceba735214574b705cd8163dd90bd699` in Ubuntu 24.04.4 on WSL2. The code object matched the SHA-256 above, disassembly showed one instance of each BVH opcode, and both kernels reported an 80-byte argument segment. `--model-only` passed all five CPU witnesses and both negative controls. The documentation link, bidi-control and form-coverage checks passed using the Windows development Python environment. The host runs Windows 11 build `26200.9974` with a Radeon RX 7900 XTX (`gfx1100`, Windows driver `32.0.32029.2010`). In its existing ROCm `7.2.1` WSL environment, `/opt/rocm/bin/rocminfo` reported `hsa_init Failed, possibly no supported GPU devices`, and `hipInit(0)` returned error `100` (`no ROCm-capable device is detected`). Native capture remains pending on a physical Linux HIP `gfx1030` adapter for all ten cases.
tedin7 commented 2026-11-25 04:03:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:54:47Z.

Review: COMMENTED


Review of head 7e7fa40eceba735214574b705cd8163dd90bd699 (read-only, comment only).

Status: needs a rebase before it can merge. GitHub reports CONFLICTING. A local git merge-tree origin/main HEAD shows a single content conflict, in docs/experiments.md (the new section sits next to text that changed on main). The code under tests/gfx1030_bvh_box/ merges cleanly.

Scope: 4 files, +378 (box.s, build.sh, check.py, docs section). The probe is a Linux HIP readback fixture. It changes no translator behavior and claims no form coverage. Title is neutral. CI is green on the checks that ran (Linux Python checks, gfx1013 fixtures, Windows build and test).

Commands executed locally in a worktree of the head SHA:

  • python3 tests/gfx1030_bvh_box/check.py --model-only: rc=0. The control lines match the doc (0000001d vs 00000025, ffffffff vs 00000000).
  • python3 tests/docs_links_check.py: pass (16 files, 348 links).
  • python3 tests/bidi_controls_check.py: pass (1264 files).
  • git diff --check origin/main...HEAD: clean.
  • sh tests/gfx1030_bvh_box/build.sh: not run to completion, llvm-mc-15 is not installed on this host. I did not verify the code object or the one-instruction-per-kind disassembly check. No gfx1030 device here, so native readback was not run (the doc says it is pending).
  • Mutation 1: removed the sort in reference(). --model-only fails (AssertionError: sorted ... (37, 29, ...) != (29, 37, ...)). Killed.
  • Mutation 2: changed near <= far and near < extent to near <= far. Still passes. This is nearly equivalent, because far starts at extent and is only lowered, so the two conditions differ only when near == extent exactly. No ray in RAYS lands on that boundary.

Findings:

  • P1: none.
  • P2: none.
  • Nit (check.py RAYS): add one ray whose box entry distance equals the extent exactly. Then the near < extent strictness is pinned, and it becomes a useful hardware question (is the clip inclusive or not).
  • Nit (check.py, kernarg): the <4IQ8xQ10f layout relies on < having no padding. A one-line comment with the offsets (descriptor 0x00, output 0x10, node 0x20, floats 0x28) would help. I checked that it matches the s_load offsets in box.s (node in s12:13, extent s14, origin s15:17, dir s18:20, inverse dir s21:23, and the 32-bit form packs them contiguously).
  • Nit (docs): "The CPU witnesses and mutations pass independently" is a little vague. Say that the model-only check runs without hardware.

Operand order, descriptor fields and the 32-bit/64-bit pointer encoding look consistent with the cited RDNA 2 tables and Mesa reference. I could not confirm hardware behavior, which the PR itself states is pending.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6051631085 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1623#pullrequestreview-6051631085). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T03:54:47Z. **Review:** COMMENTED --- Review of head `7e7fa40eceba735214574b705cd8163dd90bd699` (read-only, comment only). **Status: needs a rebase before it can merge.** GitHub reports `CONFLICTING`. A local `git merge-tree origin/main HEAD` shows a single content conflict, in `docs/experiments.md` (the new section sits next to text that changed on main). The code under `tests/gfx1030_bvh_box/` merges cleanly. Scope: 4 files, +378 (`box.s`, `build.sh`, `check.py`, docs section). The probe is a Linux HIP readback fixture. It changes no translator behavior and claims no form coverage. Title is neutral. CI is green on the checks that ran (Linux Python checks, gfx1013 fixtures, Windows build and test). Commands executed locally in a worktree of the head SHA: - `python3 tests/gfx1030_bvh_box/check.py --model-only`: rc=0. The control lines match the doc (`0000001d` vs `00000025`, `ffffffff` vs `00000000`). - `python3 tests/docs_links_check.py`: pass (16 files, 348 links). - `python3 tests/bidi_controls_check.py`: pass (1264 files). - `git diff --check origin/main...HEAD`: clean. - `sh tests/gfx1030_bvh_box/build.sh`: not run to completion, `llvm-mc-15` is not installed on this host. I did not verify the code object or the one-instruction-per-kind disassembly check. No gfx1030 device here, so native readback was not run (the doc says it is pending). - Mutation 1: removed the sort in `reference()`. `--model-only` fails (`AssertionError: sorted ... (37, 29, ...) != (29, 37, ...)`). Killed. - Mutation 2: changed `near <= far and near < extent` to `near <= far`. Still passes. This is nearly equivalent, because `far` starts at `extent` and is only lowered, so the two conditions differ only when `near == extent` exactly. No ray in `RAYS` lands on that boundary. Findings: - P1: none. - P2: none. - Nit (check.py `RAYS`): add one ray whose box entry distance equals the extent exactly. Then the `near < extent` strictness is pinned, and it becomes a useful hardware question (is the clip inclusive or not). - Nit (check.py, `kernarg`): the `<4IQ8xQ10f` layout relies on `<` having no padding. A one-line comment with the offsets (descriptor 0x00, output 0x10, node 0x20, floats 0x28) would help. I checked that it matches the `s_load` offsets in `box.s` (node in s12:13, extent s14, origin s15:17, dir s18:20, inverse dir s21:23, and the 32-bit form packs them contiguously). - Nit (docs): "The CPU witnesses and mutations pass independently" is a little vague. Say that the model-only check runs without hardware. Operand order, descriptor fields and the 32-bit/64-bit pointer encoding look consistent with the cited RDNA 2 tables and Mesa reference. I could not confirm hardware behavior, which the PR itself states is pending. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 06:01:01 +00:00
tedin7 commented 2026-11-25 06:01:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:25:31Z.

Review: COMMENTED


Re-review of head 4b0c69c35a338af57f642b1f62ae84e73e97e8d7 (read-only, comment only).

Status: the earlier conflict is resolved. The head is a merge of main into the branch. git merge-tree --write-tree origin/main HEAD now exits 0 (clean). Files under tests/gfx1030_bvh_box/ are byte-identical to the previously reviewed head 7e7fa40e. Only the merge with main changed. Scope is still 4 files, +378. Title is neutral. CI on this head: Linux Python checks, gfx1013 fixtures and Windows build/test pass. The coverage chart job and the /O2 job are skipped.

Commands executed locally in a worktree of this head:

  • python3 tests/gfx1030_bvh_box/check.py --model-only: rc=0. Control lines match the doc (0000001d vs 00000025, ffffffff vs 00000000).
  • python3 tests/docs_links_check.py: pass (18 files, 407 links).
  • python3 tests/bidi_controls_check.py: pass (1489 files).
  • git diff --check origin/main...HEAD: clean.
  • git merge-tree --write-tree origin/main HEAD: rc=0.
  • Mutation 1: removed the sort in reference(). --model-only fails (('sorted', (37, 29, ...), (29, 37, ...))). Killed.
  • Mutation 2: near <= far and near < extent changed to near <= far. Still passes (rc=0). far starts at extent, so the two differ only when entry distance equals the extent exactly. No ray in RAYS hits that boundary. Survived.
  • Not run: build.sh (no llvm-mc-15 here), so the code object and the one-instruction-per-kind disassembly check are unverified by me. No gfx1030 device here, so native readback is not run (the doc says it is pending). Win2025 WARP is not relevant: no translator or shader code changes.

Findings:

  • P1: none.
  • P2: none.
  • Nit (check.py RAYS): add a ray whose entry distance equals the extent. That pins the near < extent strictness and gives the hardware run a useful question (is the clip inclusive?).
  • Nit (check.py kernarg): a one-line comment with the offsets (descriptor 0x00, output 0x10, node 0x20, floats 0x28) would help.
  • Nit (docs): "The CPU witnesses and mutations pass independently" could say plainly that the model-only check runs without hardware.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052273887 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1623#pullrequestreview-6052273887). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T05:25:31Z. **Review:** COMMENTED --- Re-review of head `4b0c69c35a338af57f642b1f62ae84e73e97e8d7` (read-only, comment only). **Status: the earlier conflict is resolved.** The head is a merge of main into the branch. `git merge-tree --write-tree origin/main HEAD` now exits 0 (clean). Files under `tests/gfx1030_bvh_box/` are byte-identical to the previously reviewed head `7e7fa40e`. Only the merge with main changed. Scope is still 4 files, +378. Title is neutral. CI on this head: Linux Python checks, gfx1013 fixtures and Windows build/test pass. The coverage chart job and the /O2 job are skipped. Commands executed locally in a worktree of this head: - `python3 tests/gfx1030_bvh_box/check.py --model-only`: rc=0. Control lines match the doc (`0000001d` vs `00000025`, `ffffffff` vs `00000000`). - `python3 tests/docs_links_check.py`: pass (18 files, 407 links). - `python3 tests/bidi_controls_check.py`: pass (1489 files). - `git diff --check origin/main...HEAD`: clean. - `git merge-tree --write-tree origin/main HEAD`: rc=0. - Mutation 1: removed the sort in `reference()`. `--model-only` fails (`('sorted', (37, 29, ...), (29, 37, ...))`). Killed. - Mutation 2: `near <= far and near < extent` changed to `near <= far`. Still passes (rc=0). `far` starts at `extent`, so the two differ only when entry distance equals the extent exactly. No ray in `RAYS` hits that boundary. Survived. - Not run: `build.sh` (no `llvm-mc-15` here), so the code object and the one-instruction-per-kind disassembly check are unverified by me. No gfx1030 device here, so native readback is not run (the doc says it is pending). Win2025 WARP is not relevant: no translator or shader code changes. Findings: - P1: none. - P2: none. - Nit (check.py `RAYS`): add a ray whose entry distance equals the extent. That pins the `near < extent` strictness and gives the hardware run a useful question (is the clip inclusive?). - Nit (check.py `kernarg`): a one-line comment with the offsets (descriptor 0x00, output 0x10, node 0x20, floats 0x28) would help. - Nit (docs): "The CPU witnesses and mutations pass independently" could say plainly that the model-only check runs without hardware. AI-assisted; commands listed were executed locally.
stan495 commented 2026-11-25 06:01:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-25T05:34:39Z.


Rebased/merged current main (ab9a020c) at 4b0c69c3 to resolve the single content conflict in docs/experiments.md.

Verified locally on 4b0c69c3:

  • python -B tests/gfx1030_bvh_box/check.py --model-only -> passed (sorted and all_miss controls reported expected differences)
  • python -B tests/docs_links_check.py -> passed (18 Markdown files, 407 links)
  • python -B tests/bidi_controls_check.py -> passed (1,489 tracked files)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7153917483 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1623#issuecomment-7153917483). Originally posted by [stan495](https://github.com/stan495) on 2026-11-25T05:34:39Z. --- Rebased/merged current `main` (`ab9a020c`) at `4b0c69c3` to resolve the single content conflict in `docs/experiments.md`. Verified locally on `4b0c69c3`: - `python -B tests/gfx1030_bvh_box/check.py --model-only` -> passed (`sorted` and `all_miss` controls reported expected differences) - `python -B tests/docs_links_check.py` -> passed (18 Markdown files, 407 links) - `python -B tests/bidi_controls_check.py` -> passed (1,489 tracked files)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1616
No description provided.