D3D12.X: page_owners counts the pages a lazy texture holds by level #3309

Open
grahamster2 wants to merge 1 commit from upstream-pr/3309 into main
grahamster2 commented 2026-11-29 06:54:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by grahamster2 on 2026-11-29T06:54:51Z.


The activity line "target pages by owner: … N sampled textures with pages by level hold M MB" summed Target::used. A texture with lazy levels leaves that empty: it holds its pages by group in Levels::group_tiles (map_levels), so the line always said 0 MB for them. Now both are counted. This is a diagnostics-only change to the line added in #2896.

No issue.

Seen in two runs of a retail title on this machine, on a development build (main plus other changes) with XCL_TEXTURE_LEVEL_PAGES=1, which gives sampled textures pages by level. Without this fix (xcl.log):

[  235.342][27976][INFO ] target pages by owner: 1529 textures with all their pages hold 2031 MB, 70417 sampled textures with pages by level hold 0 MB (a shared page counts for each); 4174 MB of pages in all, 4 MB of them idle

With it (same run setup, a later run):

[  217.913][10120][INFO ] target pages by owner: 2531 textures with all their pages hold 2280 MB, 70405 sampled textures with pages by level hold 2722 MB (a shared page counts for each); 4372 MB of pages in all, 3 MB of them idle

What is in it

  • crates/xcl/src/hle/d3d12x/vram.rs: held_pages(&Target) counts used, used_extra and the level groups' pages; page_owners uses it. Test page_owners_counts_the_pages_a_texture_holds_by_level fails without the change (checked by leaving out the level groups).

Tested

  • NVIDIA GeForce RTX 3080 10 GB, driver 610.88; AMD Ryzen 5 7600X; Windows 11 build 10.0.26200.9974; rustc 1.94.0 (4a4ef493e 2026-03-02); tests in the debug profile, smoke runs on a release build (cargo build --release -p xcl)
  • on 494aa53dd1c45fb8f0487baa468ac1eec2eea909: cargo build --workspace ok; cargo test --workspace -- --test-threads=4: 2609 passed, 0 failed, 49 ignored
  • 29 SKIPPED lines on this adapter (no wave64 on NVIDIA, no heap windows, no D3D12 debug layer):
    • SKIPPED gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole: no wave64
    • SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu: const_mask, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: f64, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu: mask_ff0_flbit, wave64: no wave64
    • SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
    • SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
    • SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
    • SKIPPED hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap: no heap windows (opt-in: XCL_HEAP_WINDOWS=1)
    • SKIPPED the title under the debug layer (dred: false): no d3d12SDKLayers.dll
    • SKIPPED the title under the debug layer (dred: true): no d3d12SDKLayers.dll
    • SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))

