Skip to content

roofline: emit raw per-tensor facts for DDR byte accounting (single + fused)#48

Draft
roberteg16 wants to merge 2 commits into
rogarcia.rooflinefrom
rogarcia.roofline-fused-raw-facts
Draft

roofline: emit raw per-tensor facts for DDR byte accounting (single + fused)#48
roberteg16 wants to merge 2 commits into
rogarcia.rooflinefrom
rogarcia.roofline-fused-raw-facts

Conversation

@roberteg16

@roberteg16 roberteg16 commented Jul 13, 2026

Copy link
Copy Markdown

What

The HIP roofline profiler emits raw per-tensor facts instead of computing HBM byte totals in-tree. For every tensor — on fused nodes and on the top-level (single-op) row — it reports: byte count, a storage id (the view_src root, so the consumer sees which tensors alias the same buffer), and a source tensor id. The consumer (rocm-scripts tools/roofline) computes external in/out from those facts.

Improvements

  • Correct bytes, one policy for single and fused kernels. With the storage ids the consumer can exclude what never crosses HBM: no-op views (VIEW/RESHAPE), in-place copy/scatter destinations (CPY/SET_ROWS pass their own output buffer in as a source — written, not read), and internal tensors. This fixes real double-counts — the KV-cache write was counted twice, in both fused and standalone SET_ROWS/CPY.
  • Cleaner separation. Producer reports facts; consumer owns policy — the model non-fused rows already used. Removes the in-tree fused byte computation.

Two commits: (1) raw facts for fused nodes + drop the in-tree fused computation; (2) emit the same ids on non-fused rows so single kernels get the same treatment.

Companion consumer PR: FaaSApps/rocm-scripts#682.

A/B on Qwen2.5-3B / gemma-3-12B / Qwen3.6-35B: only view / in-place-destination cases change (e.g. SET_ROWS −49%, standalone CPY −33%); every other row is byte-identical.

roberteg16 and others added 2 commits July 13, 2026 13:02
Fused rows previously carried a group HBM byte total computed in-tree. Instead,
emit raw per-fused-node facts -- each tensor's byte count, a storage id
(view_src root, so aliasing is visible) and a source tensor id -- and let the
consumer (rocm-scripts tools/roofline) compute external in/out.

This lets the consumer apply the exclusion policy it owns: skip no-op views
(VIEW/RESHAPE), drop in-place destinations (e.g. SET_ROWS/CPY writing their own
dst), exclude internal tensors, and dedup reads by source. It also matches how
non-fused rows already work (producer reports facts, consumer sums).

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
Non-fused rows already emit dst/src byte counts; also emit the dst storage id,
per-source ids and per-source storage ids (all already captured by
fill_head_record). This lets the consumer apply the same in-place-destination
rule to single kernels as to fused ones -- e.g. a standalone CPY or SET_ROWS no
longer has its write target (dst passed in as a source) double-counted.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
@roberteg16 roberteg16 changed the title roofline: emit raw per-tensor facts for fused ops roofline: emit raw per-tensor facts for HBM byte accounting (single + fused) Jul 13, 2026
@roberteg16 roberteg16 changed the title roofline: emit raw per-tensor facts for HBM byte accounting (single + fused) roofline: emit raw per-tensor facts for DDR byte accounting (single + fused) Jul 13, 2026
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.

1 participant