Merge main into amd-dev #3444
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3444"
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 lucsoft on 2026-11-29T18:02:09Z.
This PR merges
mainintoamd-dev, so the two branches stop drifting apart, the same way #3203 did fornvidia-dev.amd-devbranched frommainat2c717a04(2026-11-27) and has not takenmainsince. That is about 650 commits, including thenvidia-devmerge (#3203) and the fixes that came after it.Please merge with a merge commit, not squash or rebase. That way git records that
mainis inamd-dev, and the next sync does not hit the same conflicts again.What is in it
4fedcbc8: a merge commit. Its parents areamd-dev10582c42(first parent) andmain24d21a41.5eb7f8fb: a second merge, of the currentamd-devhead36e16cf4(73 commits newer than10582c42), resolved by the same rules (below).git merge-tree --write-tree upstream/amd-dev HEADreturns this head's tree, so the PR merges intoamd-devwithout conflicts.3277acaf: a third merge, ofamd-dev6bab0c53(11 commits newer than36e16cf4: bake indices through the view heap's slots,XCL_FFX_RESET, black skipped Bink movies, BVH-builder binds, reflection fallback,XCL_TRACE_INDEXED,XCL_SKIP_CS, …). Four files conflicted:title_textures.rs:main'sTransitionrecord is kept besideamd-dev'sKept/kept();amd-dev's tupleTransitionandLIST_NOTESare not taken, sincemaintracks list transitions its own way.console_list.rs: both sides' locals are kept, andXCL_SKIP_CSgoes in front ofmain'spso_user_sgprs_exact.real.rs:indexed::note_madegoes in beforemain'sconsole_heap::write+vram::track_srv.main's lazy flag sits beside the BVH-builderimage_only.bind.rs:uncover_indexedtakesamd-dev'sindexed::resources.main'soriginalpipeline foris_kept.main'sskip_untranslated_dispatchis followed byleft_out::direct.indexed.rscallsmain'sread_committed_intowhereamd-devhascopy_readable; both read with zeros for unreadable pages.069c29fe:late_releaseseals a held resource's batch without waiting for a busy queue lease (queue_submit::try_with). Fixes the three-thread deadlock through the D3D12 runtime's lock that raylitebull found on Windows; the path ismain's (byte-identical files), not the merge's.Three fixes on top of the third merge, found in retail runs on Linux (RX 7800 XT, RADV):
859e8ad2ambient: find the stand-in's passes and build its helpers under Wine. The stand-in lighting never applied on this merge. There was nocaptured … sky domeorappliedline, so withXCL_RT_GATE=missevery missed ray brought sky light indoors: overexposure and sparkles. It had three causes:main's split-chain ExecuteIndirect path returned before the ambient hook. The hook now runs there too.CreatePipelineStateand looked up by the bound pipeline or the console record.D3DCompile, which is vkd3d-shader under Wine and refuses them. They now compile DXC first (dxc::compile_sm6_first), as do the depth-twin, present and mirror helpers.scatter's program stays onD3DCompile, because built with DXC it scattered writes to wrong places.XCL_AMBIENT_DIAG=1logs each lighting pass's path and role.2f3d1135zero recycled page-pool tiles before a new texture uses them. This is a merge regression.amd-devzeroed recycled pool tiles (XCL_ZERO_TARGET_PAGES, on by default); takingmain'svram.rsdropped that. New render targets such as the probe light history then started with another image's bytes, which showed as a mosaic of other shots in the lighting.main's page pool, zeroed on the tile-mapping queue before theUpdateTileMappings.XCL_ZERO_TARGET_PAGES=0turns it off.e3fae4edkeep dispatch chain scratch until the GPU is done with it. The title's finalReleaseof an allocator cleared its chain recordings even whenalloc_poolstill held the allocator because it was busy. A later submit then ran chains on freed scratch.mainhas the same code (alloc_release).How the conflicts were resolved:
A plain merge produced about 315 conflict hunks in 46 files. Most of them came from the same
nvidia-devline being integrated twice:amd-devmergednvidia-devd1be8103its own way.mainmergednvidia-devthrough #3203.Rules applied:
nvidia-dev:main's version is kept, because it is newer and has the follow-up fixes. Changes fromamd-dev's own 49 commits are re-applied on top of it.amd-dev's own features are kept and wired:ps_masks,rt_leave_out. These files are byte-identical toamd-dev.8942a5b9).XCL_RT_GATE, with the BVH builder off by default.f2f02bd0,fe5260b6,3bb095a0).1be2221e,512b0bbc).s_barrierin direct DXIL (965cc655).108cbafa,23d0f365).081da4b9).f33df5a7). This lives inmain's ownshaders/pipeline_library.rs, andXCL_PSO_LIBRARY=0/1overrides it.mainalready has them: 21 in total. 17 match by subject. The other four areb958a344(=3cde0cc3),60345c97,61559df6(mainhas2fc61b64) andda910ccd(mainhas its own pipeline library, AMD driver-cache default and sampler keys).Where
main's behaviour was kept overamd-dev's:Please check these if they matter to you:
alloc_pool:release_when_done,release_finishedandtake_excess_asideare dropped, becausemainhas its own probe-based allocator retirement.pending_gpu_marks()is rewritten formain's fence structure.sparse.rs: based onmain. Dropped:XCL_SPARSE_CPU_WAIT_MS, the RX 9070 device-removal fix),wait_pending_mappings,vram.rs: based onmain. Dropped: zero-fill of recycled tiles and deferred unmap batches.vram_small.rsis not wired in; onamd-devit was on by default.bind.rs, two-pass paths:main's record buffers and scale-args code. Dropped:XCL_TWO_PASS_SHARED, the 4-UAV scale-args root signature, and theUNKNOWN_RESfence tracking.console_heap.rs,title_textures.rs,dispatch_chain.rs, the present compositor, DXIL live lanes:main's versions.real.rs:main'sslot()lookups.82d5eea8(preparation progress per variant): not ported, because it conflicted everywhere withmain's reworked preparation UI.main's.XCL_TEXTURE_LEVEL_PAGESandXCL_SMALL_TEXTURESstay opt-in, and the upload buffers stay at 512 MB.Second merge (
36e16cf4), what needed more than a mechanical resolution:mainin some form;main's version is kept (duplicate tests dropped).main's code: the direct wave32 graphics reductions (8c79f57e), quad-only PS reads besidemain's EXEC fallback (45ed56c8), the page comparison after remap and GPU-written new textures inmain's texture selection (02ceae64,0b985d7e), the sparse range keeping (707123ad, static renamedRANGES_KEPT), the look stats (2a630fd2), urgent PSO workers onmain'sBuildqueue (4dea333d), the RAM floor aftermain's compile gates (927524e7), the--measure-*options (5ab4f647), the newer-forms selection (e35c3840;main's EXEC-select fold stays on for every program).XCL_ASYNC_SUBMITsubmit thread (27f5f621,db556c26,b54c6d9b,9f9a9bce,077047a3; built onamd-dev's ExecuteCommandLists hook and alloc_pool, which the first merge replaced), the unlocked sparse CPU read (09536b89,eabf2de0; needsamd-dev's sparse landing), the shared deferred two-pass batch buffer (c7388f3d,34e95e7b,0bad17b7; needs the droppedXCL_TWO_PASS_SHAREDtracking),5c5ee83f(mainalready keepsXCL_DXIL_NO_OPTruns out of the cache). From36e16cf4the newer-forms defaults andXCL_DIRECT_COMPACT_MINare taken, its huge-compile defaults (64 KiB, 2 at a time) are not: they would turn offmain's AMD medium-compute gate.Tests changed:
Removed, because they test code that was dropped above:
title_textures::a_sampled_shadowed_texture_is_active_againalloc_pool::excess_idle_aside_allocators_are_reclaimed_while_title_and_busy_ones_stayvram_smalltest moduleChanged:
early_depth: falseadded to the olderPsInterfaceliterals.main's robustness tests that expected multi-wave barriers to fall back to HLSL now expectamd-dev's direct safe barrier.Tested
cargo build --release -p xclandcargo build --release -p xcl --testssucceed on all three merge commits. These are cross builds tox86_64-pc-windows-gnuon Linux.On
3277acaf, the unit tests of the modules the third merge touched were run under Wine 11.21, withXCL_DXC_DIRpointing at DXC 1.9.2609:indexed(4),bvh_spare(4),ffx(3),title_textures(70 passed, 1 ignored),console_list(12),left_out(9).d3d12x::bindtests fail:gpu_two_pass_indirect_commands_keep_their_own_recordsandprepared_initial_pipeline_commits_only_after_create_or_reset_success. They fail the same way on the previous head069c29fe, because the Wine test prefix has no real D3D12 device; the merge did not cause them.Retail title on Linux: Wine 11.21 staging, vkd3d-proton 3.1 with a newer dxil-spirv, RX 7800 XT (RDNA3), RADV. Several runs with this tree plus a few local patches (mimalloc, a pixel-shader loop cap, #794, #1244, #681), using
XCL_RT_GATE=miss XCL_AMBIENT=skyand the default coherent window:0xc0000005read at0x400016000(xg::copy_frominto a GPU heap routed to the sparse windows) does not occur. It happened onamd-devwithoutmain's fixes in every run we made, including with #3369.game+0x23cf683writes to0x0, as in #846. The title waits on a bottom-of-pipe word while XCL has no pending fence, queue wait orWait64cell.On
e3fae4edthe release build and--testsbuild succeed, and the first new commit builds on its own. Unit tests under Wine:ambient18,alloc_pool28 (including the newa_final_release_retains_a_busy_allocator_and_not_a_free_one),depth_uav21.vram: 72 passed, 1 failed.d32s8_targets_take_their_own_size_of_video_memoryfails the same way on3277acaf.dispatch_chain: 25 passed, 2 failed, both in the test helperslot_of("adopted class"). One of them,failed_binding_keeps_indirect_commands_until_allocator_reset, fails the same way without the fix. The other is the new GPU testa_released_allocator_keeps_its_chains_until_the_gpu_is_done, which needs the same test setup fixed, so it proves nothing yet.In the title:
Regression run
No
xcl-smokeblocks yet:scripts/smoke.ps1has not been run on this head or onmain. These runs were on Linux/Wine outside the script (see Tested). Like #3203, the file list also trips the binary-file check: the GitHub files API returns no patch for these large merged files, so they are reported as binary.Not tested
amd-dev-specific stability fixes that were dropped in favour ofmain(above), on the GPUs they were made for.AI use
Claude Code (Claude Opus 5.5) did the conflict resolution, with sub-agents doing the commit-by-commit resolution, and wrote this description, at my request and under my review.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-29T19:27:04Z.
Tested
4fedcbc8as-is on Windows 11, RX 9070 XT, release build, on a retail title.XCL_PREPARE_WORKERS=2): preparation finished (compute check ~780 s and 604 graphics pipelines in ~1020 s on a cold driver cache). The title then froze ~8 s after starting: 0 presents, 0 submits until killed. No device removal.XCL_RT_GATE=miss XCL_AMBIENT=sky, defaults otherwise) andXCL_PREPARE=0: loading screens at 30 fps, in-game pipeline builds, then from ~310 s 0 presents and 0 submits to the end of the 600 s run. Never reached the world. No device removal, peak commit 21.8 GB.Thread stacks of the frozen process show a three-thread deadlock through the D3D12 runtime's lock:
real::q_execute_command_lists→queue_submit::with(holds the submit lease) →SubmissionChunk::submit_effects→sparse::readback_after_execute_with→ID3D12CommandAllocator::Reset→ waits on an SRW lock inside D3D12Core.title_list::reset→list_x::reset_pc→alloc_pool::reset_list→ inside D3D12Core, the runtime releases a resource →real::res_release→late_release::hold(takesHELD) →drain_known→queue_submit::with→Lease::enterwaits for (1)'s lease.real::res_release→late_release::holdwaits forHELDheld by (2).vkd3d-proton doesn't have D3D12Core's lock, which would explain why this doesn't show on Linux. Two possible fixes: don't take the submit lease from a release hook that can run inside a runtime call (defer
drain_known, or skip sealing when the lease is busy), or don't call into D3D12 (allocatorReset) while holding the lease. I haven't checked whether plainmainhits this on Windows too.The PR head has moved to
5eb7f8fbsince; I have not tested that commit.Imported from ivall/xcl. Originally posted by lucsoft on 2026-11-29T19:32:35Z.
Thanks for testing this on Windows and for the stacks – that pinned it down.
The deadlock isn't from the merge:
late_release.rs,queue_submit.rsandsparse::readback_after_execute_withare byte-identical tomainhere, somainshould hit the same three-thread wait on Windows.amd-devdoesn't have #2959's submit lease, which is why it doesn't show there.The cycle closes in
late_release::Held::drain: it signals each queue's fence underHELDthroughnative_queue_signal, which waits for the queue's lease. I pushed069c29fe(your first option): sealing takes the lease only when it is free (queue_submit::try_with,native_queue_try_signal). If another thread has the queue's turn, the batch stays open, and the next drain closes it – the late-release thread drains everyTICK.HELDis never held while waiting for a lease now, so aReleasefrom inside a runtime call no longer waits for the queue thread. There's a unit test fortry_with(no wait for another thread's turn, re-entrant on the owner).Tested only on Linux (Wine + vkd3d-proton, RX 7800 XT), where the deadlock can't happen: builds, tests build. I can't run Windows here – could you try the new head when you have a moment? If it's easier to review on its own, I can open it as a separate PR against
mainas well, sincemainhas the same path.