diff --git a/tinygrad/engine/schedule.py b/tinygrad/engine/schedule.py index f302ef144a..3a20f2fb09 100644 --- a/tinygrad/engine/schedule.py +++ b/tinygrad/engine/schedule.py @@ -4,7 +4,7 @@ from dataclasses import dataclass from typing import Tuple, List, Dict, Optional, Set, DefaultDict, Union from tinygrad.ops import LoadOps, BufferOps, LazyOp, ReduceOps, ConstBuffer, MemBuffer, UNSAFE_PAD_OPS, UnaryOps from tinygrad.engine.graph import log_lazybuffer, realized_lazybuffer -from tinygrad.helpers import GRAPH, DEBUG, MULTIOUTPUT, SAVE_SCHEDULE, GlobalCounters, prod, dedup, all_int, merge_dicts, getenv +from tinygrad.helpers import GRAPH, DEBUG, MULTIOUTPUT, SAVE_SCHEDULE, GlobalCounters, colored, prod, dedup, all_int, merge_dicts, getenv from tinygrad.shape.symbolic import Variable from tinygrad.dtype import ImageDType, dtypes, DType from tinygrad.lazy import LazyBuffer @@ -69,7 +69,8 @@ def _recursive_lazyop(buf:LazyBuffer, inputs:List[LazyBuffer], outputs:Tuple[Laz # we also allow masked views. if it has a single view and it's equal when you shrink a contig, it's fine if not (len(unbound_st.views) == 1 and unbound_st.views[0].mask is not None and ShapeTracker.from_shape(unbound_st.shape).shrink(unbound_st.views[0].mask) == unbound_st.shrink(unbound_st.views[0].mask)): - raise RuntimeError(f"must be contiguous for assign {unbound_st}") + raise RuntimeError("self operand of augmented assign must be contiguous.\nhelp: consider using .contiguous():\n" + +colored(" - a += a.T\n", "red")+colored(" + a += a.T.contiguous()", "green")) return LazyOp(BufferOps.LOAD, (), MemBuffer(outputs.index(assign_targets[buf]), buf.dtype, unbound_st)) if buf not in inputs: inputs.append(buf) return LazyOp(BufferOps.LOAD, (), MemBuffer(len(outputs)+inputs.index(buf), buf.dtype, unbound_st))