Skip to content

Commit 08d5bce

Browse files
Update docs
1 parent 9434abc commit 08d5bce

4 files changed

Lines changed: 654 additions & 1 deletion

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# CUDA/CUDART/NVRTC Stubs
2+
3+
This document describes the stub mechanism in TileLang for CUDA-related libraries.
4+
5+
## Purpose
6+
7+
1. **CUDA Driver (`cuda`)**: Allows TileLang to be imported on systems without a GPU (e.g., CI/compilation nodes) by lazy-loading `libcuda.so` only when needed.
8+
2. **Runtime & Compiler (`cudart`, `nvrtc`)**: Resolves SONAME versioning mismatches, enabling a single build to work across different CUDA versions. This is achieved by reusing the existing CUDA runtime loaded by frameworks like PyTorch.
9+
10+
## Implementation
11+
12+
The stubs in `src/target/stubs/` implement a lazy-loading mechanism:
13+
14+
- **Lazy Loading**: Libraries are loaded via `dlopen` only upon the first API call.
15+
- **Global Symbol Reuse**: For `cudart` and `nvrtc`, the stubs first check the global namespace (`RTLD_DEFAULT`) to use any already loaded symbols (e.g., from PyTorch).
16+
- **Versioning Support**: Handles ABI differences between CUDA versions (e.g., `cudaGraphInstantiate` changes in CUDA 12).
17+
18+
## Build Option
19+
20+
`TILELANG_USE_CUDA_STUBS` (Default: `ON`) controls this behavior. When enabled, TileLang links against these stubs instead of the system CUDA toolkit.

objects.inv

36 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)