diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 17:11:38 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 17:11:38 -0500 |
| commit | ca9e45dbd136feae14936ffbbe300d18bcda48c7 (patch) | |
| tree | d6cad81523cd0cbdd774b9d6c1c597584055d1ec /runtime/src/vulkan_backend.h | |
| parent | b8c925002c6b4a6bfb5cfad6e7cc60ce2414586e (diff) | |
| parent | d3b8251bc390418cdbc1f2d30727b6b31d889cfa (diff) | |
Merge main into pe-inspect-linux-classes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/vulkan_backend.h')
| -rw-r--r-- | runtime/src/vulkan_backend.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h index d0a863421..ecc2eef9c 100644 --- a/runtime/src/vulkan_backend.h +++ b/runtime/src/vulkan_backend.h | |||
| @@ -1572,6 +1572,14 @@ public: | |||
| 1572 | std::unique_lock lock(pipeline_mutex_); | 1572 | std::unique_lock lock(pipeline_mutex_); |
| 1573 | pipeline_workers_.swap(workers); | 1573 | pipeline_workers_.swap(workers); |
| 1574 | } | 1574 | } |
| 1575 | // For the large pipelines of a submission: the memory they may use while they compile together | ||
| 1576 | // (PipelineCompiles::build), and what is kept while they do (LargeModuleGate::Demand). None (the default): they compile | ||
| 1577 | // one after another. | ||
| 1578 | void set_large_compiles(std::function<std::uint64_t()> budget, std::function<std::shared_ptr<void>()> demand) { | ||
| 1579 | std::unique_lock lock(pipeline_mutex_); | ||
| 1580 | large_compile_budget_ = std::move(budget); | ||
| 1581 | large_compile_demand_ = std::move(demand); | ||
| 1582 | } | ||
| 1575 | PipelineWorkers::Stats pipeline_worker_stats() { | 1583 | PipelineWorkers::Stats pipeline_worker_stats() { |
| 1576 | std::shared_lock lock(pipeline_mutex_); | 1584 | std::shared_lock lock(pipeline_mutex_); |
| 1577 | return pipeline_workers_ ? pipeline_workers_->stats() : PipelineWorkers::Stats{}; | 1585 | return pipeline_workers_ ? pipeline_workers_->stats() : PipelineWorkers::Stats{}; |
| @@ -2189,6 +2197,8 @@ private: | |||
| 2189 | std::unordered_map<std::uintptr_t, ComputePipeline> pipelines_; | 2197 | std::unordered_map<std::uintptr_t, ComputePipeline> pipelines_; |
| 2190 | std::unordered_map<std::uintptr_t, GraphicsPipeline> graphics_pipelines_; | 2198 | std::unordered_map<std::uintptr_t, GraphicsPipeline> graphics_pipelines_; |
| 2191 | std::unique_ptr<PipelineWorkers> pipeline_workers_; | 2199 | std::unique_ptr<PipelineWorkers> pipeline_workers_; |
| 2200 | std::function<std::uint64_t()> large_compile_budget_; | ||
| 2201 | std::function<std::shared_ptr<void>()> large_compile_demand_; | ||
| 2192 | std::unordered_map<std::uint64_t, VkAccelerationStructureKHR> acceleration_structures_; | 2202 | std::unordered_map<std::uint64_t, VkAccelerationStructureKHR> acceleration_structures_; |
| 2193 | LayoutTracker tracker_; | 2203 | LayoutTracker tracker_; |
| 2194 | std::mutex storage_mutex_; // a leaf lock: guards storage_pending_ and zero_pending_ only | 2204 | std::mutex storage_mutex_; // a leaf lock: guards storage_pending_ and zero_pending_ only |
| @@ -3168,10 +3178,13 @@ private: | |||
| 3168 | recycle_khr_as_queries(khr_guard.as_queries); | 3178 | recycle_khr_as_queries(khr_guard.as_queries); |
| 3169 | geometry.clear(); | 3179 | geometry.clear(); |
| 3170 | 3180 | ||
| 3181 | std::shared_ptr<void> demand; | ||
| 3182 | if (context_.large_compile_demand_ && compiles.any_large()) demand = context_.large_compile_demand_(); | ||
| 3171 | if (context_.pipeline_workers_) | 3183 | if (context_.pipeline_workers_) |
| 3172 | compiles.build(run_compiles); | 3184 | compiles.build(run_compiles, context_.large_compile_budget_); |
| 3173 | else | 3185 | else |
| 3174 | compiles.build_serial(); | 3186 | compiles.build_serial(); |
| 3187 | demand.reset(); | ||
| 3175 | const ReplayResult compile_result = check_compiled_pipelines(compiles, prepare_result); | 3188 | const ReplayResult compile_result = check_compiled_pipelines(compiles, prepare_result); |
| 3176 | if (compile_result != ReplayResult::success) return compile_result; | 3189 | if (compile_result != ReplayResult::success) return compile_result; |
| 3177 | prior_compiles = std::move(compiles); | 3190 | prior_compiles = std::move(compiles); |
| @@ -3181,7 +3194,7 @@ private: | |||
| 3181 | const PipelineCompiles* prior = has_prior_compiles ? &prior_compiles : nullptr; | 3194 | const PipelineCompiles* prior = has_prior_compiles ? &prior_compiles : nullptr; |
| 3182 | prepare_result = context_.pipeline_workers_ | 3195 | prepare_result = context_.pipeline_workers_ |
| 3183 | ? build_pipelines(compiles, std::span(prepared).first(lists.size()), prepare_result, | 3196 | ? build_pipelines(compiles, std::span(prepared).first(lists.size()), prepare_result, |
| 3184 | run_compiles, prior) | 3197 | run_compiles, context_.large_compile_budget_, prior) |
| 3185 | : build_pipelines_serial(compiles, std::span(prepared).first(lists.size()), | 3198 | : build_pipelines_serial(compiles, std::span(prepared).first(lists.size()), |
| 3186 | prepare_result, prior); | 3199 | prepare_result, prior); |
| 3187 | replay.compiles = nullptr; | 3200 | replay.compiles = nullptr; |