runtime.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import modelverse_kernel.primitives as primitive_functions
  2. class JitCompilationFailedException(Exception):
  3. """A type of exception that is raised when the jit fails to compile a function."""
  4. pass
  5. MUTABLE_FUNCTION_KEY = "mutable"
  6. """A dictionary key for functions that are mutable."""
  7. FUNCTION_BODY_KEY = "body"
  8. """A dictionary key for function bodies."""
  9. KWARGS_PARAMETER_NAME = "kwargs"
  10. """The name of the kwargs parameter in jitted functions."""
  11. CALL_FUNCTION_NAME = "__call_function"
  12. """The name of the '__call_function' function, in the jitted function scope."""
  13. GET_INPUT_FUNCTION_NAME = "__get_input"
  14. """The name of the '__get_input' function, in the jitted function scope."""
  15. JIT_THUNK_CONSTANT_FUNCTION_NAME = "__jit_thunk_constant_function"
  16. """The name of the jit_thunk_constant_function function in the JIT's global context."""
  17. JIT_THUNK_GLOBAL_FUNCTION_NAME = "__jit_thunk_global"
  18. """The name of the jit_thunk_global function in the JIT's global context."""
  19. JIT_REJIT_FUNCTION_NAME = "__jit_rejit"
  20. """The name of the rejit function in the JIT's global context."""
  21. JIT_COMPILE_FUNCTION_BODY_FAST_FUNCTION_NAME = "__jit_compile_function_body_fast"
  22. """The name of the compile_function_body_fast function in the JIT's global context."""
  23. UNREACHABLE_FUNCTION_NAME = "__unreachable"
  24. """The name of the unreachable function in the JIT's global context."""
  25. LOCALS_NODE_NAME = "jit_locals"
  26. """The name of the node that is connected to all JIT locals in a given function call."""
  27. LOCALS_EDGE_NAME = "jit_locals_edge"
  28. """The name of the edge that connects the LOCALS_NODE_NAME node to a user root."""
  29. GLOBAL_NOT_FOUND_MESSAGE_FORMAT = "Not found as global: %s"
  30. """The format of the 'not found as global' message. Takes a single argument."""
  31. BYTECODE_INTERPRETER_ORIGIN_NAME = "bytecode-interpreter"
  32. """The origin name for functions that were produced by the bytecode interpreter."""
  33. BASELINE_JIT_ORIGIN_NAME = "baseline-jit"
  34. """The origin name for functions that were produced by the baseline JIT."""
  35. FAST_JIT_ORIGIN_NAME = "fast-jit"
  36. """The origin name for functions that were produced by the fast JIT."""