mirror of
https://github.com/tile-ai/tilelang.git
synced 2026-10-24 07:04:00 +08:00
[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.