Repository navigation
ggml-tsavorite: don't report OPU Target for ops with no kernel invocation - #160
Closed
akapoor3518 wants to merge 1 commit into
Closed
akapoor3518 wants to merge 1 commit into
akapoor3518 wants to merge 1 commit into
Conversation
…tion The per-node compute loop unconditionally marked every node it processed as GGML_COMPUTE_BACKEND_TSAVORITE, even for op types with no kernel/blob (GET_ROWS, SOFT_MAX, etc.), which are instead computed by calling ggml's own CPU compute function directly. This made the GGML Perf Summary's Target column report "OPU" for ops that had zero kernel runs and were actually computed on CPU, misleading anyone reading it to understand what's actually running on hardware. Snapshot tsi_kernel_runs at the start of each node's processing and only report GGML_COMPUTE_BACKEND_TSAVORITE if it actually increased; otherwise report GGML_COMPUTE_BACKEND_CPU, matching what ops like SET_ROWS/ROPE already correctly showed when routed the same way.
akapoor3518
requested review from
Nithyanand-G,
atrivedi-tsavoritesi,
dineshReddy6381,
dmpatra,
gkethamallax,
mikeuhler and
mmankal
as code owners
August 18, 2026 22:04
PR Summary by QodoCorrect Tsavorite perf targets for CPU-fallback operations
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can keep summaries lean with Finding overflow, which tucks the rest behind 'View more' |
| // exactly what the Target/TSI_KERNEL-RUN columns are meant to make visible. | ||
| node->ggml_compute_backend = (node->tsi_kernel_runs > tsi_kernel_runs_before_node) | ||
| ? GGML_COMPUTE_BACKEND_TSAVORITE | ||
| : GGML_COMPUTE_BACKEND_CPU; |
There was a problem hiding this comment.
I believe the way we used to display was everything as OPU but the txe_kernel run being counted only when txe executes it otherwise it is empty. Is it the case even now ?
Author
|
Merged into #159 -- closing this in favor of the combined PR. |
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
Found while reviewing GGML Perf Summary output enabled by FIR-2216/PR #158. Some ops with
TSI_KERNEL-RUN == 0 kernel launches were still labeled "OPU" in the Target column, which reads
as if they ran on Tsavorite hardware when they were actually computed via a direct call to
ggml's own CPU compute function.
Example (before this fix):
SET_ROWS and ROPE correctly showed CPU, but GET_ROWS and SOFT_MAX -- going through the exact
same "no blob, call the plain CPU compute function directly" pattern in the dispatch switch --
showed OPU instead, despite also having 0 kernel runs.
Root cause
The per-node compute loop unconditionally marked every node it processed as
GGML_COMPUTE_BACKEND_TSAVORITEat the end of each iteration, regardless of whether a kernelactually launched or the node was computed via the CPU-fallback path
(
ggml_compute_forward_get_rows/ggml_compute_forward_soft_max/etc., called directly a fewlines earlier for op types with no kernel implementation).
ggml_tsavorite_internal_supports_op()accepts these op types identically (unconditionalreturn truefor GET_ROWS, SOFT_MAX, SET_ROWS, ROPE, etc.), so the inconsistency in the exampleabove isn't explained there -- it's specifically the backend-label assignment at the end of the
compute loop.
Fix
Snapshot
tsi_kernel_runsat the start of each node's processing and only reportGGML_COMPUTE_BACKEND_TSAVORITEif it actually increased during this node's compute; otherwisereport
GGML_COMPUTE_BACKEND_CPU.Validation
Verified via ollama (Makefile.sync temporarily pointed at this branch, merged with the
FIR-2238 perf_reset fix for a combined test): GET_ROWS, SOFT_MAX, and CONT (also affected, same
pattern) now correctly show CPU instead of OPU. ADD/MUL/RMS_NORM/MUL_MAT/GLU -- which do launch
real kernels -- are unaffected and still correctly show OPU. Confirmed the underlying
TSI_KERNEL-RUN magnitude for the reclassified ops is unchanged before/after this fix (this fix
only changes which Target bucket the existing numbers land in, not the numbers themselves).
Summary by cubic
Fixes mislabeling in GGML Perf Summary: nodes with zero TSI_KERNEL-RUN are no longer reported as OPU. Old behavior marked all processed nodes as OPU; new behavior reports OPU only if a kernel launched, otherwise CPU. This changes reporting only.
tsi_kernel_runsat node start and setsnode->ggml_compute_backendtoTSAVORITEonly if it increases; otherwise setsCPU.Written for commit 0960023. Summary will update on new commits.