Skip to content

Commit 0d59efa

Browse files
committed
fix(compiler): default cluster_dims=(1,1,1) for backends that omit it
hcu and mthreads backends do not support cluster launch, so their compiled kernel metadata omits cluster_dims. The KernelMetadata namedtuple is then built without that key, and torch 2.9.0's make_launcher reads kernel.metadata.cluster_dims unconditionally, raising AttributeError during KV-cache profiling warmup. Default the key to (1,1,1) before building the namedtuple, matching what the vendor triton 3.5.1 compiler and the iluvatar overlay already use — instead of patching torch/inductor per backend in each vendor adapter.
1 parent 52678a8 commit 0d59efa

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

python/triton/compiler/compiler.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,11 @@ def __init__(self, src, metadata_group, hash):
434434
target = metadata['target']
435435
metadata['target'] = GPUTarget(target['backend'], target['arch'], target['warp_size'])
436436
# Restore tuple-typed metadata fields serialized as JSON arrays.
437-
cluster_dims = metadata.get("cluster_dims")
437+
# Backends that do not support cluster launches (e.g. hcu, mthreads)
438+
# omit cluster_dims entirely; torch._inductor reads it unconditionally
439+
# when the kernel carries metadata, so default it here rather than
440+
# letting every such backend patch torch/inductor in its own adapter.
441+
cluster_dims = metadata.setdefault("cluster_dims", (1, 1, 1))
438442
if isinstance(cluster_dims, list):
439443
metadata["cluster_dims"] = tuple(cluster_dims)
440444
KernelMetadata = namedtuple('KernelMetadata', sorted(list(metadata.keys())))

0 commit comments

Comments
 (0)