tilelang.testing

Submodules

Attributes

Functions

without_kernel_cache()

Disable the CacheState kernel cache for the enclosed block.

ascend_backend_compiled()

Whether this build includes the Ascend backend (USE_ASCEND).

requires_cdna(func)

Skip the test unless the ROCm device is a CDNA GPU.

requires_cuda_or_cdna(func)

Skip the test unless the device is CUDA or CDNA ROCm.

requires_gfx950(func)

Skip the test unless the ROCm device is gfx950 (CDNA4 / MI350).

main()

set_random_seed([seed])

requires_cuda_compute_version(major_version[, ...])

Mark a test as requiring at least a compute architecture

requires_cuda_compute_version_ge(major_version[, ...])

requires_cuda_compute_version_gt(major_version[, ...])

requires_cuda_compute_version_eq(major_version[, ...])

requires_cuda_compute_version_lt(major_version[, ...])

requires_cuda_compute_version_le(major_version[, ...])

Package Contents

tilelang.testing.__all__
tilelang.testing.without_kernel_cache()

Disable the CacheState kernel cache for the enclosed block.

Use it when a test calls tilelang.compile() (or JITImpl.compile()) and asserts on work that only the compile path performs: the lowered artifact (Kernel.artifact) or compile-time diagnostics. A kernel served from the cache carries neither, so such a test passes only on a cold cache unless it opts out.

The @tilelang.jit wrapper keeps its own kernel cache and consults it before JITImpl.compile() runs, so repeated jit calls are not covered here. A cache state the caller had already disabled is restored on exit.

tilelang.testing.ascend_backend_compiled()

Whether this build includes the Ascend backend (USE_ASCEND).

The Ascend sources are gated behind USE_ASCEND, so a CUDA-only build has no Ascend tile ops and no Ascend pass-config options. The pass-config key is the cheapest reliable probe: it is registered from src/ascend.

Return type:

bool

tilelang.testing.requires_ascend
tilelang.testing.requires_cdna(func)

Skip the test unless the ROCm device is a CDNA GPU.

tilelang.testing.requires_cuda_or_cdna(func)

Skip the test unless the device is CUDA or CDNA ROCm.

tilelang.testing.requires_gfx950(func)

Skip the test unless the ROCm device is gfx950 (CDNA4 / MI350).

tilelang.testing.main()
tilelang.testing.set_random_seed(seed=42)
Parameters:

seed (int)

Return type:

None

tilelang.testing.requires_cuda_compute_version(major_version, minor_version=0, mode='ge')

Mark a test as requiring at least a compute architecture

Unit test marked with this decorator will run only if the CUDA compute architecture of the GPU is at least (major_version, minor_version).

This also marks the test as requiring a cuda support.

Parameters:
  • major_version (int) – The major version of the (major,minor) version tuple.

  • minor_version (int) – The minor version of the (major,minor) version tuple.

  • mode (str) – The mode of the comparison. - “ge”: greater than or equal to - “gt”: greater than - “le”: less than or equal to - “lt”: less than

tilelang.testing.requires_cuda_compute_version_ge(major_version, minor_version=0)
tilelang.testing.requires_cuda_compute_version_gt(major_version, minor_version=0)
tilelang.testing.requires_cuda_compute_version_eq(major_version, minor_version=0)
tilelang.testing.requires_cuda_compute_version_lt(major_version, minor_version=0)
tilelang.testing.requires_cuda_compute_version_le(major_version, minor_version=0)