-
Notifications
You must be signed in to change notification settings - Fork 14.4k
ggml: add env var GGML_OP_OFFLOAD_MIN_BATCH #18535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* makes the min_batch_size for triggering op offload configurable via env var, defaulting to the prior hardcoded value of 32
ggerganov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The env var should be read only once upon device initiali§ation and then queried from the device context.
|
Took a crack at this, let me know if you'd recommend doing anything differently. AI-assisted with searching for the relevant code in the Metal backend and with debugging compile failures.
I tested CUDA locally on a
|
NeoZhangJianyu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me for SYCL backend part.
|
The Vulkan changes are fine. |
Co-authored-by: Aman Gupta <[email protected]>
|
@ggerganov merge? |
* ggml: add env var GGML_OP_OFFLOAD_MIN_BATCH * makes the min_batch_size for triggering op offload configurable via env var, defaulting to the prior hardcoded value of 32 * ggml: read GGML_OP_OFFLOAD_MIN_BATCH once and store to dev ctx * cann: forward declaration of device context struct * cann: move offload op check after device context declaration * cuda: fix whitespace Co-authored-by: Aman Gupta <[email protected]> --------- Co-authored-by: Aman Gupta <[email protected]>
#18530 / #17026
Makes the
min_batch_sizefor triggering op offload configurable via env var, defaulting to the prior hardcoded value of32if not specified to keep current behavior intact.This is helpful when running large MoEs with a significant size of weights stored in host buffers on CPU, causing a bottleneck when op offloading with small batches that are still larger than the default
32. The optimal value, or "break even point" here depends on characteristics of the hardware + model, and is best determined empirically (ref: #17026 (comment)).Make sure to read the contributing guidelines before submitting a PR