From cb58cfbb1edb6955bd4971a9ead4c6528adcf732 Mon Sep 17 00:00:00 2001 From: Aswinmcw Date: Fri, 3 Jul 2026 10:32:49 +0000 Subject: [PATCH] Fix no-golden TS rows: feed golden a 0-dim tensor scalar The tensor-scalar path passed a python scalar to both the device op and the torch golden. Several goldens (maximum, minimum, logical_and/or/xor, ldexp, logaddexp/2, div_no_nan and their in-place forms) reject a python scalar 2nd operand, so call_golden returned None -> 605 rows reported "no-golden". Feed the golden a 0-dim tensor of the scalar instead (device still gets the python scalar); torch broadcasts it identically. All 605 no-golden TS rows now produce real pass/fail measurements; TT rows are unchanged. Co-authored-by: Cursor --- eltwise_support_probe.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eltwise_support_probe.py b/eltwise_support_probe.py index e977240..21569cf 100644 --- a/eltwise_support_probe.py +++ b/eltwise_support_probe.py @@ -424,7 +424,11 @@ def build_args(base, dtype, layout, mem, device, bcast="none", variant="tt"): if variant == "ts" and base in BINARY: s = _ts_scalar(dtype) p = BPARAMS.get(base, ()) - return [a, s, *p], {}, [a_t, s, *p] + # the device op takes a python scalar, but several torch goldens (maximum, + # minimum, logical_*, ldexp, logaddexp*) reject a python scalar 2nd operand + # -> feed the golden a 0-dim tensor instead (broadcasts identically). + s_ref = torch.tensor(s, dtype=(torch.int32 if dtype in _INT_DTYPES else torch.float32)) + return [a, s, *p], {}, [a_t, s_ref, *p] bsh = _bcast_shape(base, bcast) fi = bcast != "none" # broadcast operands go interleaved (can't shard a sub-tile) if base in TERNARY: