From f55fcfecf913aaaf2aab7724c990f8d50b984ad5 Mon Sep 17 00:00:00 2001 From: chenyu Date: Tue, 28 Oct 2025 17:12:22 -0400 Subject: [PATCH] ProgramSpec uops must end with SINK [pr] (#12981) --- tinygrad/renderer/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tinygrad/renderer/__init__.py b/tinygrad/renderer/__init__.py index c96a4333fc..439615f6a7 100644 --- a/tinygrad/renderer/__init__.py +++ b/tinygrad/renderer/__init__.py @@ -105,8 +105,10 @@ class ProgramSpec: def function_name(self) -> str: return to_function_name(self.name) @property - def applied_opts(self) -> tuple[Opt, ...]|None: return self.uops[-1].arg.applied_opts if \ - self.uops is not None and self.uops[-1].op is Ops.SINK and self.uops[-1].arg is not None else None + def applied_opts(self) -> tuple[Opt, ...]|None: + if self.uops is None: return None + assert self.uops[-1].op is Ops.SINK, self.uops[-1].op + return self.uops[-1].arg.applied_opts def launch_dims(self, var_vals:dict[str, int]): global_size = [sym_infer(sz, var_vals) for sz in self.global_size] if self.global_size is not None else None