trt-perf-analysis
Skill1.7k starsChanged 5 months agoApache-2.0View on GitHub
Validate and analyze TensorRT performance data from paired layer-info JSON and profile/latency JSON files. Use when asked to inspect TensorRT, TRT, torch-tensorrt, or ONNX-TensorRT perf reports, verify that layer/profile JSON files are valid and from the same model, infer basic model information, find likely fusion or latency optimization opportunities, and produce a concise Markdown performance report or structured JSON data.
1 other project uses a version of this.
Trending
Quiet this year.thin dataabout the whole repository
Most recently taken up by
- NVIDIA/TensorRTtheir own version, first seen Jun 24, 2026
Who's talking about NVIDIA/trt-samples-for-hackathon-cn
- Tlntin/Qwen-TensorRT-LLM“长序列(>2048)出现output为空”GitHub · Nov 29, 2023
- NVIDIA/TensorRT“override getBatch() in IInt8EntropyCalibrator failure”GitHub · Sep 20, 2023
The biggest 2 of 2 mentions linking to the repository that our crawl found. Each line is their own headline.
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- NVIDIA/TensorRT★ 13ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- trt-cpp-runtime-quickstartSkill
- trt-onnx-quickstartSkill
- trt-strong-typing-migrationSkill
- trt-torch-quickstartSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Use scripts/run.sh on Unix-like systems or scripts\run.cmd on Windows for Python scripts.
- Very specific: line 13
Use one folder that directly contains layers_*.json and/or profile_*.json.
- Very specific: line 19
Run scripts/analyze_trt_perf.py first when you need an integrity gate before interpretation.
- Very specific: line 21
Check validation before interpreting.
- Distinctive: line 27
Keep the final AI analysis in two sections:
- Very specific: line 46
Use <runner> as <skill-dir>/scripts/run.sh on Unix-like systems or <skill-dir>\scripts\run.cmd on Windows.
- Distinctive: line 79
Use this starter category list and revise as evidence warrants:
- Distinctive: line 103
Keep facts and hypotheses separate.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TRT Perf Analysis
Workflow
Use scripts/run.sh on Unix-like systems or scripts\run.cmd on Windows for Python scripts. These wrappers do best-effort Python 3.8+ discovery; set SKILL_PYTHON to a Python executable to override discovery. Replace placeholders with platform-native paths.
- Choose the input scope.
Use one folder that directly contains
layers_*.jsonand/orprofile_*.json. Do not call the packager on a parent folder that only contains component subfolders. For model suites with separate encoder, transformer, decoder, VAE, or similar components, handle each component folder separately. - Infer model identity and components.
Prefer an explicit model name from the user prompt and pass it with
--model-name. Otherwise rely on the analyzer/packager to inspect likely config files, the input directory name, and layer/profile filenames. Keep the name empty when confidence is low. Serialized JSON records the inferred model identity at the top level and in each successful backend'smodelobject. - Run deterministic analysis.
Run
scripts/analyze_trt_perf.pyfirst when you need an integrity gate before interpretation. The script uses only Python built-in modules, extracts structured analysis data, and serializes it as JSON. This JSON is the authoritative analyzer output for validation, packaging, and AI diagnosis. - Check validation before interpreting.
The analyzer exits
0when it can emit structured validation data, even if one or more backends fail validation. Read the generated JSONvalidationobject to decide which backend reports are usable. If the analyzer exits nonzero, stop because it could not emit structured data. If the schema validator exits nonzero, stop because the generated JSON contract is invalid. Do not continue into performance interpretation for a backend unless its validation status ispassed, its analysis mode islayer_profile, the layer graph is a DAG, and the layer/profile names match. Forlayer_onlybackends, graph and layer inspection are available but latency/performance interpretation is not. Understand the model, then write AI diagnosis. Use the generated JSON as grounding material. Build a clear picture of the model or component scope, backend differences, graph structure, timing distribution, hot layers, fusion clues, and caveats before writing conclusions. The browser
Summarypanel is generated fromanalyze-data.json; do not copy that deterministic summary intoanalyze.md.Keep the final AI analysis in two sections:
## Summary- short, high-confidence facts and the most important optimization leads.## Details- interpretation, cross-backend comparisons, hypotheses, ranked experiments, and human judgment that is not a mechanical restatement of the analyzer output.
Before sending the final response, write the final AI analysis into
analyze.mdfor each report folder you created or updated. Match each file to that report folder's scope. For a single model with multiple backend JSON pairs, oneanalyze.mdmay compare those backends. For multiple model components packaged as multiple report folders, write distinct component-focusedanalyze.mdfiles; do not copy a suite-level analysis into every component report.analyze.mdshould not include validation checklists, complete timing tables, top-layer tables, path dumps, or other content already rendered by the report app fromanalyze-data.json. Briefly cite specific metrics or layer names only when they support a new conclusion or next experiment.Package the report. Run
scripts/package_report.pythrough the shared runner. Each invocation creates exactly one final report folder from one input folder that directly containslayers_*.jsonorprofile_*.jsonfiles. The packager writesanalyze-data.json, validates it against the schema, and copies the browser report template while preserving the generated JSON. Determine the output parent from the user's active workspace, not from a subdirectory of this skill. If the only known directory is the skill directory, omit--output-parent; the packaging script will fall back to the system temp directory.When producing multiple reports for one user request, prefer explicit
--report-dirvalues so report folder names include the model/component identity instead of relying on auto-numbered collision suffixes. If a suite-level conclusion is useful, write it as a separate overview Markdown file in the output parent, not as every component report'sanalyze.md.- Preview only the final report.
Serve the completed report folder, not the skill directory, when the user wants a browser preview. The Python
visualize_layer_info.pyscript remains available for standalone HTML layer-info debugging, but it is not part of the report packaging flow or report app dependency chain.
Common Commands
Use <runner> as <skill-dir>/scripts/run.sh on Unix-like systems or <skill-dir>\scripts\run.cmd on Windows.
# Validate or inspect inputs. Folder mode discovers matching backends; repeat --data for explicit backends.
<runner> <skill-dir>/scripts/analyze_trt_perf.py <model-folder> --output <analysis.json>
<runner> <skill-dir>/scripts/analyze_trt_perf.py --data <layers-a.json> <profile-a.json> --data <layers-b.json> --output <analysis.json>
# Create a report. Use --report-dir for component-specific reports and --analyze-md after writing final AI analysis.
<runner> <skill-dir>/scripts/package_report.py <model-folder> --output-parent <workspace-folder> [--model-name <model>] [--analyze-md <final-analysis.md>]
<runner> <skill-dir>/scripts/package_report.py --analyze-data <report-folder>/analyze-data.json [--analyze-md <final-analysis.md>]
# Optional preview.
<runner> -m http.server 8765 --bind 127.0.0.1 --directory <report-folder>Then open http://127.0.0.1:8765/.
Inputs
Expect one layer-info JSON and one profile/latency JSON per engine/report. A folder may contain multiple pairs such as:
layers_torch-trt-aot.jsonwithprofile_torch-trt-aot.jsonlayers_onnx-tensorrt.jsonwithprofile_onnx-tensorrt.json
Layer records are expected to include Name, LayerType, Inputs, and Outputs. Profile records are expected to include name, timeMs, averageMs, medianMs, and percentage; a first record like { "count": 20 } is allowed.
Infer a per-layer Type for report output. Default to the raw LayerType, then apply narrow special-case overrides when the layer name, tactic, or metadata makes the specialization clear. Known special cases:
kgen_mha: a rawLayerTypeofkgenthat is actually an MHA/FMHA-style attention layer.misc: rawLayerTypevaluesreshape,shape_call,signal, andwaitare grouped into this category.
Model Categories
Use this starter category list and revise as evidence warrants:
- Transformer encoder / sentence embedding
- Transformer decoder / LLM
- Vision transformer
- CNN / convolutional vision model
- Diffusion / U-Net style model
- Recommender / ranking model
- Classical ML or feature pipeline
- Unknown DL model
Report category only when the evidence is strong. Good evidence includes Hugging Face config fields, names like encoder.layer, attention layers, input names such as input_ids, or repeated convolution/GEMM patterns. Say "unknown" instead of over-claiming.
Analysis Heuristics
Prioritize issues by likely runtime impact and confidence:
- Hot layers: individual layers with high
percentageoraverageMs. - Layer-type concentration: high aggregate time in
kgen, shape, cast, gather, reshape, or pointwise/reduction layers may indicate fusion or dynamic-shape overhead. - Fusion clues: for transformer encoders, check whether Q/K/V matmuls are fused per block, whether attention is an obvious fused SDPA/FMHA layer, and whether layer-norm/residual/GELU patterns are fused into larger kernels.
- Engine partitioning: one engine is usually ideal. Use adjacent
.trt/.enginefiles,_subgraph, andStreamIdas hints; state when this is only inferred. - GEMM tactics: GEMM layers without Tensor Core or xMMA-like tactic names may deserve inspection.
- Many tiny kernels: if no single layer dominates but many small kernels add up, rank launch/fusion overhead above isolated micro-hotspots.
Keep facts and hypotheses separate. For each optimization opportunity, include evidence from the JSON and a next check or experiment.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

