diff --git a/scripts/validate_manifest.py b/scripts/validate_manifest.py index a9c8b450..67fa80fe 100755 --- a/scripts/validate_manifest.py +++ b/scripts/validate_manifest.py @@ -738,7 +738,13 @@ def _forward_positional_params(cls) -> list[str] | None: p for p, v in sig.parameters.items() if p != "self" and v.kind in _POSITIONAL_KINDS ] - except (ValueError, TypeError): + except (ValueError, TypeError) as exc: + # Stash exception text so callers that surface diagnostics can + # report ``exc.__class__.__name__: exc`` without changing the + # ``None`` return contract for "not inspectable". + _forward_positional_params._last_error = ( # type: ignore[attr-defined] + f"{exc.__class__.__name__}: {exc}" + ) return None @@ -3367,9 +3373,20 @@ def check_c4_forward_signature_parity( positional = _forward_positional_params(cls) if positional is None: if warnings is not None: - warnings.append( - f"[forward] {op_name}: inspect.signature(forward) failed" + detail = getattr( + _forward_positional_params, "_last_error", None ) + if detail: + warnings.append( + f"[forward] {op_name}: inspect.signature(forward) " + f"raised {detail}" + ) + # Clear so a later call site sees only its own failure. + _forward_positional_params._last_error = None # type: ignore[attr-defined] + else: + warnings.append( + f"[forward] {op_name}: inspect.signature(forward) failed" + ) return errors # Generative-op carve-out: ``ref_api: "none"`` plus zero forward() diff --git a/tileops/manifest/elementwise_fused_gated.yaml b/tileops/manifest/elementwise_fused_gated.yaml index cf607316..439e049d 100644 --- a/tileops/manifest/elementwise_fused_gated.yaml +++ b/tileops/manifest/elementwise_fused_gated.yaml @@ -18,17 +18,17 @@ SiluAndMulFwdOp: signature: inputs: - x: {dtype: "float16 | bfloat16 | float32", shape: [M, two_N]} + x: {dtype: "float16 | bfloat16 | float32", shape: "[M, two_N]"} outputs: - output: {dtype: "same_as(x)", shape: [M, N]} + output: {dtype: "same_as(x)", shape: "[M, N]"} shape_rules: - "x.shape[1] == 2 * output.shape[1]" - "x.shape[0] == output.shape[0]" workloads: # SwiGLU FFN intermediate (Llama-3.1-8B, hidden_dim=14336) - - {M: 2048, N: 14336, dtypes: [float16, bfloat16], label: "llama-3.1-8b-swiglu-prefill"} - - {M: 1, N: 14336, dtypes: [bfloat16], label: "llama-3.1-8b-swiglu-decode"} + - {x_shape: [2048, 28672], dtypes: [float16, bfloat16], label: "llama-3.1-8b-swiglu-prefill"} + - {x_shape: [1, 28672], dtypes: [bfloat16], label: "llama-3.1-8b-swiglu-decode"} roofline: vars: @@ -60,16 +60,16 @@ GeluAndMulFwdOp: signature: inputs: - x: {dtype: "float16 | bfloat16 | float32", shape: [M, two_N]} + x: {dtype: "float16 | bfloat16 | float32", shape: "[M, two_N]"} outputs: - output: {dtype: "same_as(x)", shape: [M, N]} + output: {dtype: "same_as(x)", shape: "[M, N]"} shape_rules: - "x.shape[1] == 2 * output.shape[1]" - "x.shape[0] == output.shape[0]" workloads: - - {M: 2048, N: 14336, dtypes: [float16, bfloat16], label: "ffn-gelu-prefill"} - - {M: 1, N: 14336, dtypes: [bfloat16], label: "ffn-gelu-decode"} + - {x_shape: [2048, 28672], dtypes: [float16, bfloat16], label: "ffn-gelu-prefill"} + - {x_shape: [1, 28672], dtypes: [bfloat16], label: "ffn-gelu-decode"} roofline: vars: @@ -100,16 +100,16 @@ GeluTanhAndMulFwdOp: signature: inputs: - x: {dtype: "float16 | bfloat16 | float32", shape: [M, two_N]} + x: {dtype: "float16 | bfloat16 | float32", shape: "[M, two_N]"} outputs: - output: {dtype: "same_as(x)", shape: [M, N]} + output: {dtype: "same_as(x)", shape: "[M, N]"} shape_rules: - "x.shape[1] == 2 * output.shape[1]" - "x.shape[0] == output.shape[0]" workloads: - - {M: 2048, N: 14336, dtypes: [float16, bfloat16], label: "ffn-gelu-tanh-prefill"} - - {M: 1, N: 14336, dtypes: [bfloat16], label: "ffn-gelu-tanh-decode"} + - {x_shape: [2048, 28672], dtypes: [float16, bfloat16], label: "ffn-gelu-tanh-prefill"} + - {x_shape: [1, 28672], dtypes: [bfloat16], label: "ffn-gelu-tanh-decode"} roofline: vars: diff --git a/tileops/manifest/elementwise_generative.yaml b/tileops/manifest/elementwise_generative.yaml index e0e8d806..fbe9db93 100644 --- a/tileops/manifest/elementwise_generative.yaml +++ b/tileops/manifest/elementwise_generative.yaml @@ -29,9 +29,9 @@ AlibiFwdOp: signature: inputs: - device_carrier: {dtype: "float16 | bfloat16 | float32", shape: []} + device_carrier: {dtype: "float16 | bfloat16 | float32", shape: "[]"} outputs: - output: {dtype: "same_as(device_carrier)", shape: [num_heads, seq_len, seq_len]} + output: {dtype: "same_as(device_carrier)", shape: "[num_heads, seq_len, seq_len]"} params: seq_len: {type: int} num_heads: {type: int} @@ -41,8 +41,8 @@ AlibiFwdOp: workloads: # Llama-style attention bias dimensions - - {seq_len: 2048, num_heads: 32, dtypes: [float16, bfloat16], label: "llama-prefill-2k"} - - {seq_len: 4096, num_heads: 32, dtypes: [float16, bfloat16], label: "llama-prefill-4k"} + - {device_carrier_shape: [], seq_len: 2048, num_heads: 32, dtypes: [float16, bfloat16], label: "llama-prefill-2k"} + - {device_carrier_shape: [], seq_len: 4096, num_heads: 32, dtypes: [float16, bfloat16], label: "llama-prefill-4k"} roofline: vars: @@ -76,9 +76,9 @@ SinusoidalFwdOp: signature: inputs: - device_carrier: {dtype: "float16 | bfloat16 | float32", shape: []} + device_carrier: {dtype: "float16 | bfloat16 | float32", shape: "[]"} outputs: - output: {dtype: "same_as(device_carrier)", shape: [seq_len, d_model]} + output: {dtype: "same_as(device_carrier)", shape: "[seq_len, d_model]"} params: seq_len: {type: int} d_model: {type: int} @@ -89,8 +89,8 @@ SinusoidalFwdOp: workloads: # Transformer-style positional encodings - - {seq_len: 2048, d_model: 4096, dtypes: [float16, bfloat16], label: "transformer-2k-4k"} - - {seq_len: 4096, d_model: 4096, dtypes: [float16, bfloat16], label: "transformer-4k-4k"} + - {device_carrier_shape: [], seq_len: 2048, d_model: 4096, dtypes: [float16, bfloat16], label: "transformer-2k-4k"} + - {device_carrier_shape: [], seq_len: 4096, d_model: 4096, dtypes: [float16, bfloat16], label: "transformer-4k-4k"} roofline: vars: