--- license: mit pretty_name: KernelStrain task_categories: - text-generation tags: - code - cuda - triton - gpu-kernels - kernel-optimization - synthetic-dataset - sft - pytorch - llm-training size_categories: - 100K ⚠️ **All benchmark numbers are produced by an analytic roofline-style simulator — no kernel in this dataset was ever compiled or executed.** Timings are plausible, not measured. Kernel source is realistic-looking but unverified; use it for training dynamics, not as production code. ## At a glance | | | |---|---| | Episodes | 11,514 | | SFT step rows | ~282k | | Multiturn conversations | 11,514 | | Holdout tasks | 185 (descriptions only, no solutions) | | Op modules | 57 (45 distinct ops × CUDA/Triton impls) | | Avg steps / episode | ~24.5 | | Step statuses | ~94% ok, ~2.6% wrong-result, ~3.3% compile-error | | GPU targets | A100 (sm_80), H100 (sm_90), RTX 4090, MI300X (gfx942) | ## Coverage Kernels spanning AI **inference and training**: - **Attention**: flash prefill, paged decode, MLA decode (latent KV), sliding-window, cross-attention, tree attention (speculative decoding), flash attention backward - **Norms**: RMSNorm, LayerNorm, fused add+RMSNorm, LayerNorm backward - **Activations/fusions**: SwiGLU fwd/bwd, bias+GELU, dropout (Philox) - **Matmul**: fp16 GEMM/GEMV, int4/int8 GEMM, fp8 GEMM, blockwise-scaled fp8 GEMM (DeepGEMM-style), grouped GEMM - **Training**: AdamW, Adafactor, grad clipping, cross-entropy fwd/bwd, embedding fwd/bwd, reductions, prefix scan - **Quant**: fp8 tensor quant, int8 KV-cache quant - **Sampling**: top-k, nucleus (top-p) — sort, histogram-refine, and CDF-pick strategies - **SSM/conv**: Mamba selective scan (CUDA + Triton), causal Conv1D - **MoE**: scatter, grouped GEMM, combine - **Misc**: RoPE, transpose, KV-cache append, embedding gather Optimization patterns exercised: vectorized loads (uint4/float4/half2), shared-memory staging, cp.async pipelines, TMA, warp shuffles, online softmax, split-K/split-KV with combine kernels, persistent kernels, tensor-core mma/wgmma, atomics, multi-kernel decompositions, occupancy/tile tuning — plus realistic failures: arch-gated compile errors (sm_90-only wgmma, no fp8 on A100, PTX on ROCm), shared-memory overflows, and wrong-result regressions that get reverted. ## Files | file | format | contents | |---|---|---| | `episodes.jsonl` | jsonl | Raw episodes — every step with full source, params, status, timing, smem, keep/revert decisions | | `sft_multiturn.jsonl` | chat | Multi-turn conversations; assistant turns contain **complete kernel code only** (no reasoning traces) | | `sft_steps.jsonl` | chat | One row per transition: task + history + current-best → next candidate | | `tasks_holdout.jsonl` | jsonl | Held-out task prompts without solutions (~8% of combos) | | `stats.json` | json | Generation statistics | Feedback messages report **best-so-far** only — no future information leaks into context. ## Usage ```python from datasets import load_dataset # step-level SFT rows ds = load_dataset("Akahsizrr/kernelstrain", "sft_steps", split="train") # full multiturn episodes mt = load_dataset("Akahsizrr/kernelstrain", "sft_multiturn", split="train") ``` ## Generation Pure-stdlib simulator: `time = max(memory_time, compute_time) + launch_overhead`, with GPU-specific peaks, tunable efficiency scaling, arch/smem gates, and Gaussian rebench noise. Deterministic from seed. Source: the `kernelstrain` generator. ## Caveats - Perf numbers are analytic-model-plausible, **not measured** — the simulator can occasionally rank variants differently than real hardware would. - Kernel code is unverified; some templates may contain bugs that a real compiler would catch. - Assistant outputs are intentionally code-only; there are no reasoning/CoT traces by design. ## License MIT