optimize-shared-memory-tiling

optimize-shared-memory-tiling is a skill for Claude Code, Codex from tensormux/kernel-skills. It costs 0 tokens per session (3,517 once invoked), scanned A, original, MIT.

A guide for arranging frequently reused data in CUDA shared memory, a fast memory area shared by threads running together on a graphics processor. It covers tile layouts, bank conflicts, buffering, and memory-versus-occupancy trade-offs.

In plain words
What is it for?
Use it when tuning CUDA matrix multiplication, convolution, stencil, or attention kernels; choosing tile sizes and padding; adding asynchronous double buffering; or fixing shared-memory limits.
Why use it?
It helps decide whether shared-memory staging will improve a kernel and addresses slowdowns caused by conflicting memory access or excessive shared-memory use.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when tuning CUDA matrix multiplication, convolution, stencil, or attention kernels; choosing tile sizes and padding; adding asynchronous double buffering; or fixing shared-memory limits.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tensormux/kernel-skills/optimize-shared-memory-tiling
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.

Any agent
npx skills add tensormux/kernel-skills --skill optimize-shared-memory-tiling
Clone the repo
git clone --depth 1 https://github.com/tensormux/kernel-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for optimize-shared-memory-tiling

README.md
[![agentmods](https://agentmods.dev/badge/skills/tensormux/kernel-skills/optimize-shared-memory-tiling/github.svg)](https://agentmods.dev/skills/tensormux/kernel-skills/optimize-shared-memory-tiling)
Your own site
<a href="https://agentmods.dev/skills/tensormux/kernel-skills/optimize-shared-memory-tiling"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/optimize-shared-memory-tiling/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.

agentmods 80×15 button for optimize-shared-memory-tiling

Your own site · 80×15
<a href="https://agentmods.dev/skills/tensormux/kernel-skills/optimize-shared-memory-tiling"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/optimize-shared-memory-tiling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,517 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.03517
Opus 5.5 $0.00000 $0.01407
Sonnet 5.5 $0.00000 $0.00703
Haiku 4.5 $0.00000 $0.00352

Measured 3mo ago against content hash fbcb393862b0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

optimize-shared-memory-tiling 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 3mo 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.

skills/cuda/optimize-shared-memory-tiling/SKILL.md · 110 lines

How it starts

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

Skill: Optimize Shared Memory Tiling

Purpose

Guide the agent through designing and tuning shared memory tiling strategies for CUDA kernels, covering bank conflict analysis and elimination, tile shape selection, double buffering with async copy, occupancy tradeoffs from shared memory allocation, and the decision of when smem tiling is worth the complexity.

Use this when

  • A kernel repeatedly reads the same global memory data from multiple threads and would benefit from staging through a shared memory tile (GEMM, convolution, stencil)
  • Profiling shows high shared memory bank conflict rates in Nsight Compute (l1tex__data_bank_conflicts_pipe_lsu_mem_shared)
  • You are designing the smem layout for a GEMM or attention tiling kernel and need to choose tile dimensions and padding
  • You are adding double buffering to overlap global memory loads with computation using cp.async on SM80+
  • An existing kernel has smem usage that limits occupancy and needs to be restructured

Do not use this when

  • The access pattern is truly random (no spatial reuse) and shared memory staging will not increase the reuse factor
  • The data is small enough to fit in L1 cache across all accesses without explicit smem management: compiler-managed L1 may be sufficient
  • The kernel is compute-bound and memory latency is not the bottleneck: smem tiling adds complexity without throughput benefit
  • The kernel is a simple elementwise operation with no data reuse: smem staging provides no benefit

Inputs the agent should gather first

  • Kernel type and access pattern: describe the data reuse structure — which threads reuse which elements, and along which dimension. E.g., in GEMM, each row of threads reuses a row of A and each column of threads reuses a column of B.
  • Tile shape context: what are the thread block dimensions (BM, BN, BK) or equivalent? How many threads are in the block?
  • Dtype and element size: fp32 (4 bytes), fp16 (2 bytes), int8 (1 byte) — affects how many elements map to a single bank.
  • Hardware target: SM architecture. On all current NVIDIA GPUs (Kepler through Hopper): 32 banks, 4-byte bank width (by default; can be configured to 8-byte via cudaDeviceSetSharedMemConfig). SM80+ has up to 164 KB smem per SM in some configurations.
  • Current smem usage: how many bytes of smem are currently allocated per block? How does this affect occupancy?
  • Whether async copy is applicable: SM80+ with cp.async, SM90 with cp.async.bulk (TMA). Is the kernel targeting those architectures?

Read the full file on GitHub · 110 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 3mo ago First seen · 110 lines · 0 tokens per session scan A fbcb393862b0

Subscribe to this mod's changes

optimize-shared-memory-tiling is a skill published in the GitHub repository tensormux/kernel-skills (93 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,517 tokens. 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

optimize-shared-memory-tiling compared with skills from other repositories

optimize-shared-memory-tiling next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
optimize-shared-memory-tilingtensormux/kernel-skillsSkill935mo agoMITA0Claude Code, Codex
design-impl-auditMagicKidd/Rokid-agentic-workflowSkill35mo agononeA0Claude Code, Codex
skill-creatorMagicKidd/Rokid-agentic-workflowSkill35mo agononeA45Claude Code, Codex
brainstormingMagicKidd/Rokid-agentic-workflowSkill35mo agononeA0Claude Code, Codex
diagnoseMagicKidd/Rokid-agentic-workflowSkill35mo agononeA66Claude Code, Codex
prompt-engineeringMagicKidd/Rokid-agentic-workflowSkill35mo agononeA0Claude Code, Codex
setup-matt-pocock-skillsMagicKidd/Rokid-agentic-workflowSkill35mo agononeA124Claude Code