Skip to content

Commit 7928cfe

Browse files
roberteg16claude
andcommitted
roofline: rename cryptic id fields (sid -> storage_id / tensor_id)
Address review: the emitted keys and op_record members used cryptic names. Rename dst_sid -> dst_storage_id, src_ids -> src_tensor_ids, src_sids -> src_storage_ids (both the C++ members and the JSON keys). No behavior change. Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
1 parent 42d8a06 commit 7928cfe

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

ggml/src/ggml-cuda/ggml-cuda-roofline.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ struct op_record {
5959
// tensor that owns the underlying buffer -- ggml's view_src root -- so tensors that alias the
6060
// same memory (a view and its source; an in-place op's output and the dst it was handed in as
6161
// a source) share one storage id; that is how the consumer spots internal and in-place tensors.
62-
uint64_t dst_sid = 0; // destination's storage id (its buffer)
63-
uint64_t src_ids[GGML_MAX_SRC] = {}; // each source's tensor id (dedup key)
64-
uint64_t src_sids[GGML_MAX_SRC] = {}; // each source's storage id (its buffer)
62+
uint64_t dst_storage_id = 0; // destination's storage id (its buffer)
63+
uint64_t src_tensor_ids[GGML_MAX_SRC] = {}; // each source's tensor id (dedup key)
64+
uint64_t src_storage_ids[GGML_MAX_SRC] = {}; // each source's storage id (its buffer)
6565
int64_t M = 0, N = 0, K = 0, n_experts = 0, top_k = 0; // matmul dimensions
6666
std::vector<op_record> fused_nodes; // per-node geometry when this row is a fused group (else empty)
6767
};
@@ -188,13 +188,13 @@ void fill_head_record(op_record & rec, const ggml_tensor * node) {
188188
// total HBM traffic for this op: write the destination and read every source.
189189
rec.dst_bytes = (int64_t) ggml_nbytes(node);
190190
rec.bytes = rec.dst_bytes;
191-
rec.dst_sid = (uint64_t) (uintptr_t) roofline_storage(node);
191+
rec.dst_storage_id = (uint64_t) (uintptr_t) roofline_storage(node);
192192
for (int j = 0; j < GGML_MAX_SRC; j++) {
193193
if (node->src[j]) {
194194
rec.src_bytes[j] = (int64_t) ggml_nbytes(node->src[j]);
195195
rec.bytes += rec.src_bytes[j];
196-
rec.src_ids[j] = (uint64_t) (uintptr_t) node->src[j];
197-
rec.src_sids[j] = (uint64_t) (uintptr_t) roofline_storage(node->src[j]);
196+
rec.src_tensor_ids[j] = (uint64_t) (uintptr_t) node->src[j];
197+
rec.src_storage_ids[j] = (uint64_t) (uintptr_t) roofline_storage(node->src[j]);
198198
}
199199
}
200200

@@ -289,13 +289,13 @@ void write_fused_node(std::ostringstream & out, const op_record & rec) {
289289
}
290290
out << "], \"op_params\": [";
291291
for (int p = 0; p < n_op_params; p++) { if (p) out << ", "; out << rec.op_params[p]; }
292-
out << "], \"dst_bytes\": " << rec.dst_bytes << ", \"dst_sid\": " << rec.dst_sid << ", ";
292+
out << "], \"dst_bytes\": " << rec.dst_bytes << ", \"dst_storage_id\": " << rec.dst_storage_id << ", ";
293293
out << "\"src_bytes\": [";
294294
for (int j = 0; j < rec.n_src; j++) { if (j) out << ", "; out << rec.src_bytes[j]; }
295-
out << "], \"src_ids\": [";
296-
for (int j = 0; j < rec.n_src; j++) { if (j) out << ", "; out << rec.src_ids[j]; }
297-
out << "], \"src_sids\": [";
298-
for (int j = 0; j < rec.n_src; j++) { if (j) out << ", "; out << rec.src_sids[j]; }
295+
out << "], \"src_tensor_ids\": [";
296+
for (int j = 0; j < rec.n_src; j++) { if (j) out << ", "; out << rec.src_tensor_ids[j]; }
297+
out << "], \"src_storage_ids\": [";
298+
for (int j = 0; j < rec.n_src; j++) { if (j) out << ", "; out << rec.src_storage_ids[j]; }
299299
out << "], \"M\": " << rec.M << ", \"N\": " << rec.N << ", \"K\": " << rec.K
300300
<< ", \"n_experts\": " << rec.n_experts << ", \"top_k\": " << rec.top_k << "}";
301301
}
@@ -356,13 +356,13 @@ void write_report() {
356356
for (int p = 0; p < n_op_params; p++) { if (p) out << ", "; out << rec.op_params[p]; }
357357
out << "], ";
358358
out << "\"bytes\": " << rec.bytes << ", ";
359-
out << "\"dst_bytes\": " << rec.dst_bytes << ", \"dst_sid\": " << rec.dst_sid << ", ";
359+
out << "\"dst_bytes\": " << rec.dst_bytes << ", \"dst_storage_id\": " << rec.dst_storage_id << ", ";
360360
out << "\"src_bytes\": [";
361361
for (int j = 0; j < rec.n_src; j++) { if (j) out << ", "; out << rec.src_bytes[j]; }
362-
out << "], \"src_ids\": [";
363-
for (int j = 0; j < rec.n_src; j++) { if (j) out << ", "; out << rec.src_ids[j]; }
364-
out << "], \"src_sids\": [";
365-
for (int j = 0; j < rec.n_src; j++) { if (j) out << ", "; out << rec.src_sids[j]; }
362+
out << "], \"src_tensor_ids\": [";
363+
for (int j = 0; j < rec.n_src; j++) { if (j) out << ", "; out << rec.src_tensor_ids[j]; }
364+
out << "], \"src_storage_ids\": [";
365+
for (int j = 0; j < rec.n_src; j++) { if (j) out << ", "; out << rec.src_storage_ids[j]; }
366366
out << "], ";
367367
out << "\"M\": " << rec.M << ", \"N\": " << rec.N << ", \"K\": " << rec.K
368368
<< ", \"n_experts\": " << rec.n_experts << ", \"top_k\": " << rec.top_k << ", ";

0 commit comments

Comments
 (0)