tilelang-cuda-memory

Optimize TileLang CUDA memory access with shared memory tiling and swizzled layouts.

258|48|Updated Jun 22, 2020
One-click install
npx skills add https://github.com/mindspore-ai/akg --skill tilelang-cuda-memory-mindspore-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tilelang-cuda-memory
Source: https://github.com/mindspore-ai/akg/tree/main/akg_agents/python/akg_agents/op/resources/skills/tilelang-cuda/guides/tilelang-cuda-memory
Command: npx skills add https://github.com/mindspore-ai/akg --skill tilelang-cuda-memory-mindspore-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TileLang CUDA memory access optimization strategies to reduce bandwidth bottlenecks and bank conflicts, enabling more efficient kernel data movement.

Core Features & Use Cases

  • Shared memory and register tiling using T.alloc_shared and T.alloc_fragment to cache data and accelerate computation.
  • Data layout optimization and bank conflict avoidance through layout annotations and swizzle techniques.
  • Coalesced global memory transfers and pipelined data loads to improve throughput in memory-bound TileLang kernels.
  • Practical use: enhancing GEMM or stencil-like kernels where memory bandwidth dominates compute.

Quick Start

Apply TileLang CUDA memory optimization to an existing kernel by replacing naive memory access with shared memory tiling and swizzled layouts, then verify performance gains.

Frequently Asked Questions about tilelang-cuda-memory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize CUDA shared memory bank conflicts in TileLang kernels?

To resolve CUDA shared memory bank conflicts in TileLang, apply layout annotations and use the T.use_swizzle technique. This optimizes data layout patterns to avoid memory access collisions, maximizing bandwidth in memory-bound kernels.

How do I use shared memory tiling to improve CUDA kernel bandwidth?

Improve CUDA kernel bandwidth by caching data with T.alloc_shared and T.alloc_fragment. These TileLang primitives enable shared memory and register tiling, accelerating computation by reducing global memory access latency in memory-bound operations.

Can I optimize memory-bound GEMM kernels using TileLang CUDA backend?

Yes, you can optimize memory-bound GEMM kernels using the TileLang CUDA backend. It targets bandwidth bottlenecks by leveraging coalesced global memory transfers, pipelined data loads, and swizzled layouts to significantly improve throughput.

What is the best way to implement coalesced global memory transfers in TileLang?

The best way to implement coalesced global memory transfers in TileLang is by replacing naive memory access with shared memory tiling and swizzled layouts. This ensures efficient data movement and improves overall kernel throughput.

Do I need specific kernel templates to use TileLang memory optimization?

Yes, you need kernel templates for A_shared, B_shared, and C_local. The optimization requires using T.alloc_shared, T.alloc_fragment, and T.use_swizzle to restructure memory access patterns within the TileLang CUDA backend environment.