Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add AMD-AGI/Apex --skill hip-kernel-optimizationgit clone --depth 1 https://github.com/AMD-AGI/ApexWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/amd-agi/apex/hip-kernel-optimization)<a href="https://agentmods.dev/skills/amd-agi/apex/hip-kernel-optimization"><img src="https://agentmods.dev/badge/skills/amd-agi/apex/hip-kernel-optimization/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/amd-agi/apex/hip-kernel-optimization"><img src="https://agentmods.dev/badge/skills/amd-agi/apex/hip-kernel-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00056 | $0.02699 |
| Opus 5.5 | $0.00022 | $0.01080 |
| Sonnet 5.5 | $0.00011 | $0.00540 |
| Haiku 4.5 | $0.00006 | $0.00270 |
Grade A, and why
hip-kernel-optimization scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 256 lines — stays where its author put it; the contents beside it link to each section on GitHub.
HIP Kernel Optimization
Purpose
Provide ready patterns for efficient HIP kernels and guide diagnosis of memory throughput, occupancy, and synchronization bottlenecks.
When to Use
- Implementing or reviewing HIP kernels for AMD MI/CDNA architectures or CUDA-portable code
- Porting CUDA code to HIP while retaining performance
- Preparing profiling runs with
rocprof
Optimization Priority
Phase 1: Low-hanging fruit (try first, low risk)
#pragma unrollon hot loops with small, fixed trip counts- Enable
-ffast-mathcompiler flag for floating-point kernels - Use 32B vectorized loads/stores instead of 16B
- Add
__launch_bounds__(maxThreads, minBlocks)to guarantee occupancy - Add
constqualifiers on read-only pointers - Verify memory coalescing (consecutive threads → consecutive addresses)
Phase 2: Targeted improvements (profile first)
7. Profile with rocprof to confirm bottleneck
8. If memory-bound: CK-Tile buffer views with vectorization
9. If compute-bound: Shared memory tiling
10. Dynamically calculate block size based on problem dimensions
11. Replace large 2D shared arrays with atomicAdd for sparse patterns
12. Provide multiple block size configurations to avoid register spill
13. Add explicit rounding mode control for numerical correctness
14. Pre-compute workspace size to avoid dynamic allocation
15. Implement CSV-based tuning cache for repeated GEMM shapes
Phase 3: Complex transformations (high effort) 16. Algorithm changes (e.g., Top-K-only softmax) 17. gfx950: Use 16x16x32 MFMA instead of 2x 16x16x16 18. Kernel fusion (multi-op in single kernel) 19. Persistent kernels for repeatedly executed operations 20. Shape-based heuristic dispatching
Anti-patterns:
- Optimizing everything at once
- Manual loop unrolling (use
#pragma unrollinstead) - Over-unrolling (factor > 8)
- Premature vectorization without alignment check
- Unnecessary buffer coherence flags (e.g.,
glc)
Core Optimization Patterns
1. Memory Access
- Coalescing: Map consecutive threads to consecutive addresses; prefer SoA over AoS
- Vectorization: Use CK-Tile buffer views for efficient I/O; prefer 32B loads over 16B
- Boundary handling: Separate fast vectorized path from slow boundary path
if(idx + VEC_SIZE <= d) { vec_o out_vec; #pragma unroll for(size_t j = 0; j < VEC_SIZE; j++) { out_vec[j] = compute(x[j], y[j]); } buffer_out.template set(idx, 0, true, out_vec); // Fast path } else { for(size_t j = 0; j < VEC_SIZE; j++) { // Boundary path if(idx + j < d) ptr_out[idx + j] = compute(...); } }
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 256 lines · 56 tokens per session scan A a9c9cfd80b48
hip-kernel-optimization is a skill published in the GitHub repository AMD-AGI/Apex (78 stars, last pushed 23d ago), licensed MIT. It adds 56 tokens to every session and 2,699 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
optimize-global-memory-access
Guide the agent through diagnosing and restructuring CUDA global memory access patterns to maximize effective memory bandwidth, covering coalescing requirements, vectorized loads, AoS vs SoA layouts, shared memory staging for non-coalesced patterns, and L2 cache behavior.
doca-argp
Use this skill for hands-on DOCA Arg Parser CLI work on a shipped sample or new DOCA-using app — adding / removing / renaming flags; wiring docaargpinit → register params → docaargpstart → docaargpdestroy in order; picking a parameter type from the full public enum (DOCAARGPTYPESTRING, INT, BOOLEAN, DEVICE, DEVICEREP…
embedded-stm32
Best practices for embedded C/C++ development on STM32 microcontrollers using the HAL, covering peripherals, DMA, interrupts, memory constraints, and hardware-focused testing. Use when writing STM32 HAL code, configuring peripherals generated by STM32CubeMX, working with interrupts or DMA, debugging with SWD/JTAG…
acad-arx-wizard
Agentic ObjectARX project scaffolding for AutoCAD 2027 / Visual Studio 2026. Replaces the broken .vsz VsWizardEngine wizard with a PowerShell script that generates identical C++ project files. Works for new ARX/DBX/CRX projects and add-on class wizards (Jig, Reactors, Custom Object, MFC, .NET Wrapper, COM Wrapper…
cortex-m-patterns
Cortex-M code patterns for SysTick, NVIC priority grouping, FPU enable, MPU regions, AAPCS inline assembly, DWT cycle counting, vector table relocation, and WFI sleep entry. Use when writing core-level Cortex-M code or checking it against a known-good pattern.
bare-metal-patterns
Register-level C patterns for Cortex-M without a HAL: bit manipulation macros, GPIO and polled UART setup, SysTick timebase, interrupt-driven UART ring buffer, linker sections and map files, and weak default ISR handlers. Use when writing or reviewing HAL-free drivers and startup code.