tilelang-cuda-synchronization

Standardize T.sync_threads usage for safe TileLang CUDA kernel generation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TileLang CUDA synchronization ensures correct and deadlock-free kernel generation by standardizing the use of T.sync_threads(), preventing common thread-safety pitfalls in shared-memory CUDA kernels.

Core Features & Use Cases

  • Strict rules for T.sync_threads() usage to avoid deadlocks and race conditions.
  • Guidance on when and how to synchronize around shared memory allocations and reads.
  • Real-world scenarios for multi-thread collaboration and kernel correctness with TileLang DSL.

Quick Start

Provide a safe TileLang CUDA kernel example that uses T.sync_threads() after all writes to shared memory.

Frequently Asked Questions about tilelang-cuda-synchronization

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

FAQPage Schema
How do I prevent deadlocks when using T.sync_threads in TileLang CUDA kernels?

To prevent deadlocks in TileLang CUDA kernels, use T.sync_threads safely by avoiding conditional synchronization and ensuring all threads participate in the synchronization barrier.

What is the correct way to synchronize shared memory reads in TileLang?

Synchronizing shared memory in TileLang requires calling T.sync_threads after all threads complete their writes to shared memory, preventing race conditions during multi-thread collaboration.

Why does my TileLang CUDA kernel hang with conditional synchronization?

Your TileLang CUDA kernel hangs because conditional synchronization causes deadlocks; all threads must reach T.sync_threads uniformly, so avoid placing synchronization inside divergent control flow.

Do I need to use built-in reductions for thread-safety in TileLang CUDA?

Yes, using built-in reductions in TileLang CUDA is required for thread-safety, as they internally manage synchronization and prevent race conditions during multi-thread collaboration.

Does TileLang support standardizing thread synchronization across different CUDA backends?

TileLang supports standardizing thread synchronization across CUDA backends by enforcing strict T.sync_threads usage rules, ensuring deadlock-free kernel generation and shared memory safety.