Faster tensor name formatting #860
Merged
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.
When building the compute graph, tensors get assigned names via
ggml_format_name. For small models with very fast inference, a non-negligible fraction of the overall compute time (not just graph building time) is spent in that function. Given the names being assigned, we don't need to usesnprintfasggml_format_namedoes. This PR replaces calls toggml_format_namewith calls to a new function, which is very simple but still quite a bit faster.For e.g. Ling-mini-2.0 running on RTX-4080 we get a ~1% TG performance gain.
Here some
sweep-benchresults with this PR for Ling-mini-2.0This is with grouped expert routing enabled (
-ger). Compared to #838, where grouped expert routing was added on CUDA, at low context TG performance has improved by ~11% and PP performance by 8%. This is the cumulative effect of this PR, and PRs #858, #853, #845, #840.