Regression run

  • scripts/smoke.ps1 -Game <title folder> -Seconds 60 -StartupTimeoutSeconds 900 with XCL_DEVICE_TYPE=lockhart XCL_PREPARE=0 (Series S mode as in the contributor's runs; no startup shader preparation, so pipelines are built in game) (smoke.ps1 sets XCL_NETWORK=0); same retail title, same settings for both runs. Both stay on the title's first screens (about 660 draws per 2 s) for the 60 s.

main:

xcl-smoke v1
commit: fa204595a488c60c6c5f905244f0172072c9c2a9
gpu: NVIDIA GeForce RTX 3080
title: 5d6132ca
seconds: 60
exit: 0x0
frames shown: 1680 (PresentX 1680)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 12321 MB

this PR's head:

xcl-smoke v1
commit: 494aa53dd1c45fb8f0487baa468ac1eec2eea909
gpu: NVIDIA GeForce RTX 3080
title: 5d6132ca
seconds: 60
exit: 0x0
frames shown: 1674 (PresentX 1674)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 12310 MB

Not tested

  • The two runs quoted above were development builds, not this PR's head. The smoke runs do not set XCL_TEXTURE_LEVEL_PAGES=1, so no texture there holds its pages by level and the value on the activity line is not exercised by them.
  • page_owners() itself has no test (it reads the global page registry); the test covers held_pages, the count it now sums.
  • AMD GPUs, other titles.

AI use

  • Claude Code with Claude Opus 5.5: wrote the code and tests, ran the tests and smoke runs, drafted this description. A separate Claude Code agent that did not write the change reviewed the diff adversarially and its findings were fixed before opening.
<!-- greyfinch-sync:ivall/xcl:issue:5548425421 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3309). Originally posted by [grahamster2](https://github.com/grahamster2) on 2026-11-29T06:54:51Z. --- The activity line "target pages by owner: … N sampled textures with pages by level hold M MB" summed `Target::used`. A texture with lazy levels leaves that empty: it holds its pages by group in `Levels::group_tiles` (`map_levels`), so the line always said 0 MB for them. Now both are counted. This is a diagnostics-only change to the line added in #2896. No issue. Seen in two runs of a retail title on this machine, on a development build (main plus other changes) with `XCL_TEXTURE_LEVEL_PAGES=1`, which gives sampled textures pages by level. Without this fix (`xcl.log`): ``` [ 235.342][27976][INFO ] target pages by owner: 1529 textures with all their pages hold 2031 MB, 70417 sampled textures with pages by level hold 0 MB (a shared page counts for each); 4174 MB of pages in all, 4 MB of them idle ``` With it (same run setup, a later run): ``` [ 217.913][10120][INFO ] target pages by owner: 2531 textures with all their pages hold 2280 MB, 70405 sampled textures with pages by level hold 2722 MB (a shared page counts for each); 4372 MB of pages in all, 3 MB of them idle ``` **What is in it** - `crates/xcl/src/hle/d3d12x/vram.rs`: `held_pages(&Target)` counts `used`, `used_extra` and the level groups' pages; `page_owners` uses it. Test `page_owners_counts_the_pages_a_texture_holds_by_level` fails without the change (checked by leaving out the level groups). **Tested** - NVIDIA GeForce RTX 3080 10 GB, driver 610.88; AMD Ryzen 5 7600X; Windows 11 build 10.0.26200.9974; rustc 1.94.0 (4a4ef493e 2026-03-02); tests in the debug profile, smoke runs on a release build (`cargo build --release -p xcl`) - on `494aa53dd1c45fb8f0487baa468ac1eec2eea909`: `cargo build --workspace` ok; `cargo test --workspace -- --test-threads=4`: 2609 passed, 0 failed, 49 ignored - 29 `SKIPPED` lines on this adapter (no wave64 on NVIDIA, no heap windows, no D3D12 debug layer): - `SKIPPED gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole: no wave64` - `SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64` - `SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64` - `SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64` - `SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu: const_mask, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))` - `SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))` - `SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: f64, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu: mask_ff0_flbit, wave64: no wave64` - `SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64` - `SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` - `SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows` - `SKIPPED hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap: no heap windows (opt-in: XCL_HEAP_WINDOWS=1)` - `SKIPPED the title under the debug layer (dred: false): no d3d12SDKLayers.dll` - `SKIPPED the title under the debug layer (dred: true): no d3d12SDKLayers.dll` - `SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))` **Regression run** - `scripts/smoke.ps1 -Game <title folder> -Seconds 60 -StartupTimeoutSeconds 900` with `XCL_DEVICE_TYPE=lockhart XCL_PREPARE=0` (Series S mode as in the contributor's runs; no startup shader preparation, so pipelines are built in game) (smoke.ps1 sets `XCL_NETWORK=0`); same retail title, same settings for both runs. Both stay on the title's first screens (about 660 draws per 2 s) for the 60 s. main: ``` xcl-smoke v1 commit: fa204595a488c60c6c5f905244f0172072c9c2a9 gpu: NVIDIA GeForce RTX 3080 title: 5d6132ca seconds: 60 exit: 0x0 frames shown: 1680 (PresentX 1680) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 12321 MB ``` this PR's head: ``` xcl-smoke v1 commit: 494aa53dd1c45fb8f0487baa468ac1eec2eea909 gpu: NVIDIA GeForce RTX 3080 title: 5d6132ca seconds: 60 exit: 0x0 frames shown: 1674 (PresentX 1674) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 12310 MB ``` **Not tested** - The two runs quoted above were development builds, not this PR's head. The smoke runs do not set `XCL_TEXTURE_LEVEL_PAGES=1`, so no texture there holds its pages by level and the value on the activity line is not exercised by them. - `page_owners()` itself has no test (it reads the global page registry); the test covers `held_pages`, the count it now sums. - AMD GPUs, other titles. **AI use** - Claude Code with Claude Opus 5.5: wrote the code and tests, ran the tests and smoke runs, drafted this description. A separate Claude Code agent that did not write the change reviewed the diff adversarially and its findings were fixed before opening.
andrewDoing commented 2026-11-29 07:54:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-29T07:54:50Z.


Checked the live page_owners() line on 494aa53d with an RTX 5070, driver 616.92 and XCL_TEXTURE_LEVEL_PAGES=1. Each fresh process placed two lazy 1024×1024 RGBA8 textures with 11 mips. For each texture, mapping mip 10 acquired one packed-tail tile. Requesting mips 9 and 10 again acquired none and preserved that tile identity. Mapping mip 0 then added 64 tiles. I waited for the D3D12 mapping fence and compared the live report with the pool/tile IDs held by each resource.

Placement of the second texture Shared tile IDs Distinct tile IDs / page-registry entries Owner line Pages-in-all line
Same address 65 65 / 65 8 MB 4 MB
8 pages later 56 74 / 74 8 MB 4 MB
Disjoint 0 130 / 130 8 MB 8 MB

The two owner counts sum to 130 × 64 KiB (8.125 MiB) in every case. Unique backing was 4.0625, 4.625 and 8.125 MiB respectively; the diagnostic truncates to whole MiB. This explains why complete and partial sharing can print the same total. The registry showed zero idle pages throughout. Three tests passed with zero skips. These are XCL mapping identities and accounting, not a measurement of DXGI residency, title behavior or texture contents.

AI disclosure: OpenAI Codex prepared and ran the fixture and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7252768212 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3309#issuecomment-7252768212). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-29T07:54:50Z. --- Checked the live `page_owners()` line on `494aa53d` with an RTX 5070, driver 616.92 and `XCL_TEXTURE_LEVEL_PAGES=1`. Each fresh process placed two lazy 1024×1024 RGBA8 textures with 11 mips. For each texture, mapping mip 10 acquired one packed-tail tile. Requesting mips 9 and 10 again acquired none and preserved that tile identity. Mapping mip 0 then added 64 tiles. I waited for the D3D12 mapping fence and compared the live report with the pool/tile IDs held by each resource. | Placement of the second texture | Shared tile IDs | Distinct tile IDs / page-registry entries | Owner line | Pages-in-all line | |---|---:|---:|---:|---:| | Same address | 65 | 65 / 65 | 8 MB | 4 MB | | 8 pages later | 56 | 74 / 74 | 8 MB | 4 MB | | Disjoint | 0 | 130 / 130 | 8 MB | 8 MB | The two owner counts sum to 130 × 64 KiB (8.125 MiB) in every case. Unique backing was 4.0625, 4.625 and 8.125 MiB respectively; the diagnostic truncates to whole MiB. This explains why complete and partial sharing can print the same total. The registry showed zero idle pages throughout. Three tests passed with zero skips. These are XCL mapping identities and accounting, not a measurement of DXGI residency, title behavior or texture contents. AI disclosure: OpenAI Codex prepared and ran the fixture and drafted this report.
Foniass commented 2026-11-29 14:57:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T14:57:57Z.


merge-check
base: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0
head: 494aa53dd1c45fb8f0487baa468ac1eec2eea909
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2615 passed, 4 failed, 49 ignored; SKIPPED: 44; failing: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (driver E_OUTOFMEMORY, same on base on this machine)
review: diagnostics only: held_pages adds the level pages a lazy texture holds. No bug found. The test covers the helper, not page_owners' log line.
performance: 60 s smoke: 1680 frames (100.5 %), peak commit 17330 MB (96.6 %)
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti (driver 32.0.16.2114), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

Merge-check run and written with Claude Code (Claude Opus 5.5): a test merge onto the base above, the full suite, and a 60 s scripts/smoke.ps1 run of a retail title against main on the same machine. The 4 fuzz_validate_and_gpu_* failures happen on main on this machine too.

<!-- greyfinch-sync:ivall/xcl:comment:7257713425 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3309#issuecomment-7257713425). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T14:57:57Z. --- ```text merge-check base: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0 head: 494aa53dd1c45fb8f0487baa468ac1eec2eea909 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2615 passed, 4 failed, 49 ignored; SKIPPED: 44; failing: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (driver E_OUTOFMEMORY, same on base on this machine) review: diagnostics only: held_pages adds the level pages a lazy texture holds. No bug found. The test covers the helper, not page_owners' log line. performance: 60 s smoke: 1680 frames (100.5 %), peak commit 17330 MB (96.6 %) verdict: safe to merge hardware / tool and model: RTX 5070 Ti (driver 32.0.16.2114), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 ``` Merge-check run and written with Claude Code (Claude Opus 5.5): a test merge onto the base above, the full suite, and a 60 s `scripts/smoke.ps1` run of a retail title against main on the same machine. The 4 `fuzz_validate_and_gpu_*` failures happen on main on this machine too.
tiagonleal commented 2026-11-30 21:20:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-30T21:20:55Z.


merge-check
base: ff0c364b3d
head: 494aa53dd1
merge: clean
build: cargo build --workspace -> ok (also cargo build --release -p xcl)
tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2890 passed, 0 failed, 51 ignored; SKIPPED: 24 lines (22 "no wave64", 2 "no heap windows", one of them the opt-in XCL_HEAP_WINDOWS=1 one); failing: none. The new test page_owners_counts_the_pages_a_texture_holds_by_level passes, and with the level groups left out of held_pages (+ 0 * by_level) it fails ("pages by level count", left 0, right 3), so it tests the change.
review: whole diff read (+31/-1, vram.rs). held_pages adds the pages in Levels::group_tiles to used and used_extra. That is the same set the existing test helper target_page_keys treats as a texture's pages, and map_levels is where a lazy texture's pages go (group_tiles[k].0/.1.extend), so the count is right. A page shared by several textures still counts once for each of them; the line already says so ("a shared page counts for each"), and the "MB of pages in all" total is unchanged, so nothing is counted twice that the line does not announce. Each used_extra entry is one page, so len() is the right count. page_owners already held the PAGES lock for the whole walk; the change only adds a walk over each lazy texture's groups under that lock, once per activity line. It is diagnostics only: no behaviour or allocation changes.
performance: scripts/smoke.ps1, 60 s of a retail title, release, after one warm-up run of the base: 1696 frames, 18399 MB peak commit against 1696 frames, 18303 MB on the base (warm-up: 1689, 16791 MB). No device removal, no crash. The smoke does not set XCL_TEXTURE_LEVEL_PAGES=1, so it has no lazy textures and the line reads the same on both (0 sampled textures by level). The changed path was run in world runs with XCL_TEXTURE_LEVEL_PAGES=1 (release, 16 UMA windows, RAM guard; all of them, base included, were stopped by the RAM guard at 70-96 s, about world entry, so they say nothing about frame time). At the last line before the stop, base: "88364 sampled textures with pages by level hold 0 MB" and "85813 ... hold 0 MB" (2 runs); this PR: "78099 sampled textures with pages by level hold 3212 MB" (1 run that got that far), with 5663 MB of target pages in all. The textures with all their pages (3353 MB) plus those by level (3212 MB) come to more than the 5663 MB in all, as expected when shared pages count for each owner. Commit and video at that point were within the run-to-run spread of the base.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5 ran the build, suite, tests, smoke and world runs, reviewed the diff against the merged source and wrote this)

  • Tiago
