D3D12.X: clear alignment and check overflow on GetResourceAllocationInfo(2) error #1360
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1370"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T15:19:42Z.
In
device_x::allocation_of(shared byget_resource_allocation_info_xandget_resource_allocation_info2_x), a descriptor that failed after the first one (s == u64::MAXora == 0) returned(u64::MAX, align)with the previous descriptor's alignment, instead of D3D12's error sentinel{ SizeInBytes: UINT64_MAX, Alignment: 0 }. The alignment and accumulation steps (size.next_multiple_of(a),offset + s, and the finalsize.next_multiple_of(align)) also used unchecked arithmetic, panicking in debug and wrapping in release on overflow.This returns
(u64::MAX, 0)on a descriptor error and useschecked_next_multiple_of/checked_addthroughout, treating an overflow (or landing exactly onu64::MAX) as(u64::MAX, 0).What is in it
crates/xcl/src/hle/d3d12x/device_x.rs: the error return and checked arithmetic inallocation_of; the failure-case expectation ofallocation_info_of_several_is_padded_to_the_largest_alignmentbecomes(u64::MAX, 0), and the new testallocation_of_clears_alignment_on_error_and_overflowcovers the error after a valid descriptor, the sum overflow, the alignment rounding overflow and the final padding overflow.Since the last push: rebased onto
main06c9f55; the conflict was in the test module (a UAV-format testmainhad added at the same place) and both are kept.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 1266 passed, 0 failed, 46 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib -- allocation_ofand-- uav_format_promotion: 2 passed, 0 failedallocation_of_clears_alignment_on_error_and_overflowwith the error return put back to(u64::MAX, align): 0 passed, 1 failed —left: (18446744073709551615, 65536), right: (18446744073709551615, 0)Regression run
main (
426a5a7, clean tree, no local changes):PR (
9238a8d, clean tree, no local changes):(The main block is
426a5a7, an ancestor of the currentmain06c9f55, from the same machine and data folder.)Not tested
GetResourceAllocationInfofail after a valid descriptor (the test drivesallocation_ofdirectly)usize/u64arithmetic could differ (none expected; the code isu64throughout)AI use
06c9f55, kept both tests at the conflict, re-verified that the new test fails without the error return, ran the suite and thescripts/smoke.ps1pair.Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T15:26:32Z.
Full-suite run, since this PR has no test report yet. Tested exact head
52b928d(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.get_resource_allocation_info_resets_alignment_on_error_and_overflow.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T16:33:32Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main(b7aa9f3) incrates/xcl/src/hle/d3d12x/device_x.rs— needs a rebase before it can be tested.upstream-sync referenced this pull request2026-11-24 19:06:45 +00:00
Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-25T15:43:53Z.
Rebased onto
main06c9f55; the conflict was a UAV-format testmainhad added at the same place, and both are kept. Head9238a8d: 1266 passed, 0 failed, 46 ignored. With the error return put back to(u64::MAX, align)the new test fails (left: (2^64-1, 65536), right: (2^64-1, 0)); the smoke pair in the description is426a5a7/ this head. AI use: OpenCode, Claude Fable 5.2.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:26:38Z.
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:40:22Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:32:31Z.
Triage (#1607) – head
9238a8dNo open or merged PR makes the same change. Main's
allocation_ofindevice_x.rsstill returns(u64::MAX, align)on an error and uses uncheckednext_multiple_ofand+.No problems found in the diff. The branch conflicts with main and needs a rebase.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.