<< All versions

Skill v1.0.0

currentLLM-judged scan90/100
alizainx/intelligence-systems-skills/cuda-cpp-warp-tensor
──Details
PublishedOctober 21, 2026 at 03:26 PM
Content Hashsha256:579e5c64eab05b33...
Git SHA5d098c90c1e6
──Files
Files (1 file, 1.6 KB)
SKILL.md1.6 KBactive
SKILL.md · 26 lines · 1.6 KB

version: "1.0.0" name: cuda-cpp-warp-tensor id: ISS-044 token_budget: 700 chain_with: [triton-cutlass-fused-gpu-kernels, opencl-heterogeneous-kernels, roofline-ilp-simd-optimization] description: "CUDA C++ coalesced memory access, shared-memory bank-conflict padding, warp-level __shfl_sync reductions, and Tensor Core WMMA/MMA."


cuda-cpp-warp-tensor (ISS-044)

1. First-Principles Invariant

  • Nickolls SIMT Warp-Coalescing Law: Consecutive threads (threadIdx.x = 0..31) in a warp must access consecutive 4/8/16-byte addresses within a 128-byte cache line, with zero warp divergence and zero shared-memory 32-bank conflicts.

2. Fast-Pass Low-Token Protocol (Web & Coding Agents)

  • Perform intra-warp reductions in registers via __shfl_down_sync(0xffffffffu, val, offset) before writing 1 scalar per warp to __shared__ memory.

3. Zero-Bug & Zero-Vulnerability Guards

  1. Wrap every cudaMalloc/cudaMemcpy/cudaStreamSynchronize and kernel launch (cudaGetLastError()) in a deterministic CUDA_CHECK(err) macro.
  2. Pad 2D __shared__ tiles by +1 column (__shared__ float tile[32][33];) to eliminate 32-way bank conflicts on column striding.
  3. Always pass an explicit mask (0xffffffffu or __activemask()) to warp-synchronous intrinsics (__shfl_*_sync, __ballot_sync).
  4. Overlap H2D/D2H transfers with compute using pinned host memory (cudaMallocHost) and multiple non-blocking cudaStream_t streams.
  5. Verify race-free shared memory accesses and out-of-bounds global pointers with compute-sanitizer --tool memcheck and racecheck.

4. Verification Gate

  • nvcc -std=c++17 -O3 -arch=sm_80 -Xcompiler -Wall,-Wextra,-Werror
All versions