<!-- greyfinch-sync:ivall/xcl:comment:7292274272 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3309#issuecomment-7292274272). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-30T21:20:55Z. --- merge-check base: ff0c364b3de011c13ed45865480c21918a79ec89 head: 494aa53dd1c45fb8f0487baa468ac1eec2eea909 merge: clean build: cargo build --workspace -> ok (also `cargo build --release -p xcl`) tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2890 passed, 0 failed, 51 ignored; SKIPPED: 24 lines (22 "no wave64", 2 "no heap windows", one of them the opt-in `XCL_HEAP_WINDOWS=1` one); failing: none. The new test `page_owners_counts_the_pages_a_texture_holds_by_level` passes, and with the level groups left out of `held_pages` (`+ 0 * by_level`) it fails ("pages by level count", left 0, right 3), so it tests the change. review: whole diff read (+31/-1, `vram.rs`). `held_pages` adds the pages in `Levels::group_tiles` to `used` and `used_extra`. That is the same set the existing test helper `target_page_keys` treats as a texture's pages, and `map_levels` is where a lazy texture's pages go (`group_tiles[k].0/.1.extend`), so the count is right. A page shared by several textures still counts once for each of them; the line already says so ("a shared page counts for each"), and the "MB of pages in all" total is unchanged, so nothing is counted twice that the line does not announce. Each `used_extra` entry is one page, so `len()` is the right count. `page_owners` already held the `PAGES` lock for the whole walk; the change only adds a walk over each lazy texture's groups under that lock, once per activity line. It is diagnostics only: no behaviour or allocation changes. performance: `scripts/smoke.ps1`, 60 s of a retail title, release, after one warm-up run of the base: 1696 frames, 18399 MB peak commit against 1696 frames, 18303 MB on the base (warm-up: 1689, 16791 MB). No device removal, no crash. The smoke does not set `XCL_TEXTURE_LEVEL_PAGES=1`, so it has no lazy textures and the line reads the same on both (0 sampled textures by level). The changed path was run in world runs with `XCL_TEXTURE_LEVEL_PAGES=1` (release, 16 UMA windows, RAM guard; all of them, base included, were stopped by the RAM guard at 70-96 s, about world entry, so they say nothing about frame time). At the last line before the stop, base: "88364 sampled textures with pages by level hold 0 MB" and "85813 ... hold 0 MB" (2 runs); this PR: "78099 sampled textures with pages by level hold 3212 MB" (1 run that got that far), with 5663 MB of target pages in all. The textures with all their pages (3353 MB) plus those by level (3212 MB) come to more than the 5663 MB in all, as expected when shared pages count for each owner. Commit and video at that point were within the run-to-run spread of the base. verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5 ran the build, suite, tests, smoke and world runs, reviewed the diff against the merged source and wrote this) - Tiago
Foniass commented 2026-12-01 05:58:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:58:11Z.


merge-check
base: d0832e614f
head: 494aa53dd1
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (vram.rs, +31/-1). Diagnostics only: page_owners() is only logged (host.rs ~230) and drives no decision, and for textures that get all their pages at once held_pages returns the same count as before. No blocking findings. Lazy textures are inserted with empty used / used_extra (~2378), so the new count can't double-count. The remap_if_unmapped fallback moves group pages into used only when the group counts differ, which take_level_tiles prevents, and forget_pages, unmap_levels and release_held_unmaps all take the group pages away, so no release path leaves them counted. Nits: the test page_owners_counts_the_pages_a_texture_holds_by_level (~4139) only calls held_pages (the PR says so); held_pages repeats the union in the test-only target_page_keys (a copy that doesn't allocate is reasonable). Already on main, not from this PR: pages waiting in held_unmaps are counted in neither column. No smoke run: nothing on the default path changes.
performance: no smoke run (the default path doesn't reach this change); not measured.
verdict: safe to merge (diagnostics only)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7302332368 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3309#issuecomment-7302332368). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:58:11Z. --- merge-check base: d0832e614fa7d6ae027bb4feb27ccb9121f54a8f head: 494aa53dd1c45fb8f0487baa468ac1eec2eea909 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: read the whole diff (vram.rs, +31/-1). Diagnostics only: `page_owners()` is only logged (host.rs ~230) and drives no decision, and for textures that get all their pages at once `held_pages` returns the same count as before. No blocking findings. Lazy textures are inserted with empty `used` / `used_extra` (~2378), so the new count can't double-count. The `remap_if_unmapped` fallback moves group pages into `used` only when the group counts differ, which `take_level_tiles` prevents, and `forget_pages`, `unmap_levels` and `release_held_unmaps` all take the group pages away, so no release path leaves them counted. Nits: the test `page_owners_counts_the_pages_a_texture_holds_by_level` (~4139) only calls `held_pages` (the PR says so); `held_pages` repeats the union in the test-only `target_page_keys` (a copy that doesn't allocate is reasonable). Already on main, not from this PR: pages waiting in `held_unmaps` are counted in neither column. No smoke run: nothing on the default path changes. performance: no smoke run (the default path doesn't reach this change); not measured. verdict: safe to merge (diagnostics only) hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3309:upstream-pr/3309'
git switch 'upstream-pr/3309'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3309'
git switch 'upstream-pr/3309'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3309'
git switch 'upstream-pr/3309'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3309'
git switch 'main'
git merge --squash 'upstream-pr/3309'
git switch 'main'
git merge --ff-only 'upstream-pr/3309'
git switch 'main'
git merge 'upstream-pr/3309'
git push origin 'main'
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
xcl-dev/xcl!3309
No description provided.