Required prerequisites
What version of TileLang are you using?
0.1.9
System information
addict 2.4.0
aiohappyeyeballs 2.6.1
aiohttp 3.13.5
aiosignal 1.4.0
anaconda-anon-usage 0.7.6
anaconda-auth 0.14.2
anaconda-cli-base 0.8.2
annotated-types 0.6.0
anyio 4.12.1
apache-tvm-ffi 0.1.11
archspec 0.2.5
attrs 26.1.0
beautifulsoup4 4.14.3
boltons 25.0.0
brotlicffi 1.2.0.0
certifi 2026.4.22
cffi 1.17.1
charset-normalizer 3.4.4
click 8.2.1
cloudpickle 3.1.2
conda 26.3.2
conda-anaconda-telemetry 0.3.0
conda-anaconda-tos 0.2.2
conda-content-trust 0.3.1
conda-libmamba-solver 26.4.0
conda-package-handling 2.4.0
conda_package_streaming 0.12.0
contourpy 1.3.3
cryptography 45.0.7
cuda-bindings 13.2.0
cuda-pathfinder 1.5.4
cuda-python 13.2.0
cuda-toolkit 13.0.2
cycler 0.12.1
datasets 4.8.5
dill 0.4.1
distro 1.9.0
einops 0.8.2
filelock 3.29.0
fonttools 4.62.1
frozendict 2.4.6
frozenlist 1.8.0
fsspec 2026.2.0
gdown 6.0.0
gram-newton-schulz 0.1.4
h11 0.16.0
hf-xet 1.5.0
httpcore 1.0.9
httpx 0.28.1
huggingface_hub 1.14.0
idna 3.11
jaraco.classes 3.4.0
jaraco.context 6.1.0
jaraco.functools 4.4.0
jeepney 0.7.1
Jinja2 3.1.6
joblib 1.5.3
jsonpatch 1.33
jsonpointer 3.1.1
keyring 25.7.0
kiwisolver 1.5.0
libmambapy 2.3.2
markdown-it-py 4.0.0
MarkupSafe 3.0.3
matplotlib 3.10.9
mdurl 0.1.2
menuinst 2.4.2
ml_dtypes 0.5.4
modelscope 1.36.3
more-itertools 11.0.2
mpmath 1.3.0
msgpack 1.1.1
multidict 6.7.1
multiprocess 0.70.19
networkx 3.6.1
numpy 2.4.4
nvidia-cublas 13.1.0.3
nvidia-cuda-cupti 13.0.85
nvidia-cuda-nvrtc 13.0.88
nvidia-cuda-runtime 13.0.96
nvidia-cudnn-cu13 9.19.0.56
nvidia-cufft 12.0.0.61
nvidia-cufile 1.15.1.6
nvidia-curand 10.4.0.35
nvidia-cusolver 12.0.4.66
nvidia-cusparse 12.6.3.3
nvidia-cusparselt-cu13 0.8.0
nvidia-cutlass-dsl 4.4.2
nvidia-cutlass-dsl-libs-base 4.4.2
nvidia-nccl-cu13 2.28.9
nvidia-nvjitlink 13.0.88
nvidia-nvshmem-cu13 3.4.5
nvidia-nvtx 13.0.85
packaging 26.0
pandas 3.0.2
pillow 12.2.0
pip 26.0.1
pkce 1.0.3
platformdirs 4.9.4
pluggy 1.6.0
propcache 0.4.1
psutil 7.2.2
pyarrow 24.0.0
pycosat 0.6.6
pycparser 3.0
pydantic 2.13.2
pydantic_core 2.46.2
pydantic-settings 2.12.0
Pygments 2.20.0
PyJWT 2.12.1
pyparsing 3.3.2
PySocks 1.7.1
python-dateutil 2.9.0.post0
python-dotenv 1.2.1
PyYAML 6.0.3
quack-kernels 0.4.1
readchar 4.2.1
requests 2.33.1
rich 14.2.0
ruamel.yaml 0.18.16
ruamel.yaml.clib 0.2.14
scikit-learn 1.8.0
scipy 1.17.1
SecretStorage 3.5.0
semver 3.0.4
setuptools 81.0.0
shellingham 1.5.4
six 1.17.0
soupsieve 2.8.3
sympy 1.14.0
threadpoolctl 3.6.0
tilelang 0.1.9
tomli 2.4.0
tomlkit 0.13.3
torch 2.11.0
torch_c_dlpack_ext 0.1.5
torchvision 0.26.0
tqdm 4.67.3
triton 3.6.0
truststore 0.10.1
typer 0.20.0
typer-slim 0.20.0
typing_extensions 4.15.0
typing-inspection 0.4.2
urllib3 2.6.3
wheel 0.46.3
xxhash 3.7.0
yarl 1.23.0
z3-solver 4.15.4.0
zstandard 0.25.0
Collecting environment information...
PyTorch version: 2.11.0+cu130
Is debug build: False
CUDA used to build PyTorch: 13.0
ROCM used to build PyTorch: N/A
OS: Arch Linux (x86_64)
GCC version: (GCC) 16.1.1 20260430
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.43
Python version: 3.13.13 | packaged by Anaconda, Inc. | (main, Apr 14 2026, 06:19:41) [GCC 14.3.0] (64-bit runtime)
Python platform: Linux-7.0.3-arch1-2-x86_64-with-glibc2.43
Is CUDA available: True
CUDA runtime version: 13.2.78
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4090
Nvidia driver version: 595.71.05
cuDNN version: Could not collect
Is XPU available: False
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Caching allocator config: N/A
CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 48 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 9 7950X 16-Core Processor
CPU family: 25
Model: 97
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 16
Stepping: 2
Microcode version: 0xa60120a
BogoMIPS: 8962.93
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl xtopology cpuid extd_apicid pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw perfctr_core ssbd perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512_bf16 clzero xsaveerptr wbnoinvd arat npt lbrv nrip_save tsc_scale vmcb_clean flushbyasid pausefilter pfthreshold vgif vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov succor fsrm flush_l1d
Virtualization: AMD-V
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 8 MiB (16 instances)
L3 cache: 256 MiB (16 instances)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Ghostwrite: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Old microcode: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Mitigation; Safe RET
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP disabled; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsa: Vulnerable: No microcode
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
Versions of relevant libraries:
[pip3] numpy==2.4.4
[pip3] nvidia-cublas==13.1.0.3
[pip3] nvidia-cuda-cupti==13.0.85
[pip3] nvidia-cuda-nvrtc==13.0.88
[pip3] nvidia-cuda-runtime==13.0.96
[pip3] nvidia-cudnn-cu13==9.19.0.56
[pip3] nvidia-cufft==12.0.0.61
[pip3] nvidia-curand==10.4.0.35
[pip3] nvidia-cusolver==12.0.4.66
[pip3] nvidia-cusparse==12.6.3.3
[pip3] nvidia-cusparselt-cu13==0.8.0
[pip3] nvidia-nccl-cu13==2.28.9
[pip3] nvidia-nvjitlink==13.0.88
[pip3] nvidia-nvtx==13.0.85
[pip3] torch==2.11.0
[pip3] torch_c_dlpack_ext==0.1.5
[pip3] torchvision==0.26.0
[pip3] triton==3.6.0
[conda] numpy 2.4.4 pypi_0 pypi
[conda] nvidia-cublas 13.1.0.3 pypi_0 pypi
[conda] nvidia-cuda-cupti 13.0.85 pypi_0 pypi
[conda] nvidia-cuda-nvrtc 13.0.88 pypi_0 pypi
[conda] nvidia-cuda-runtime 13.0.96 pypi_0 pypi
[conda] nvidia-cudnn-cu13 9.19.0.56 pypi_0 pypi
[conda] nvidia-cufft 12.0.0.61 pypi_0 pypi
[conda] nvidia-curand 10.4.0.35 pypi_0 pypi
[conda] nvidia-cusolver 12.0.4.66 pypi_0 pypi
[conda] nvidia-cusparse 12.6.3.3 pypi_0 pypi
[conda] nvidia-cusparselt-cu13 0.8.0 pypi_0 pypi
[conda] nvidia-nccl-cu13 2.28.9 pypi_0 pypi
[conda] nvidia-nvjitlink 13.0.88 pypi_0 pypi
[conda] nvidia-nvtx 13.0.85 pypi_0 pypi
[conda] torch 2.11.0 pypi_0 pypi
[conda] torch-c-dlpack-ext 0.1.5 pypi_0 pypi
[conda] torchvision 0.26.0 pypi_0 pypi
[conda] triton 3.6.0 pypi_0 pypi
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 595.71.05 Driver Version: 595.71.05 CUDA Version: 13.2 |
+-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4090 Off | 00000000:05:00.0 Off | Off |
| 0% 43C P8 34W / 450W | 15MiB / 24564MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 791 G /usr/lib/Xorg 4MiB |
+-----------------------------------------------------------------------------------------+
Problem description
See example code.
Reproducible example code
The Python snippets:
import tilelang
import tilelang.language as T
import torch
torch.manual_seed(42)
torch.cuda.manual_seed(42)
@tilelang.jit
def aat_int8(
M: int = 128,
K: int = 256,
BLOCK_M: int = 128,
BLOCK_N: int = 128,
BLOCK_K: int = 128,
threads: int = 128,
num_stages: int = 3,
dtype: str = "int8",
accum_dtype: str = "int32",
):
@T.prim_func
def kernel(
A: T.Tensor((M, K), dtype),
C: T.Tensor((M, M), accum_dtype),
):
with T.Kernel(
T.ceildiv(M, BLOCK_N), T.ceildiv(M, BLOCK_M), threads=threads
) as (pid_n, pid_m):
A_shared = T.alloc_shared((BLOCK_M, BLOCK_K), dtype)
B_shared = T.alloc_shared((BLOCK_N, BLOCK_K), dtype)
C_local = T.alloc_fragment((BLOCK_M, BLOCK_N), accum_dtype)
T.clear(C_local)
for k in T.Pipelined(
T.ceildiv(K, BLOCK_K), num_stages=num_stages
):
T.copy(A[pid_m * BLOCK_M, k * BLOCK_K], A_shared)
T.copy(A[pid_n * BLOCK_N, k * BLOCK_K], B_shared)
T.gemm(A_shared, B_shared, C_local, transpose_B=True)
T.copy(C_local, C[pid_m * BLOCK_M, pid_n * BLOCK_N])
return kernel
def ref_AAT(A_int8):
A32 = A_int8.to(torch.int32).to("cpu")
return torch.matmul(A32, A32.mT).to(A_int8.device)
def test(num_stages: int, M: int, K: int):
print(f"num_stages={num_stages} M={M} K={K} blocks={(K+127)//128}")
A = torch.randint(-127, 127, (M, K), device=0, dtype=torch.int8)
C_tl = torch.empty(M, M, device=0, dtype=torch.int32)
C_ref = ref_AAT(A)
ker = None
try:
ker = aat_int8(M=M, K=K, num_stages=num_stages)
ker(A, C_tl)
except Exception as e:
print(f" - Err: {e}")
return
n_errs = (C_tl != C_ref).sum().item()
print(" - Num of mismatch:", n_errs)
if n_errs >= 1:
print(C_tl)
print(C_ref)
print(ker.get_kernel_source())
test(3, 128, 256) # wrong answer
test(2, 128, 256) # correct
test(3, 128, 255) # correct
test(3, 128, 257) # compiler failed
test(2, 128, 129) # compiler failed
Traceback
For the first case test(3, 128, 256), the kernel silently produces a wrong answer.
num_stages=3 M=128 K=256 blocks=2
- Num of mismatch: 16384
tensor([[1171134, 27058, -138476, ..., 148282, 151147, 62613],
[ 29343, 1165848, 92173, ..., 61824, 56007, -50492],
[-138476, 75852, 1020452, ..., -117569, -36690, -67583],
...,
[ 148282, 94670, -117569, ..., 1006108, -109636, 23516],
[ 151147, 47286, -36690, ..., -109636, 955228, 35550],
[ 62613, -62324, -67583, ..., 23516, 35550, 1085433]],
device='cuda:0', dtype=torch.int32)
tensor([[1508477, 4870, -182059, ..., 128410, 117113, 18210],
[ 4870, 1308372, 85148, ..., 85536, 28356, -92316],
[-182059, 85148, 1384688, ..., -112614, -8759, -28854],
...,
[ 128410, 85536, -112614, ..., 1417738, 13202, 4121],
[ 117113, 28356, -8759, ..., 13202, 1268559, 43396],
[ 18210, -92316, -28854, ..., 4121, 43396, 1421857]],
For the 4th and 5th, the compiler fails.
[16:43:40] : Fatal: InternalError: Check failed: (IsValidCPAsyncTransferBytes(total_bytes)) is false: tl::ptx_cp_async requires a final PTX byte width in {4, 8, 16}, but got 1
- Err: Check failed: (IsValidCPAsyncTransferBytes(total_bytes)) is false: tl::ptx_cp_async requires a final PTX byte width in {4, 8, 16}, but got 1
Expected behavior
The first one test(3, 128, 256) yields totally wrong results, and is clearly a bug.
For test(3, 128, 257) and test(2, 128, 129), however, I recommend raising an explicit exception that the dimensions for int8 matrices must be multiples of 4. Still, the best solution is to resolve them completely.
Additional context
The first bug cannot be reproduced on another 5090 PC. However, test(3, 128, 257) and test(2, 128, 129) are reproducible across versions and machines.
Required prerequisites
What version of TileLang are you using?
0.1.9
System information
Problem description
See example code.
Reproducible example code
The Python snippets:
Traceback
For the first case test(3, 128, 256), the kernel silently produces a wrong answer. num_stages=3 M=128 K=256 blocks=2 - Num of mismatch: 16384 tensor([[1171134, 27058, -138476, ..., 148282, 151147, 62613], [ 29343, 1165848, 92173, ..., 61824, 56007, -50492], [-138476, 75852, 1020452, ..., -117569, -36690, -67583], ..., [ 148282, 94670, -117569, ..., 1006108, -109636, 23516], [ 151147, 47286, -36690, ..., -109636, 955228, 35550], [ 62613, -62324, -67583, ..., 23516, 35550, 1085433]], device='cuda:0', dtype=torch.int32) tensor([[1508477, 4870, -182059, ..., 128410, 117113, 18210], [ 4870, 1308372, 85148, ..., 85536, 28356, -92316], [-182059, 85148, 1384688, ..., -112614, -8759, -28854], ..., [ 128410, 85536, -112614, ..., 1417738, 13202, 4121], [ 117113, 28356, -8759, ..., 13202, 1268559, 43396], [ 18210, -92316, -28854, ..., 4121, 43396, 1421857]], For the 4th and 5th, the compiler fails. [16:43:40] : Fatal: InternalError: Check failed: (IsValidCPAsyncTransferBytes(total_bytes)) is false: tl::ptx_cp_async requires a final PTX byte width in {4, 8, 16}, but got 1 - Err: Check failed: (IsValidCPAsyncTransferBytes(total_bytes)) is false: tl::ptx_cp_async requires a final PTX byte width in {4, 8, 16}, but got 1Expected behavior
The first one
test(3, 128, 256)yields totally wrong results, and is clearly a bug.For
test(3, 128, 257)andtest(2, 128, 129), however, I recommend raising an explicit exception that the dimensions forint8matrices must be multiples of 4. Still, the best solution is to resolve them completely.Additional context
The first bug cannot be reproduced on another 5090 PC. However,
test(3, 128, 257)andtest(2, 128, 129)are reproducible across versions and machines.