What it does
CUDA Agent: Large-Scale Agentic RL for High-Performance CUDA Kernel Generation
- Connects Instruction files the AI reads
- Account or key No key found in README or SKILL.md
- Category Automation and agents
For makers: add a badge to your README
If you made this, paste this code into your README. The badge links back to this page.
[](https://mcp.popnx.com/en/skills/bytedtsinghua-sia-cuda-agent)Similar Skills
Same kind of work, ordered like the Skills list
1 skills (instruction sets) by BytedTsinghua-SIA that an AI reads and follows · not an MCP server
How a Skill differs from MCP
MCP = the hands
Connects the AI to an outside service or data, such as reading Notion or creating an invoice. A program or server has to be running.
Skill = the manual
A text file that teaches the AI how to do a task. It connects to nothing.
Some overlap: a few Skills run scripts that call tools, and a few MCP servers only send knowledge. Start from the task you want done.
Works with
Not stated by the maker · SKILL.md skills work in apps that support Agent Skills, such as Claude Code, Codex and Cursor
Install
Is it safe?
- Who made it
GitHub account BytedTsinghua-SIA (organization), 1 years old
- Use and upkeep
★ 1,358 stars · code last changed Jul 8, 2026
- Any scripts?
7 scripts that can run on a computer: model.py, model_new.py, utils/__init__.py, utils/compile.py and 3 more
- Uses the internet?
No internet calls found in the scripts
- Changes machine-wide settings?
No hooks or writes to machine settings found
Checked automatically from the repo files at commit 473025c (read only, nothing was run). Not a safety guarantee: read it and decide for yourself
First: which AI do you use?
Pick your app and this page shows only how to install it there
Option 1Upload to claude.ai (web and app)
Download from GitHub
This skill has no license, so we do not hand out a ZIP from our site. Download it from GitHub and arrange the folder yourself, or use "Let the AI install it" above, which is easier
Download from GitHub (whole repo) ↗
Unzip it, then zip only the agent_workdir folder again. The ZIP must have a agent_workdir folder with SKILL.md at the top level, no loose files
Open Skills on claude.ai and upload
+Create skillUpload a skillpick agent_workdir.zip
No Upload button? Turn on file creation first
SettingsCapabilitiesCode execution and file creation
Turn on Code execution and file creation first (newer menus: Create and edit files) · personal plans: Settings → Capabilities · Team/Enterprise: an admin turns it on under Organization settings → Plugins & skills · every plan, including Free
Upload once; it works in claude.ai and Claude Desktop, and in recent Claude Code signed in with a Claude account (not with an API key)
Cowork and cloud sessions use the skills turned on in your claude.ai account, not ~/.claude/skills on your computer (Claude Desktop scheduled tasks run locally and still load it)
Checked against official docs Nov 12, 2026 · Source: support.claude.com, support.claude.com, code.claude.com
Option 1Let Claude Code install it
Copy this sentence and paste it into a Claude Code chat
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Restart Claude Code, then type /agent_workdir or ask for a matching task and Claude picks it up
Checked against official docs Nov 12, 2026 · Source: code.claude.com
For Terminal users
A Skill is instructions the AI will follow. Read the files before installing, and install only from makers you trust.
Open Terminal
Mac: press Command+Space and type Terminal · Windows: the command below does not work in PowerShell; use “Let AI install it” above instead
Copy the skill folder to ~/.claude/skills
This downloads the repo to a temporary folder and copies only the folders that contain a SKILL.md
git clone --depth 1 https://github.com/bytedtsinghua-sia/cuda-agent.git /tmp/popnx-skill-bytedtsinghua-sia-cuda-agent-473025c && mkdir -p ~/.claude/skills && cp -R '/tmp/popnx-skill-bytedtsinghua-sia-cuda-agent-473025c/agent_workdir' ~/.claude/skills/agent_workdirRestart Claude Code, then type /agent_workdir or ask for a matching task and Claude picks it up
ChatGPT desktop app
The ChatGPT desktop app has Codex built in, and Codex reads skills from ~/.agents/skills
Option 1Let ChatGPT install it
Open Codex in the ChatGPT desktop app and paste this sentence into the chat
The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Option 2Put the folder there yourself
Put the agent_workdir folder at ~/.agents/skills/agent_workdir
~ is your home folder ($HOME)
For Terminal users
A Skill is instructions the AI will follow. Read the files before installing, and install only from makers you trust.
Open Terminal
Mac: press Command+Space and type Terminal · Windows: the command below does not work in PowerShell; use “Let AI install it” above instead
Copy the skill folder to ~/.agents/skills
This downloads the repo to a temporary folder and copies only the folders that contain a SKILL.md
git clone --depth 1 https://github.com/bytedtsinghua-sia/cuda-agent.git /tmp/popnx-skill-bytedtsinghua-sia-cuda-agent-473025c && mkdir -p ~/.agents/skills && cp -R '/tmp/popnx-skill-bytedtsinghua-sia-cuda-agent-473025c/agent_workdir' ~/.agents/skills/agent_workdir
After installing
- ChatGPT desktop app: open Skills in the sidebar to see that the skill is there
- To use it: in ChatGPT type @ and pick the skill · in Codex CLI or the IDE extension run /skills or type $ and the skill name
- Codex picks up newly installed skills by itself; if one does not show up, restart Codex
Checked against official docs Nov 15, 2026 · Source: learn.chatgpt.com
ChatGPT on the web and mobile
Skills you install yourself do not work here; only skills that come with a plugin from the directory
To use this skill with ChatGPT, use the ChatGPT desktop app as above
Checked against official docs Nov 15, 2026 · Source: learn.chatgpt.com
Option 1Let Codex install it
Copy this sentence and paste it into a Codex chat · Works in Codex inside the ChatGPT desktop app, Codex CLI and the IDE extension
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Codex picks up newly installed skills by itself; if one does not show up, restart Codex · To use it: in ChatGPT type @ and pick the skill · in Codex CLI or the IDE extension run /skills or type $ and the skill name
Checked against official docs Nov 15, 2026 · Source: learn.chatgpt.com
For Terminal users
A Skill is instructions the AI will follow. Read the files before installing, and install only from makers you trust.
Open Terminal
Mac: press Command+Space and type Terminal · Windows: the command below does not work in PowerShell; use “Let AI install it” above instead
Copy the skill folder to ~/.agents/skills
This downloads the repo to a temporary folder and copies only the folders that contain a SKILL.md
git clone --depth 1 https://github.com/bytedtsinghua-sia/cuda-agent.git /tmp/popnx-skill-bytedtsinghua-sia-cuda-agent-473025c && mkdir -p ~/.agents/skills && cp -R '/tmp/popnx-skill-bytedtsinghua-sia-cuda-agent-473025c/agent_workdir' ~/.agents/skills/agent_workdirRestart Codex, then ask for a matching task; Codex lists the skill
Option 1Let Cursor install it
Copy this sentence and paste it into a Cursor chat
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
In Cursor’s Agent chat, type / and pick agent_workdir
Checked against official docs Nov 12, 2026 · Source: cursor.com
For Terminal users
A Skill is instructions the AI will follow. Read the files before installing, and install only from makers you trust.
Open Terminal
Mac: press Command+Space and type Terminal · Windows: the command below does not work in PowerShell; use “Let AI install it” above instead
Copy the skill folder to ~/.cursor/skills
This downloads the repo to a temporary folder and copies only the folders that contain a SKILL.md
git clone --depth 1 https://github.com/bytedtsinghua-sia/cuda-agent.git /tmp/popnx-skill-bytedtsinghua-sia-cuda-agent-473025c && mkdir -p ~/.cursor/skills && cp -R '/tmp/popnx-skill-bytedtsinghua-sia-cuda-agent-473025c/agent_workdir' ~/.cursor/skills/agent_workdirIn Cursor’s Agent chat, type / and pick agent_workdir
Option 1Let the AI install it
For other apps that read skills. The sentence gives the paths for Claude Code, Codex and Cursor so the AI picks the one for your app · Copy this sentence into the app’s chat
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Checked against official docs Nov 12, 2026 · Source: code.claude.com, learn.chatgpt.com, cursor.com
For Terminal users
Other apps that support Agent Skills (such as Gemini CLI or GitHub Copilot) use different folders. Check that app’s guide, then copy the folder with the SKILL.md there.
Skill folders checked against the official Claude Code, Codex and Cursor guides on Nov 11, 2026
✓ Commands checked Nov 18, 2026
View the original SKILL.md
The text below comes from the maker’s repo, not from PopNx MCP
Showing the first 8,000 characters · Open the full file on GitHub
You are a PyTorch and CUDA expert. Accelerate the given PyTorch Model by creating a high-performance CUDA C++ extension, targeting the best possible performance with a minimum requirement of 5% faster than torch.compile baseline.
## 1. CRITICAL RESTRICTIONS
### ⚠️ STRICTLY FORBIDDEN
- **NO torch operators in C++**: NEVER use `torch::*` or `torch::nn::functional::*` in binding.cpp or .cu files
- **NO torch operations in model_new.py**: Only tensor creation and your custom ops allowed
- **NO third-party libraries**: Except cuBLAS (GEMM only) and cuDNN (Conv only)
- **NO modifications to utils/ directory**
- **NO modifications to binding.cpp or binding_registry.h**: These are fixed infrastructure
### ✅ ALLOWED ONLY
- **C++**: Raw CUDA kernels (for custom ops), cuBLAS (for GEMM), cuDNN (MANDATORY for Conv/ConvTranspose)
- **Python**: torch.tensor creation, custom extension ops, tensor properties (.shape, .device)
- **Memory**: torch::empty_like for allocation only
- **Focus**: Implement kernels in `kernels/` directory only
## 2. WORKSPACE STRUCTURE
```
.
├── binding_registry.h # Do NOT modify - registration system
├── binding.cpp # Do NOT modify - main module binding
├── kernels/ # YOUR WORK: Implement all kernels here
├── utils/ # DO NOT modify - Compilation, verification and profiling tools
├── model.py # DO NOT modify - Original PyTorch model
└── model_new.py # YOUR WORK: Your optimized model using custom ops.
```
### File Types and Usage
- **`.cu` files**: CUDA kernels with `__global__` functions (custom implementations)
- **`.cpp` files**: cuDNN/cuBLAS API calls (NO custom kernels)
- **`_binding.cpp` files**: PyTorch tensor handling and Python bindings
## 3. UNIFIED WORKFLOW
### Step 1: Implementation
Create paired files in `kernels/`:
**kernels/my_kernel.cu** (Pure CUDA implementation):
```cuda
#include <cuda_runtime.h>
// Template kernel for performance tuning
template<int BLOCK_SIZE, int TILE_SIZE>
__global__ void my_kernel_impl(float* output, const float* input, int size) {
// Shared memory for tiling
extern __shared__ float smem[];
int tid = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
// Grid-stride loop for large data
for (int i = tid; i < size; i += stride) {
// Kernel logic with optimizations
output[i] = /* computation */;
}
}
// C-interface launcher (no PyTorch dependencies)
extern "C" void my_kernel_launcher(
float* output,
const float* input,
int size,
int config,
cudaStream_t stream
) {
// Dynamic configuration selection
int blocks = (size + 255) / 256;
int shared_mem_size = 0;
switch(config) {
case 0:
shared_mem_size = 256 * sizeof(float);
my_kernel_impl<256, 16><<<blocks, 256, shared_mem_size, stream>>>(
output, input, size);
break;
case 1:
shared_mem_size = 128 * sizeof(float);
my_kernel_impl<128, 32><<<blocks, 128, shared_mem_size, stream>>>(
output, input, size);
break;
default:
my_kernel_impl<256, 16><<<blocks, 256, 0, stream>>>(
output, input, size);
}
}
```
**kernels/my_kernel_binding.cpp** (PyTorch binding):
```cpp
// Use this two headers to replace torch/extension.h for faster compilation
#include <torch/types.h>
#include <torch/csrc/utils/pybind.h>
#include <cuda_runtime.h>
#include <c10/cuda/CUDAStream.h>
#include "../binding_registry.h"
// Declare launcher from .cu file
extern "C" void my_kernel_launcher(
float* output,
const float* input,
int size,
int config,
cudaStream_t stream
);
// PyTorch wrapper with config parameter
torch::Tensor my_kernel_forward(torch::Tensor input, int config = 0) {
// Input validation
TORCH_CHECK(input.is_cuda(), "Input must be a CUDA tensor");
TORCH_CHECK(input.is_contiguous(), "Input must be contiguous");
TORCH_CHECK(input.dtype() == torch::kFloat32, "Input must be float32");
auto output = torch::empty_like(input);
// Get current CUDA stream (correct way)
cudaStream_t stream = c10::cuda::getCurrentCUDAStream().stream();
// Call CUDA launcher with config
my_kernel_launcher(
output.data_ptr<float>(),
input.data_ptr<float>(),
input.numel(),
config,
stream
);
return output;
}
// Registration function
void register_my_kernel(pybind11::module& m) {
m.def("my_kernel_forward", &my_kernel_forward,
"My kernel forward",
py::arg("input"),
py::arg("config") = 0);
}
// Auto-register
REGISTER_BINDING(my_kernel, register_my_kernel);
```
#### Create model_new.py
```python
import torch
import torch.nn as nn
import cuda_extension
class ModelNew(nn.Module):
def __init__(self, ...): # MUST match Model signature exactly
super().__init__()
# Initialize parameters - preserve original structure for state_dict compatibility
self.weight = nn.Parameter(torch.randn(...))
self.bias = nn.Parameter(torch.zeros(...))
def forward(self, x):
# Use custom ops only - NO torch operations
x = cuda_extension.my_kernel_forward(x, config=0)
x = cuda_extension.gemm_forward(x, self.weight, self.bias)
return x
```
### Step 2: Compile and Test
```bash
# Compile with architecture-specific optimizations
TORCH_CUDA_ARCH_LIST=9.0 bash utils/compile.sh
# Test in sandbox
sudo python3 -m utils.verification
sudo python3 -m utils.profiling
```
### Step 3: Performance Optimization (IF NEEDED)
#### 3.1 Optimization Strategy (Priority Order)
**Priority 1: Algorithmic (>50% impact)**
- Kernel fusion - reduce memory traffic
- Shared memory tiling - improve data reuse
- Memory coalescing - consecutive access patterns
**Priority 2: Hardware Utilization (20-50% impact)**
- Vectorized loads (float2/float4)
- Warp-level primitives (__shfl_sync, __ballot_sync)
- Occupancy tuning (block size, register usage)
**Priority 3: Fine-tuning (<20% impact)**
- Instruction-level parallelism
- Mixed precision (FP16/TF32)
- Prefetching and double buffering
#### 3.2 Parameter Tuning (Last Resort)
Only when within 1.2x of target and algorithmic options exhausted:
```python
# tune_kernel.py - NO recompilation needed
import time, torch, cuda_extension
configs = [
(0, "256_threads_16_tile"),
(1, "128_threads_32_tile"),
(2, "512_threads_8_tile")
]
# Test input
x = torch.randn(batch_size, features).cuda()
# Benchmark each config
best_config, best_time = 0, float('inf')
for config_id, name in configs:
# Warmup
for _ in range(10):
cuda_extension.my_kernel_forward(x, config=config_id)
torch.cuda.synchronize()
# Measure
start = time.perf_counter()
for _ in range(100):
cuda_extension.my_kernel_forward(x, config=config_id)
torch.cuda.synchronize()
elapsed = time.perf_counter() - start
print(f"Config {name}: {elapsed:.4f}s")
if elapsed < best_time:
best_time, best_config = elapsed, config_id
print(f"Best: config {best_config} ({best_time:.4f}s)")
# Update model_new.py with best_config
```
### Step 4: Iteration Requirements
#### Correctness Failures
**MUST iterate until correctness passes - NO EXCEPTIONS**
1. Debug the specific failing kernel
2. Common issues to check:
- Boundary conditions (tid < size)
- Synchronization (__syncthreads placement)
- Data types and precision
- Memory alignment
3. Fix in kernels/*.cu and *_binding.cpp ONLY
4. Recompile and test
#### Performance Optimization
**GOAL: Achieve the best possible performance (the faster, the better!)**
**MINIMUM: Must be at least 5% faster than torch.compile baseline**
For each iteration:
1. **Document expectation**: "Fusion will eliminate 3 kernels, expect ~20% speedup"
2. **Apply optimization aggressively**: DDiscussion
Ask, share a tip or report that it does not work. Sorted by what people marked helpful.
No posts yet. Be the first to ask or share.
Posts here are written by users, not the PopNx team.
From GitHub
- GitHub stars
- 1,358
- Maker
- BytedTsinghua-SIA
- License
- No license stated This repo states no license. By default the author keeps all rights: ask before you share it or use it commercially.
- Last code change
- Jul 8, 2026
- SKILL.md files in the repo (including translated copies and templates)
- 1