Skip to content

Tests: heap probes for aliased buffers and timestamp queries - #1328

Open
vakaobr wants to merge 1 commit into
xcl-dev:mainfrom
vakaobr:tests/heap-probes
Open

vakaobr wants to merge 1 commit into
xcl-dev:mainfrom
vakaobr:tests/heap-probes

Conversation

@vakaobr

@vakaobr vakaobr commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Part of #258. Two probes from Ahmet-Dedeler's c70bf8a that check what the unified memory copy path relies on: that buffers placed over the same video memory see each other's writes, and how timestamp queries resolve into committed and reserved buffers. Like the other tests in heap_probe.rs, they are #[ignore] probes that print what the host does; run them with --ignored.

Based on Ahmet-Dedeler's c70bf8a on mac-on-main-wip ("Unified memory without OpenExistingHeapFromAddress: the committed window gets a copy in video memory"), which he handed over in #258 (comment). Rebased onto main 930e8b4 and split into four PRs.

What is in it

  • crates/xcl/tests/heap_probe.rs: buffers_over_the_same_video_memory_alias (placed buffers over one heap, and reserved buffers whose tiles map to one pool tile) and timestamp_query_resolved_into_committed_and_reserved_buffers.

Tested

  • MacBook Pro M5 Pro (20-core GPU), 48 GB, macOS 27.2.1, CrossOver 26.3.0.39832 with D3DMetal 3.0 ("AMD Compatibility Mode"), Rosetta 2. Rust 1.100.0, x86_64-pc-windows-gnu (mingw-w64 GCC 16.2.0), debug, DXC 1.9.2609. Each test in its own process (<test exe> --exact <test> --test-threads=1 --nocapture).
  • Head a146528, --ignored: both pass. The aliasing probe prints true for placed and for reserved buffers; the timestamp probe prints a frequency of 60 and a resolved value of 0x0 (D3DMetal's timestamps, see [removed by author] #996).
  • Independent run at this head: NVIDIA RTX 5070 Ti and the AMD Radeon iGPU of a Ryzen 9800X3D (RDNA2), Windows 11, debug, cargo test --workspace -- --test-threads=4: 751 passed, 0 failed, 43 ignored on both; with --ignored all 6 probes in the file pass, the aliasing probe printing true for both cases and the timestamp probe a frequency of 1 GHz and non-zero timestamps (@futurepro62, Tests: heap probes for aliased buffers and timestamp queries #1328 (comment)).

Regression run

Test-only change in crates/xcl/tests/: no xcl-smoke blocks.

Not tested

  • Windows by me (see the independent run above).

AI use

  • Claude Code with Claude Opus 4.6 ported the probes from c70bf8a. Claude Code with Claude Opus 5.5 reviewed them, ran them on this machine and wrote this description.

Two new #[ignore] integration tests that validate what the UMA copy
path relies on:

- buffers_over_the_same_video_memory_alias: two placed buffers over
  one default heap see each other's writes, and two reserved buffers
  whose tile maps to the same pool tile do too. Console buffers in the
  committed window's copy, and title buffers in a sparse window, depend
  on this aliasing.

- timestamp_query_resolved_into_committed_and_reserved_buffers: a
  timestamp query resolved into a committed buffer and into a tile of a
  reserved one both produce a value.

Based on Ahmet-Dedeler's c70bf8a on mac-on-main-wip.

Co-authored-by: Ahmet Dedeler <105894172+Ahmet-Dedeler@users.noreply.github.com>
Assisted-by: Claude Code (Claude Opus 4.6 ported it; Claude Opus 5.5 reviewed it)
@futurepro62

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head a146528 (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 751 passed, 0 failed, 43 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 751 passed, 0 failed, 43 ignored, no skips.
  • The two new probes are #[ignore], so I ran them explicitly with cargo test -p xcl --test heap_probe -- --ignored --nocapture --test-threads=1 (all 6 probes in the file: 6 passed). buffers_over_the_same_video_memory_alias: "placed buffers over each other in one heap: written through the whole one, read through the part: true" and "two reserved buffers on one pool tile: written through the window, read through the other: true". timestamp_query_resolved_into_committed_and_reserved_buffers: frequency 1000000000, a non-zero timestamp resolved into both the committed and the reserved buffer.
  • The probes run on the NVIDIA card only: heap_probe.rs creates its device with D3D12CreateDevice(None, ...), so XCL_ADAPTER=radeon does not reach them (a run with it printed the same adapter-specific values).

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@WASDeKeys

Copy link
Copy Markdown

im trying to run a test only pr too, but my pr is getting flagged on the smoke check thing. How did you pass the checks without smoke test?

@vakaobr

vakaobr commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@WASDeKeys: scripts/pr_check.py asks for the smoke pair only when the PR changes a runtime file: a path under crates/xcl/src/ that neither contains /tests nor ends in tests.rs. This PR only touches crates/xcl/tests/heap_probe.rs, so the check passes without one. If your test-only change sits in a runtime file (a #[cfg(test)] mod tests inside, say, present.rs), the check treats it as runtime: either move the test into the module's tests.rs or crates/xcl/tests/ if it fits there, or get a smoke pair (#957 got one from mikebuckets171 in #258). The test-only label that CONTRIBUTING mentions would waive it, but it doesn't exist in the repo yet.

AI use: Claude Code, Claude Opus 5.5 drafted this reply.

@JoaoPauluu

Copy link
Copy Markdown

The probes on Linux with vkd3d-proton (NVIDIA), next to the D3DMetal and Windows runs.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. a146528 as it is (based on 930e8b4), no uncommitted changes. The test binary runs under Wine, each probe in its own process (--exact <test> --ignored --nocapture --test-threads=1).
  • All 6 probes in heap_probe.rs pass.
  • buffers_over_the_same_video_memory_alias: placed buffers over each other in one heap: written through the whole one, read through the part: true, two reserved buffers on one pool tile: written through the window, read through the other: true.
  • timestamp_query_resolved_into_committed_and_reserved_buffers: timestamp frequency: Ok(1000000000), resolved into a committed buffer 0x18eb03b650604400, into a reserved buffer 0x18eb03b650620000. So here the timestamps are real, nanosecond values, unlike D3DMetal's 0x0 ([removed by author] #996).
  • Without --ignored the six are reported ignored, as intended. I did not run the probes on main.

Not tested

  • the rest of the suite on this head; native Windows; AMD.

AI use

  • Claude Code (Claude Opus 5.5) built the commits, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 708 passed, 0 failed, 21 ignored.

Thanks!

@WASDeKeys

Copy link
Copy Markdown

@WASDeKeys: scripts/pr_check.py asks for the smoke pair only when the PR changes a runtime file: a path under crates/xcl/src/ that neither contains /tests nor ends in tests.rs. This PR only touches crates/xcl/tests/heap_probe.rs, so the check passes without one. If your test-only change sits in a runtime file (a #[cfg(test)] mod tests inside, say, present.rs), the check treats it as runtime: either move the test into the module's tests.rs or crates/xcl/tests/ if it fits there, or get a smoke pair (#957 got one from mikebuckets171 in #258). The test-only label that CONTRIBUTING mentions would waive it, but it doesn't exist in the repo yet.

AI use: Claude Code, Claude Opus 5.5 drafted this reply.

@vakaobr so if my pr changes in vram.rs, and it is a runtime file, but only a test chage, theres no way to get the pr approved

@ivall ivall added the off-goal Does not bear on the current goal (world loading); waits until it is reached label Nov 24, 2026
@github-actions

Copy link
Copy Markdown

Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

@github-actions github-actions Bot added the stale No activity for 3 days; closed 4 days later unless something happens label Nov 28, 2026
@vakaobr

vakaobr commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Still waiting for a maintainer. Test-only heap probes, ignored by default; it merges cleanly with main.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head a146528

The only other branch that adds these two probes (buffers_over_the_same_video_memory_alias, timestamp_query_resolved_into_committed_and_reserved_buffers) is #980, and #980 is closed. Main's heap_probe.rs does not have them. They follow the file's existing #[ignore] probe style and only change test code. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

@grathepic

Copy link
Copy Markdown

merge-check
base: 078358a
head: a146528
merge: clean (git diff --check origin/main..HEAD clean)
build: cargo +1.98.1-x86_64-pc-windows-msvc build --offline --locked --workspace -> ok
tests: cargo +1.98.1-x86_64-pc-windows-msvc test --offline --locked --workspace --no-fail-fast -- --test-threads=4 (with XCL_DXC_DIR=C:\VulkanSDK\1.4.363.0\Bin, XCL_SAMPLE_* unset) -> 3006 passed, 0 failed, 54 ignored across 44 harnesses (6 ignored in heap_probe.rs); SKIPPED: 27 notices (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps, 1 no dxil.dll, 1 cannot disable the driver cache (Windows Developer Mode required)); failing: none. Explicit probe run cargo +1.98.1-x86_64-pc-windows-msvc test --offline --locked -p xcl --test heap_probe -- --ignored --nocapture --test-threads=1 -> 6 passed, 0 failed, 0 ignored: buffers_over_the_same_video_memory_alias printed true for both placed-buffer aliasing and two reserved buffers mapped to one pool tile; timestamp_query_resolved_into_committed_and_reserved_buffers printed timestamp frequency: Ok(1000000000) and non-zero resolved timestamps for both committed (0x18ed9220dd2d5400) and reserved (0x18ed9220dd4a2000) buffers.
title run: none (Tier 0 test-only diff in crates/xcl/tests/heap_probe.rs, #[ignore] manual probes)
review: Full single-commit diff read (+126/-0, crates/xcl/tests/heap_probe.rs). Both probes follow the file's #[ignore] diagnostic pattern; queue ordering (UpdateTileMappings -> gpu_copy, ResolveQueryData -> gpu_copy), D3D12 buffer implicit state promotion/decay, and command list/allocator lifetimes across gpu_copy's fence wait are sound. Non-blocking note: these two probes predate #2881 and call D3D12CreateDevice(None, D3D_FEATURE_LEVEL_12_0, ...) directly instead of main's probe_device(), so they do not yet honor XCL_ADAPTER, print the adapter/LUID banner, or call skip_test on device failure (a small follow-up if desired). Untested: AMD/Intel GPUs and multi-GPU XCL_ADAPTER selection.
performance: none (#[ignore] integration probes only; no runtime path changed)
verdict: safe to merge (clean merge, full workspace suite passes with 0 failures on NVIDIA RTX 3080, all 6 --ignored probes pass with expected aliasing and timestamp outputs, and diff is strictly test-only)
hardware / tool and model: NVIDIA GeForce RTX 3080 (driver 32.0.16.2140), AMD Ryzen 7 5800X3D, Windows 11 (10.0.26300.0), Rust 1.98.1-x86_64-pc-windows-msvc, DXC 1.9.0.5512 (VulkanSDK, no dxil.dll) / Antigravity, Gemini 4 Neon

@github-actions github-actions Bot added area:tests Unit, integration, e2e tests, or testtitle needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Dec 2, 2026
@Pipodi

Pipodi commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: 078358a
head: a146528
merge: clean (git merge --no-ff onto 078358a, merge cfc4ba6e; crates/xcl/tests/heap_probe.rs +126)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3006 passed, 0 failed, 54 ignored; failing: none (SKIPPED 25: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache). The two new probes are #[ignore] (52 ignored on main, 54 here). Run explicitly, cargo test -p xcl --test heap_probe -- --ignored --nocapture --test-threads=1 -> 6 passed, 0 failed: buffers_over_the_same_video_memory_alias printed true for the placed buffers and for the two reserved buffers on one pool tile; timestamp_query_resolved_into_committed_and_reserved_buffers printed frequency 1000000000 and non-zero timestamps in the committed and in the reserved buffer.
title run: none (test-only change in crates/xcl/tests, no file under crates/xcl/src)
review: read the whole diff. No blocking findings. 1) Minor, agreeing with the first check: the two new probes open their device with D3D12CreateDevice(None, ...) and return silently on failure, where the file's other probes now go through probe_device() (honours XCL_ADAPTER, prints the adapter, calls skip_test); on a multi-adapter machine they may probe a different GPU than the rest of the file, and a missing device passes without a SKIPPED line. 2) The probes print their results and assert nothing, like the rest of the file, so they document behaviour rather than guard it; fine for #[ignore] probes. 3) Checked the D3D12 use: buffers in COMMON are implicitly promoted to COPY_DEST/COPY_SOURCE and decay between ExecuteCommandLists, the tile mappings are queued before the copies on the same queue, the timestamp list's allocator outlives its execution (dropped after gpu_copy's fence on the same queue), and the read-back offset (u64 index 2) matches the resolve at offset + 16. The aliased placed buffers are used in separate submissions with a fence wait between them, so no aliasing barrier is needed for buffers.
performance: none (#[ignore] probes in an integration test; nothing in the runtime changes)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4090 24 GB, driver 621.40; Intel Core i9-13900K, 32 GB; Windows 11 build 26300; rustc 1.100.0, debug; Claude Code, Claude Opus 5.5

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tests Unit, integration, e2e tests, or testtitle off-goal Does not bear on the current goal (world loading); waits until it is reached ready-to-merge Has 2 independent safe merge-checks on current head (#3041) stale No activity for 3 days; closed 4 days later unless something happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants