code: def compile_net(
      run: TinyJit, special_names: Dict[int, str]
  ) -> Tuple[
      Dict[str, str],
      List[Tuple[str, List[str], List[int]]],
      Dict[str, Tuple[int, DType, int]],
      Dict[str, Tensor],
  ]:
      functions, bufs, bufs_to_save, statements, bufnum = (
          {},
          {},
          {},
          [],
          0,
      )
      for ji in run.jit_cache:
          fxn = ji.prg
          functions[
              fxn.name
          ] = (
              fxn.prg
          )  # NOTE: this assumes all with the same name are the same
          cargs = []
          for i, arg in enumerate(ji.rawbufs):
              key = id(arg)
              if key not in bufs:
                  if key in special_names:
                      bufs[key] = (
                          special_names[key],
                          arg.size * arg.dtype.itemsize,
                          arg.dtype,
                          key,
                      )
                  else:
                      bufs[key] = (
                          f"buf_{bufnum}",
                          arg.size * arg.dtype.itemsize,
                          arg.dtype,
                          key,
                      )
                      bufnum += 1
                      if i > 0:
                          bufs_to_save[
                              bufs[key][0]
                          ] = arg  # if first usage of a buffer is not an output, and it's not a special name
              cargs.append(bufs[key][0])
          statements.append(
              (fxn.name, cargs, fxn.global_size, fxn.local_size)
          )
  
      return (
          functions,
          statements,
          {
              name: (size, dtype, key)
              for (name, size, dtype, key) in bufs.values()
          },
          bufs_to_save,
      )
  
file_path: tinygrad/extra/export_model.py
imports: from typing import Tuple, Dict, List
  from tinygrad.dtype import DType
  from tinygrad.tensor import Device, Tensor
  from tinygrad.jit import TinyJit
  from tinygrad.nn.state import get_state_dict
  from tinygrad.dtype import dtypes
  import json
label_desc: Use image node_id 1 for calling a global function with example usage: compile_net(run, special_names) and returns: functions,  statements,  unknown,  bufs_to_save