perf: allocate CPU-offloaded params from runtime device pinned host buffer#1601
Open
fszontagh wants to merge 1 commit into
Open
perf: allocate CPU-offloaded params from runtime device pinned host buffer#1601fszontagh wants to merge 1 commit into
fszontagh wants to merge 1 commit into
Conversation
284af90 to
553197a
Compare
553197a to
9d0a521
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
params_backend != runtime_backend(i.e.--offload-to-cpu), allocate the runner's params buffer from the runtime device's host buffer type (ggml_backend_dev_host_buffer_type) instead of the regular CPU buffer type. For the CUDA backend this is the pinned (page-locked) host buffer, so subsequent H2D transfers are DMA-direct instead of going through the driver's pageable staging copy. Backends that don't implementget_host_buffer_typefall back to the existing path.Related Issue / Discussion
Independent perf win on top of #1598 (now merged as
a7f2e03).Additional Information
Z-Image bf16, 512x512, 8 steps,
--offload-to-cpu --stream-layers --max-vram 8on RTX 3060:LoRA multiplier scaling identical (0.8 vs 1.5 mean pixel diff 26.05 -> 26.05, bit-exact output preserved).
Checklist