code: def run_schedule(schedule: List[ScheduleItem]):
      while len(schedule):
          si = schedule.pop(0)
          if logops and si.ast.op not in LoadOps:
              logops.write(str(si.ast) + "\n")
  
          # get the program
          prg = lower_schedule_item(si)
  
          # invalidate the output buffer if there's a non contig usage of it in inputs
          if si.out.output_buffer is not None:
              for i, a in enumerate(si.inputs):
                  if a.realized == si.out.output_buffer:
                      if any(
                          not x.arg.st.contiguous
                          for x in si.ast.lazyops
                          if x.op is BufferOps.LOAD
                          and x.arg.idx == i + 1
                      ):
                          si.out.output_buffer = None
                          break
  
          # we don't have an output buffer, we have to create it, and create to max size if it has symbolic shape
          si.out.realized = (
              si.out.output_buffer
              if si.out.output_buffer is not None
              else Buffer(
                  si.out.device,
                  si.out.size,
                  si.out.dtype,
                  "PLACEHOLDER"
                  if isinstance(prg, InterpretedASTRunner)
                  else None,
              )
          )
          del si.out.srcs
  
          # run the function (put it in JIT)
          assert all(
              x.realized is not None for x in si.inputs
          ), f"can't run, some inputs aren't realized {[x for x in si.inputs if x.realized is None]}"
          if prg:
              prg.exec(
                  [si.out.realized]
                  + [cast(Buffer, x.realized) for x in si.inputs],
                  si.var_vals,
              )
          else:
              update_stats(
                  colored(
                      f"empty {si.out.st.size:10d} {si.out.dtype}",
                      "yellow",
                  ),
                  0,
                  0,
                  {},
                  None,
                  1,
                  device=si.out.device,
              )
          if GRAPH:
              realized_lazybuffer(si.out, GlobalCounters.kernel_count)
  
file_path: tinygrad/tinygrad/realize.py
imports: from typing import List, Dict, Optional, cast
  from tinygrad.ops import LoadOps, ScheduleItem, BufferOps, GlobalCounters
  from tinygrad.device import Device, Buffer, BufferCopy, JITRunner, update_stats, InterpretedASTRunner
  from tinygrad.graph import print_tree, realized_lazybuffer
  from tinygrad.helpers import colored, getenv, GRAPH
  from tinygrad.shape.symbolic import Variable
label_desc: Use image node_id 2 for calling a global function with example usage: run_schedule(schedule) without return types