Skip to main content
Glama

top_kernels

Reads a saved nsys or ncu profile CSV and returns the N heaviest kernels plus GPU time share, call counts, duration, occupancy, and throughput metrics.

Instructions

Read a saved profile CSV (from profile()) and return the n heaviest kernels. tool='nsys': cuda_gpu_kern_sum CSV -> share of GPU time, calls, avg/med/min/max/std ns. tool='ncu': details CSV -> per-launch duration, achieved occupancy, DRAM / SM throughput %, registers per thread, and a memory/compute/latency hint.

Input Schema

NameRequiredDescriptionDefault
nNo
toolNonsys
summary_csvYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden, and it does establish a read-only, file-consuming operation and spells out exactly what fields each mode returns (GPU time share, occupancy, DRAM/SM %, registers). It omits failure behavior, e.g., a missing file or a CSV that doesn't match the chosen tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action in the first sentence, then a compact per-mode breakdown. Terse arrow notation is efficient, though the second sentence is dense enough to require careful reading.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and the description adequately documents the return fields per mode, which is the key completeness gap for this tool. Remaining gaps are error/edge-case handling rather than core call correctness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate, and it does for two of three parameters: 'n' is the count of heaviest kernels, and 'tool' has its two valid values and what each expects as input. 'summary_csv' is only implied as the path to the profile CSV, and no enum constrains 'tool' in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Read a saved profile CSV (from profile()) and return the n heaviest kernels.' The link to profile() implicitly differentiates it from siblings like gpu_info, though no sibling is named explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Makes the usage context clear: this consumes a CSV produced by profile(), and the 'tool' value must match the CSV type (nsys cuda_gpu_kern_sum vs ncu details). It stops short of stating exclusions (e.g., when to use gpu_info or roofline instead).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.