Automated summary
Profiles GPU kernels at source-line granularity by mapping cycle and stall metrics from the compiled code to individual source lines.
Strengths
- Attributes total cycles, stall cycles and idle cycles to each source line and each ISA instruction
- Automatically sorts source lines by total_cycles descending so hotspots surface first
- Exposes stall_percent to separate memory-bound lines from dependency-bound ones
- Can be driven either through MCP tools (profile_application, analyze_instruction_hotspots) or the Linex Python API
Limitations
- Requires AMD ROCm 7.0+ with rocprofv3, so it does not apply to NVIDIA GPUs or older ROCm releases
- Source mapping only works for kernels compiled with -g; without debug symbols line-level profiling is unavailable
- Beyond noting that debug symbols must exist, the skill gives little guidance for frameworks such as Triton
Use it when you need to pinpoint exactly which lines of a GPU kernel consume the most cycles or cause stalls.
Avoid it when the target is not an AMD GPU on ROCm 7.0+, or when the binary cannot be rebuilt with debug symbols.
Security analysis
SafeThe skill provides instructions for using a GPU profiling library and API. It does not contain destructive commands, data exfiltration, obfuscation, or unsafe execution patterns. The only execution is running the user's own target application through a profiler, which is the intended legitimate purpose.
No concerns found
How this analysis is madeExamples
Use Linex to profile ./my_app with kernel_filter='my_kernel' and show me the top 5 source lines by total_cycles with their stall percentages.Profile my HIP kernel with Linex and list every source line whose stall_percent is above 50, so I can see which ones are memory-bound.Run analyze_instruction_hotspots on my collected Linex profile and break down the instructions and latencies for the single hottest source line.name: linex-profiling description: Profile GPU kernels at source-line granularity with cycle-level timing and stall analysis. Use when identifying performance hotspots at the source code level or analyzing instruction-level metrics mapped to source lines.
Linex: Source-Level GPU Performance Profiling
Map GPU performance metrics to your source code lines. Get cycle-level timing, stall analysis, and instruction-level metrics for each line of source code.
When to Use
- User asks to profile a GPU application at source-line granularity
- Need to identify which specific lines of code are performance bottlenecks
- Analyzing stall patterns and execution bottlenecks at the source level
- Understanding cycle-level timing for each line of code
- Instruction-level analysis mapped to source lines
Instructions
- Ensure the target runs on AMD ROCm 7.0+ with
rocprofv3available. - Kernels must be compiled with
-g(debug symbols) for source mapping. - Choose execution path:
- If a Linex MCP server is available, use its MCP tools:
profile_applicationto run and profile a target application with the options below.analyze_instruction_hotspotsto perform instruction-level hotspot analysis on collected profiles.
- Otherwise use the Python API from the environment where Linex is installed.
- If a Linex MCP server is available, use its MCP tools:
Python API
from linex import Linex
profiler = Linex(
target_cu=0, # Target compute unit
shader_engine_mask="0xFFFFFFFF", # All shader engines
activity=10, # Activity counter polling
)
profiler.profile("./my_app", kernel_filter="my_kernel")
# Show hotspots (sorted by total_cycles)
for line in profiler.source_lines[:5]:
print(f"{line.file}:{line.line_number}")
print(f" {line.total_cycles:,} cycles ({line.stall_percent:.1f}% stalled)")
print(f" Executed {line.execution_count} times")
# Find memory-bound lines
memory_bound = [
l for l in profiler.source_lines
if l.stall_percent > 50
]
# Instruction-level analysis
for line in profiler.source_lines[:1]:
for inst in line.instructions:
print(f"{inst.isa}: {inst.latency_cycles} cycles")
SourceLine Properties
file- Source file pathline_number- Line numbertotal_cycles- Sum of all instruction cyclesstall_cycles- Cycles spent waitingidle_cycles- Cycles slot was idleexecution_count- Total executionsinstructions- List of ISA instructionsstall_percent- Convenience: stall_cycles / total_cycles * 100
InstructionData Properties
isa- ISA instruction textlatency_cycles- Total cycles for this instructionstall_cycles- Cycles spent waitingidle_cycles- Cycles slot was idleexecution_count- How many times it raninstruction_address- Virtual address in GPU memoryfile- Parsed from source_locationline- Parsed from source_locationstall_percent- Convenience: stall_cycles / latency_cycles * 100
Workflow
- Ensure the target binary is built with
-g(debug symbols) for source mapping. - Create a
Linex()profiler; optionally settarget_cu,shader_engine_mask, oractivity. - Call
profiler.profile(command, kernel_filter=...)to run profiling. - Access
profiler.source_lines(sorted by total_cycles) to find hotspots. - Use
line.stall_percentto identify memory-bound or dependency-bound lines. - Drill down into
line.instructionsfor instruction-level analysis. - Use relative paths for the target binary so the skill is portable.
Notes
- Requires ROCm 7.0+ with
rocprofv3support. - Source mapping requires kernels compiled with
-g(debug symbols). source_linesare automatically sorted bytotal_cycles(descending).- Use
kernel_filterto profile specific kernels by name (regex pattern). - For Triton or other frameworks, ensure debug symbols are available in the compiled output.
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/source-level-gpu-performance-profiling-mso6xg0a/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/source-level-gpu-performance-profiling-mso6xg0a/download' --output '.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a/SKILL.md.part' && mv '.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a/SKILL.md.part' '.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a/SKILL.md' && test -s '.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/linex-profiling' && cp -R '.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a' '.claude/skills/linex-profiling'Cursor
test -f '.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a/SKILL.md' && test -s '.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/linex-profiling' && cp -R '.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a' '.cursor/skills/linex-profiling'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/source-level-gpu-performance-profiling-mso6xg0a'openskills read 'source-level-gpu-performance-profiling-mso6xg0a'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/source-level-gpu-performance-profiling-mso6xg0a/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.