mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:45:53 +01:00
[PR #1577] [CLOSED] d3d12: parallel PipelineCompiler workers with reserved demand lane (RT-PIPELINE-COMPILER-WORKERS) #1597
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1597
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1577
Author: @madhyn
Created: 11/25/2026
Status: ❌ Closed
Base:
main← Head:feat/pipeline-compiler-workers📝 Commits (1)
b9ce8f2d3d12: parallel PipelineCompiler workers with reserved demand lane (RT-PIPELINE-COMPILER-WORKERS)📊 Changes
3 files changed (+268 additions, -9 deletions)
View changed files
📝
runtime/CMakeLists.txt(+9 -0)📝
runtime/shims/d3d12_pipeline_compile.h(+62 -9)➕
runtime/test/pipeline_compiler_test.cpp(+197 -0)📄 Description
Claimed in the coordination issue as:
RT-PIPELINE-COMPILER-WORKERS(addresses unclaimed finding7150502283on #14; coordination issue #14 is at GitHub's 2,500-comment cap with no open successor at PR time — confirmed 0 file overlap with #1547, which explicitly leftPipelineCompiler/d3d12_pipeline_compile.hseparate).What and why
rt::d3d12::PipelineCompilerinruntime/shims/d3d12_pipeline_compile.hpreviously ran a singleTHREAD_PRIORITY_BELOW_NORMALworker for both speculative compute warmup and demanded async builds (LEONIDA_ASYNC_PIPELINES=1). As noted in finding7150502283on #14, a long driver compile in that single worker stalls every other queued pipeline build behind it.This change upgrades
PipelineCompilerto a bounded worker pool while preserving existing single-worker semantics when requested:LEONIDA_COMPILE_THREADS,1..32): defaults to 2..6 workers based onstd::thread::hardware_concurrency()(>=18 -> 6,>=12 -> 4,>=6 -> 3, else2).LEONIDA_COMPILE_THREADS=1preserves the strict single-worker behavior.workers >= 2): demanded builds (priority == 0) can run across allNworkers; speculative warmup jobs (0 < priority < SIZE_MAX) are capped atN - 1concurrent workers so at least one worker remains available for demanded builds without starving behind warmup.SIZE_MAXidle checkpoints wait untilrunning_ == 0, andhas_compile_waiter()counts in-flight compile jobs (compile_running_ > 0) in addition to queued non-checkpoint jobs so cache checkpoints back off cleanly.PipelineCompiler(unsigned workers = 0)constructor and joining destructor enable isolated unit tests whileinstance()stays a process-lifetime singleton.Per-PSO
variants_mutex_,big_compileserialization (>128 KiB),std::atomic<unsigned> active_compiles,publicationmutex, and driver-synchronizedVkPipelineCache(created withoutEXTERNALLY_SYNCHRONIZED_BIT) already guard concurrent compilation across call sites ind3d12_vulkan_device.cpp.Tested
runtime/test/pipeline_compiler_test.cppwithclang-cl --target=x86_64-pc-windows-msvc /std:c++20 /O2 /W4 /permissive- /utf-8(0 warnings ind3d12_pipeline_compile.handpipeline_compiler_test.cpp) and ran under Wine 11.22 on Arch Linux (Intel Core i7-12700):test_worker_count_config(hardware concurrency tiers + valid/invalidLEONIDA_COMPILE_THREADSvalues)test_parallel_demand(2 demanded jobs reach a barrier concurrently on a 2-worker pool)test_demand_lane_reserved(demanded job finishes immediately while speculative warmup fillsN-1workers and caps further warmup)test_checkpoint_waits_for_idle(has_compile_waiter()reflects in-flight compiles;SIZE_MAXcheckpoint runs only after active compiles finish)test_single_worker_strict_order(workers=1drains0, smallest warmup, thenSIZE_MAX)pipeline_compiler: all checks passed(17/17 checks).python3 scripts/check_no_game_data.py: passed.GPUs tested: n/a for unit test (CPU scheduler test); also exercised with live Vulkan pipeline compilation on NVIDIA GeForce RTX 3060 Ti (8 GB, NVIDIA Linux driver + Wine 11.22, Arch Linux x86_64).
AI-assisted: yes (Antigravity)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.