Skip to content

Commit b3b75cf

Browse files
tengqmclaude
andcommitted
fix(compiler): default cluster_dims=(1,1,1) for backends that omit it
Backends without cluster launch support (e.g. hcu, mthreads) do not emit cluster_dims in the compiled-kernel metadata JSON, so the KernelMetadata namedtuple built here lacks that field. torch._inductor reads kernel.metadata.cluster_dims unconditionally when a kernel carries metadata, raising AttributeError during KV-cache profiling warmup (vllm 0.24.0 on Hygon DTK 26.04). Default it to (1,1,1) — the same value vendor triton and the iluvatar overlay already use — instead of patching torch/inductor per backend in each vendor adapter. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 52678a8 commit b3b75cf

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)