flydsl-kernel-code-cleanup

A refactoring guide for updating FlyDSL GPU kernel code from older low-level constructs to the current `fx.*` interface. FlyDSL is a Python-based language and compiler for writing GPU kernels.

In plain words
What is it for?
Use it when cleaning up kernels, replacing deprecated operations, updating launch wrappers, or checking related correctness and performance tests in the AITER project.
Why use it?
It helps modernize existing kernels while keeping behavior changes small and avoiding duplicated helper code. It also clarifies when low-level code is still necessary.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/rocm/aiter/flydsl-kernel-code-cleanup
Any agent
npx skills add ROCm/aiter --skill flydsl-kernel-code-cleanup
Clone the repo
git clone --depth 1 https://github.com/ROCm/aiter

Made for: Claude Code, Codex.

Per session 173 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,028 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00173 $0.07028
Opus 5 $0.00086 $0.03514
Sonnet 5 $0.00035 $0.01406
Haiku 4.5 $0.00017 $0.00703

Measured 2d ago against content hash d508d00df187, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

flydsl-kernel-code-cleanup 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 2d 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.

.claude/skills/flydsl-kernel-code-cleanup/SKILL.md · 512 lines

How it starts

The opening of the file, as written. The whole thing — 512 lines — stays where its author put it; the contents beside it link to each section on GitHub.

FlyDSL Kernel Code Cleanup

Maps legacy/deprecated kernel constructs to the current fx.* surface. Companion to flydsl-kernel-authoring (API reference) and flydsl-tile-programming (authoring wizard).

Golden rule: in @flyc.kernel / @flyc.jit bodies, use fx.* and Python operators first. Drop to a raw dialect only at a hard boundary with no wrapper, and localize it.

Aiter layout

Location Role
aiter/ops/flydsl/kernels/ @flyc.kernel device kernels and shared helpers (tensor_shim.py, kernels_common.py, …)
aiter/ops/flydsl/*.py Launch wrappers, compile helpers, public op entry points
op_tests/test_flydsl_*.py Top-level FlyDSL correctness / perf tests
op_tests/flydsl_tests/ Additional FlyDSL kernel tests

Prefer from aiter.ops.flydsl.kernels.tensor_shim import _run_compiled, ptr_arg. Do not add a second _run_compiled copy — reuse tensor_shim.py. Some older wrappers such as moe_kernels.py still carry a local _run_compiled(exe, args) with a list argument; new code should import from tensor_shim.

Cautions

  • Surgical, behavior-preserving. Migration is a refactor: minimal diffs, match local style.
  • Don't mass-rewrite heavily-legacy kernels unless asked (e.g. flash_attn_gfx950.py uses _scf.IfOp/_raw pervasively). Clean what the task touches.
  • Verify. Offset/type/SSA changes can shift results — run the kernel test before/after; clear cache with FLYDSL_RUNTIME_ENABLE_CACHE=0 if unsure.
  • expr/ stays target-neutral: no rocdl/llvm/buffer imports in python/flydsl/expr/ top-level (guarded by test_expr_optional_rocdl.py).

1. ArithValue and index helpers (deprecated in expr/arith.py)

Deprecated Replacement
ArithValue(x) (wrap for operators) fx.Int32/Int64/Float32/Vector — already overload + - * / % << >> == < >
arith.unwrap(v) / arith._to_raw(v) v.ir_value(), only where a raw ir.Value is needed
arith.index(n) / arith.index_cast(T.index, v) / fx.Index(n) fx.Int64(...) (or fx.Int32(...))

Read the full file on GitHub · 512 lines

Changes

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.

  1. 2d ago First seen · 512 lines · 173 tokens per session scan A d508d00df187

Subscribe to this mod's changes

flydsl-kernel-code-cleanup is a skill published in the GitHub repository ROCm/aiter (543 stars, last pushed 2d ago), licensed MIT. It adds 173 tokens to every session and 7,028 once invoked, about $0.0009 per session on Opus 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.

Related

Other skills, from other repositories

jupyter-notebook

Use when the user asks to create, scaffold, or edit Jupyter notebooks (.ipynb) for experiments, explorations, or tutorials; prefer the bundled templates and run the helper script newnotebook.py to generate a clean starting notebook.

microsoft/ai-agents-for-beginners · 57 tokens

biopython

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use…

K-Dense-AI/scientific-agent-skills · 76 tokens

esm

Use when working directly with the esm Python SDK, ESM3 or ESMC model IDs, Forge/Biohub inference clients, or ESMFold2 folding workflows.

K-Dense-AI/scientific-agent-skills · 39 tokens

benchling-integration

Benchling Python SDK and REST API integration for registry entities, inventory, ELN entries, workflows, Benchling Apps, and Data Warehouse queries. Use when automating lab data with benchling-sdk or the v2 API.

K-Dense-AI/scientific-agent-skills · 50 tokens

marimo-pair

Work inside the user's live marimo notebook from the code editor: run Python in the same kernel the user does, inspect live notebook state, and commit durable notebook changes through code mode. Use whenever you create, analyze, or improve the user's marimo notebook.

marimo-team/marimo · 57 tokens

quantum-qiskit

Reference qiskit 2.x patterns for variational quantum machine learning. Covers data-encoding feature maps, variational quantum classifier (VQC) training, variational quantum eigensolver (VQE) for chemistry, matrix-product-state circuits, and noise model integration. Use when writing Python code that imports qiskit…

aiming-lab/AutoResearchClaw · 102 tokens