Files
tilelang/testing/python
Yichen Yan c025b8d08e [BugFix][Metal] Resolve auto backend to torch and skip disk cache for torch (#2856)
[BugFix][Metal] Resolve auto backend to torch and skip disk cache for torch (#2722)

execution_backend="auto" previously resolved to tvm_ffi for metal targets
because it picks the first registered spec and tvm_ffi was registered before
torch, contradicting the documented default (metal->torch). Register torch
first so bare @tilelang.jit runs on Metal via torch.mps.compile_shader; tvm_ffi
remains available as an explicit opt-in.

KernelCache also crashed on the torch backend: MetalKernelAdapter has no libpath
artifact (the MSL source is compiled in-process via torch.mps.compile_shader),
but _save_so_cubin_to_disk unconditionally read kernel.adapter.libpath, logging
"Error during atomic cache save" with an AttributeError on every run and never
persisting a usable entry (the database-load path has no torch branch either).
The torch backend now disables disk caching when it compiles, so the disk cache
is never written for it, and libpath access is guarded so lib-less adapters can
never crash the save path again.

Adds regression tests in testing/python/metal/test_metal_cache.py.
2026-08-04 12:33:41 +08:00
..