Skip to content

IntentDSL V2 Product Architecture

IntentDSL V2 compiles typed Python @I.kernel and @I.program definitions into five native exits—Triton, cuTile, Mojo, Weft, and BANG C—over CompilerInfra 0.6.0. Detailed subsystem specifications live in KIR and CPU Attention (plus Chinese engineering notes for Block, CPU, cuTile, and DSA in doc/design/).

GPU program ownership, CPU task hierarchy, and DSA local-storage supply

Paper Figure 5 illustrates how one logical algorithm lowers into three distinct physical execution models: GPU block ownership (Triton, cuTile), CPU task hierarchies (Mojo, Weft), and DSA explicit storage supply (BANG C). (PDF)

Compilation Responsibilities

Producer Consumer Exclusive Responsibility
Author Python AST frontend Logical domains, tensor accesses, parallel vs ordered iteration, reduction algebra, state, numerical permissions, and multi-kernel @I.program composition
IntentDSL Downstream target compiler Physical instance/task ownership, tiling, traversal, inter-member reuse, fragment staging, and explicit local-memory supply realized and verified in MLIR IR
Target toolchain Exit runtime Warp/lane or SIMD register allocation, native instruction selection, and binary symbol emission
Host caller Local JIT (I.jit) Explicit backend selection; actual input buffers determine execution device, stream/queue, and CPU affinity

Compilation Tree and Named Boundaries

IntentDSL V2 compilation tree

frontend/python
  algorithm/kir             imported → canonical
    ├─ execution/block      formed → decided → realized → normalized
    │    ├─ block@normalized → triton
    │    ├─ block@normalized → cutile
    │    └─ block@realized → storage/dsa     formed → supplied
    │                             └─ dsa@supplied → bangc
    └─ execution/cpu        formed → tasked → buffers
         ├─ cpu@tasked → weft
         └─ cpu@buffers → mojo
Node@Boundary Producer → Consumer Verified IR Guarantee
kir@imported Python AST capture → KIR canonicalizer Kernel/function symbols, parameter directions, scalar/view types, logical axes, region arguments, yields, and source locations
kir@canonical KIR canonicalizer → block or cpu Canonical indexing, type promotions, broadcasts, explicit casts, side effects, ordered dependencies, numerical permissions (ci.semantics), and alias groups
block@formed KIR-to-Block lowering → Block strategy Structured block regions, coordinate projections, unique-write proofs, dependencies, shape guards, and feasible parameter domains
block@decided Block strategy → Block realizer Joint selection of control topology and complete parameter row groups across coupled regions
block@realized Block realizer → dsa or block@normalized Explicit instance-to-output mapping, tile loops, fragments, masks, accumulators, and dependencies in SSA
block@normalized Shared GPU normalizer → triton, cutile Unified tail guards, broadcasts, scalar/fragment casts, loop carries, and result projections ready for GPU exits
cpu@formed KIR-to-CPU lowering → CPU task builder Value-level computation with partition relations; no premature bufferization or fixed SIMD width
cpu@tasked CPU task partitioning → weft or cpu@buffers Explicit task captures, output ownership, stage completion, and joins while keeping structured value regions
cpu@buffers CPU materialization → mojo Storage ownership, initialization, alignment, lifetime, and supply order realized under single-scheduler control
dsa@formed block@realized → DSA supply planner Preserves instance coverage and row IDs; selects shared supply topology within capacity and event constraints
dsa@supplied DSA supply realizer → bangc Verified DMA transfers, event waits, compute/reuse order, and capacity budgets prior to vendor memory-class binding

Exit Contracts

Exit ← Attachment Private Boundaries Emitted Artifact → Native Toolchain
triton ← block@normalized @legal → @callable Parameterized Triton Python JIT kernel → GPU triton compiler
cutile ← block@normalized @legal → @callable CUDA Tile Python kernel → cuda.tile / nvcc toolchain
weft ← cpu@tasked Private realizer → @legal → @callable Per-task .weftir + native host orchestrator → triton-weft / weft_core & C++ toolchain
mojo ← cpu@buffers @legal → @realized → @callable Mojo module source → mojo compiler & native shared-library loader (with optional oneDNN BRGEMM)
bangc ← dsa@supplied @bound → @legal → @callable BANG C source with typed microkernel bindings → Cambricon cncc & cnrt queue runtime

Runtime Lifecycle (prepare → compile → launch)

  1. Capture: @I.kernel and @I.program capture typed ASTs and call graphs without touching devices.
  2. prepare: Validates shapes, dtypes, devices, and aliasing; binds constexpr slots, allocates declared workspaces, and snapshots target/toolchain capabilities without executing device work.
  3. compile: Runs the MLIR lowering path through the selected exit, invokes the target native compiler, and loads the callable binary. First-call empirical tuning is strictly separated from compile.
  4. launch / execute: Evaluates candidate rows (when multiple guarded rows remain) while restoring InOut state, then submits the winning native call on the active CUDA stream, CNRT queue, or CPU task pool, returning an intentdsl.Completion handle.
  5. Observation & Verification: Coding agents inspect unit layouts, derive candidates, and read boundary IR via compilerinfra-agent / compilerinfra-dev, while Intent-Bench measures complete calls and verifies numerical contracts (Scoreboard).