Skip to content

[CUDA] Tune ops per buffer based on device - #2761

Merged
awni merged 3 commits into
ml-explore:mainfrom
awni:tune_ops_per_buffer
Nov 16, 2025
Merged

awni merged 3 commits into
ml-explore:mainfrom
awni:tune_ops_per_buffer

Conversation

@awni

@awni awni commented Nov 14, 2025 •

Copy link
Copy Markdown
Member

We need a more sophisticated policy to set ops per buffer based on the device. This is a start to that.

For inference on B200 it helps a lot for inference to increase it at very little memory cost.

mlx_lm.benchmark --model meta-llama/Meta-Llama-3.1-8B --p 128 -g 128 -b 1 -n 4

Pre: generation_tps=244.456, peak_memory=16.166
Post: generation_tps=283.073, peak_memory=16.224

For training 0.6B it's a double win, faster and less RAM 💪

Toks/sec Mem (GB)
Pre 60631 54.51
Post 64078 51.63

@awni awni changed the title Tune ops per buffer based on device [CUDA] Tune ops per buffer based on device Nov 14, 2025

@angeloskath angeloskath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful 🚀

@awni

awni commented Nov 16, 2025

Copy link
Copy Markdown
Member Author

This will probably need more tuning in the future especially for devices that I didn't add yet. But for now I think it's good to merge.

@awni
awni merged commit aad49f9 into ml-explore:main Nov 16, 2025
9 checks passed
@BrewTestBot BrewTestBot mentioned this pull request Nov 20, 2025
1 task done
@awni
awni deleted the tune_ops_per_buffer branch November 22, 2025 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants