GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — continuum/docs/design/ir.md at master · rithulkamesh/continuum

Expand file tree

/

ir.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
57 lines (46 loc) · 2.18 KB
/

ir.md

Copy path

File metadata and controls

57 lines (46 loc) · 2.18 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

CIR: Canonical IR

The IR contract for Continuum. The canonical machine-readable schema lives at schema/cir.fbs; this document describes the runtime wire format that Graph::serialize() emits.

Binary envelope

Graph::serialize() emits a compact binary envelope.

u32 magic = 0x31495243   // "CIR1"
u16 version = 1
u64 node_count
repeat node_count times:
  u64 node_id
  u8  node_kind
  string debug_name            // u64 len + bytes
  u64 input_count
  u64[input_count] inputs
  Type out_type                // tagged union
  u8  effect_bits
  Payload payload              // tagged union

Tagged unions are encoded as:

  • Type: u8 idx then variant payload
    • 0 TensorType: u64 ndim, i64[ndim] shape, u8 dtype, u8 device
    • 1 TokensType: string vocab_id, i32 max_len, string model_family
    • 2 SchemaType: string canonical_json, u64 schema_hash
    • 3 EffectType: u8 bits
  • Payload: u8 idx then variant payload
    • 0 TensorOpPayload: string op_name, u64 n_attrs, i64[n_attrs] attrs
    • 1 TokenOpPayload: string op_name, string model_id, f32 temperature, i32 max_tokens
    • 2 PromptOpPayload: string template_id, u64 n_slots, u64[n_slots] slot_inputs
    • 3 ToolOpPayload: string tool_name, string input_schema_json, string output_schema_json
    • 4 ControlOpPayload: u8 kind, u64 n_branches, u64[n_branches] branch_entries

Enumerations

  • Node kinds: TensorOp, TokenOp, PromptOp, ToolOp, ControlOp
  • Type lattice: TensorType, TokensType, SchemaType, EffectType
  • Effects: Pure, Idem, Net, Mut, Stoch bitset

Verification

Conformance is enforced by C++ tests:

  • serialize -> deserialize -> semantic equality checks
  • binary layout parser checks for envelope/tag correctness
  • Golden CIR corpus under tests/data/cir/: one .cir file per NodeKind (and representative type/payload variants). CirCorpusTest.GoldenFilesRoundtripByteIdentical deserializes each file and re-serializes to a byte-identical result. CI fails on drift unless you regenerate the corpus (./build-tests/tests/cpp/gen_cir_corpus) and document the migration when bumping the CIR version.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.