wine: fold umem-unix and umem-pe into vkback-unix and victory_gpu::unixgate #224
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/vktory6--VKtory!224
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-224"
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?
@waldirjunior on GitHub · 2026-12-02 15:07 UTC · original
waldirjunior:refactor/one-unix-library→main· +955 −1163 · 19 files · 2 commits · openWhat
Completes the
docs/TASKS.md(Architecture cleanups) itemOne unix library(docs/TASKS.mdis not edited, per rule 29).Consolidates the legacy
umem-unix/umem-pepair into a single Wine unix library (vkback-unix), a single PE loader (victory_gpu::unixgate), and a single call-code table (greenfield/wine/codes.rs):greenfield/wine/):greenfield/wine/umem-unixandgreenfield/wine/umem-pecrates and pruned them fromgreenfield/wine/Cargo.tomlandgreenfield/wine/Cargo.lock.greenfield/wine/codes.rsinto one contiguous 21-opcode table (0..OP_COUNT), dropping 11 unused prototype/umem-test-only opcodes (OP_HELLO,OP_CREATE_BO,OP_MAP_FD,OP_CLOSE_FD,OP_COMMIT,OP_VIEW,OP_PROTECT,OP_POOL_DESTROY,OP_LOCATE,OP_GPU_COPY,OP_GPU_FILL).vkback-unix's__wine_unix_call_funcstable at compile time fromcodes.rsindices (build_table), and extendedgreenfield/vkback/tests/policy.rsto verify exact0..OP_COUNTcontiguity (no gaps, duplicates, or count drift) and enforce a single Wine unix library and loader (one_wine_unix_library_and_loader).crates/victory-gpu/src/unixgate.rs,apps/victory/src/run.rs):NtQueryVirtualMemory(1002)loaders andVICTORY_UMEM_SOreads incrates/victory-gpu/src/vklive.rsandcrates/victory-hle/src/modules/umem.rswith one sharedvictory_gpu::unixgateloader (single default/tmp/libvkback_unix.so, privateDispatcher/dispatch, and bounds-checkedUnixLib::call).victory_gpu::unixgate::validate_switches()at the top ofapps/victory/src/run.rs(before CPU checks, title loading, threads, or unixlib loading). Rejects non-UTF-8, empty/whitespace-only, relative paths, embedded NUL bytes, andUNICODE_STRINGUTF-16 length overflow;load_once()also fails loudly on parse error rather than silently falling back.greenfield/wine/vkback-unix/src/lib.rs):OP_UNVIEWa2 & 1failed-remap timeline hook (UMEM_TIMELINE) that had suffered copy-drift betweenumem-unixandvkback-unix, readinga[2]before borrowing&mut Callso a failed PE remap records the timeline event without invoking a sparse Vulkan unview.vkback-unixFFI buffer handlers (last_error,live_events,live_remap,live_remaps,live_guards,live_done) against null pointers, zero capacities, and2 * noverflow before constructing slices or draining internal state (pluscatch_unwindinlive_remapsand// SAFETY:comments on every touchedunsafeblock).umem-testswitches (UMEM_SPARSE,UMEM_UNIX_SO) and updatedVICTORY_UMEM_SOingreenfield/tools/policy/toggles.txt.greenfield/README.mdanddocs/learnings/wine-unixlib.md(marking the superseded entry per rule 28).The reference
No vkd3d-proton / D3D12 counterpart — this is internal Wine unixlib boundary and PE-to-Unix loader infrastructure (
__wine_unix_call_funcsand Wine'sNtQueryVirtualMemory(1002)loader).Evidence
Vulkan / Rule 30 scope and local hardware limitation
create_command_pool(vkCreateCommandPool) andget_device_queue(vkGetDeviceQueue) calls invkback-unix'sinit()(they existed solely for the removedOP_GPU_COPY/OP_GPU_FILLprototype opcodes and were never used by the live renderer).OP_UNVIEWa2 & 1failed-remap timeline branch invkback-unix, which keeps the non-Vulkan timeline path and avoids an unintended Vulkan sparse unview call when a PE remap fails.VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU). Becauseumem::Memory::newrequires a discrete GPU and returnsError::Setup("no discrete GPU")on this host,umem_backs_gpu_allocations, a title run, and a Vulkan validation run (VK_LAYER_KHRONOS_validation) were not executed locally. Noted here so a maintainer can run a smoke/validation pass on discrete RDNA2+ reference hardware if desired.Checks run locally (all passing)
tools/build.sh:victory(x86_64-pc-windows-msvc,--profile diag --features diagnostics)vkback-unix(greenfield/wine,--release)vk-store(greenfield/vkback,--release)greenfield/vkback/translate(--release --bins)clippy --locked -- -D warningsruns (0 warnings):cargo xwin clippy --workspace --all-targets --all-features --target x86_64-pc-windows-msvc --locked -- -D warningscargo xwin clippy -p victory -p victory-gpu -p victory-hle --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings(default features)victory-shader,victory-formats,victory-core,xtask)greenfieldworkspacegreenfield/wineworkspacegreenfield/vkback/translateworkspacevictory-core,victory-formats,victory-shader,xtask— passedgreenfield:frame,umem,vkback --lib— passedgreenfield/wine:vkback-unix(6/6, includingunview_failed_remap_flag_does_not_require_umem_init,uninitialised_entries_and_last_error, andnull_and_zero_cap_ffi_buffers_are_safe; also stress-tested 10x under--test-threads=8with zero flakes)victory-gpu --lib unixgate(5/5, includingcall_rejects_out_of_range_opcodeandparse_so_pathvalidation cases)greenfield:vkback --test policy --locked— 7/7 passed (including contiguous0..OP_COUNTandone_wine_unix_library_and_loader)cargo xtask policy— passed (526 files ok)victory-hlesuite: 170 passed + 3 passed (across test binaries)victory-gpusuite: 128/128 passedLD_DEBUG=filesunder Proton Experimental confirmeddlopenoflibvkback_unix.soand dispatch ofOP_INIT(reachingumem::Memory::newcleanly before failing withno discrete GPUon the integrated 780M)VICTORY_UMEM_SO=relative.so victory.exe ...exited cleanly with status code1before loading a titleChecklist (docs/AGENTS.md)
docs/TASKS.mdnot edited, the fixed item named above (rule 29)unsafeblock has a// SAFETY:comment; no raw pointer around the borrow checker (rule 36)TRANSLATOR_VERSIONbumped if the translator's output changes (rule 27) — translator untouched@vktory6 on GitHub · 2026-12-02 16:14 UTC · original
Thanks, "One unix library" is a cleanup we want, and the coordination note helps. Order on our side:
VICTORY_UMEM_SO, bothvalidate_switches()calls.#169/#180 touch
codes.rstoo; whichever lands later rebases.@waldirjunior on GitHub · 2026-12-02 19:47 UTC · original
Merged
main(16cbd34, including#202,#223,#235,#238, and#246) into this branch in8f34c7e:VICTORY_UMEM_SO:crates/victory-gpu/src/unixgate.rsis the sole reader, validator, andOnceLock-cached holder ofVICTORY_UMEM_SO; the duplicateSO_PATH, validation check, and obsolete test were removed fromvictory-hle(umem.rs/env.rs), andtoggles.txthas a single entry.validate_switches()calls at startup:apps/victory/src/run.rscalls bothvictory_hle::env::validate_switches()andvictory_gpu::unixgate::validate_switches()eagerly before loading the title or starting threads/unixgate.#60,#64) and#238preserved:codes.rsstays contiguous0..OP_COUNT(21 entries) withDONE_RENDERER_STOPPED,vkback-unixpreserves#238'sfill_donestopped-renderer behavior alongside the null-pointer guard and tests, and every exit path (includingvklive::start_watcher'sDONE_RENDERER_STOPPEDexit) still closesunixgatefirst.Post-merge local verification is green across all 4
tools/build.shbuilds, all 6clippy --locked -D warningschecks, native/policy/xtask/X11 tests, the Windowsvictory-hleandvictory-gpusuites under Proton, and bothvictory.exeE2E startup checks (VICTORY_UMEM_SO=relative.soandVICTORY_DSP_GAIN=0both exit 1 cleanly before loading a title). Ready for CI and review.@vktory6 on GitHub · 2026-12-02 20:09 UTC · original
Thanks for merging main. Since then main has moved again: #169 (the translator takes the host's subgroups and float controls) and #180 landed today, and both touch the unixlib boundary. A merge of current main into your branch now conflicts in
crates/victory-hle/src/modules/umem.rs,greenfield/wine/codes.rsandgreenfield/wine/vkback-unix/src/lib.rs. As far as I can see, #169 adds what the PE side passes to vkback-unix about the host device.Could you merge main once more and keep #169's additions in the consolidated
codes.rstable andvkback-unix? Main is quiet in that area now. Once it's in, we start the review right away and run the validation run and a world run on the reference card, since your 780M cannot run umem. The deadvkCreateCommandPool/vkGetDeviceQueueremoval is in rule 30's scope, so the validation run covers it.The direction of the Wine/unixlib side as a whole (our own runtime vs Wine, the PE loader, the unixlib split) is being discussed in https://github.com/vktory6/VKtory/discussions/264. This PR is a good concrete data point for it.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.