OP-Level
Lower CG tasks to per-core ISA with synchronization and code assembly
OP-level compilation consumes CG task JSON and emits ISA instruction streams keyed by numeric core IDs ("0", "1", ...).
OP-Level Processing Steps
Parse CG Tasks
Read per-core staged CG task entries from the input JSON
Lower to ISA
Convert each high-level operation to ISA instruction sequences
Compile Kernels
Generate ISA code for operator kernels (conv, depthwise conv) when needed
Insert Synchronization
Add TAG and WAIT instructions for inter-stage global-memory dependencies
Merge Per-Core Output
Combine per-core instruction streams into a unified ISA JSON file
Commands
cim-compiler op-level \
-i output/cg/instructions_*.json \
-o output/op \
-c config.json \
--verifycimflow compile op \
-i output/cg/instructions_*.json \
-o output/op \
-cf config.jsonVerify Flag
--verify enables correctness checks for operator kernel compilation (conv, depthwise). Coverage varies across instruction paths — it does not validate every emitted instruction.
Input Format
OP-level expects CG JSON in this shape:
| Field | Required | Description |
|---|---|---|
metadata | No | Optional metadata object (for example op_count) |
core_<row>_<col> | Yes | Core task entries such as core_0_0, core_0_1, ... |
stages | Yes | Stage container under each core entry |
instructions | Yes | Instruction list under each stage |
The following instruction types are supported in CG task entries.
| Category | Instructions |
|---|---|
| Memory | read, write |
| Compute | conv, depthwise_conv, add |
| Communication | send, receive, send_ring, receive_ring |
| Synchronization | wait_write |
Lowering Rules (High-Level)
Each CG-level instruction is converted to one or more ISA instruction sequences. The table below shows the conversion pattern for each operation type.
For multi-core runs with inter-stage dependencies, OP-level inserts synchronization instructions. Producers emit TAG to mark write completion on global memory, and consumers emit WAIT to block until expected writes arrive. This prevents read-before-write races across stages.
Output Format
Output file naming depends on the compilation path:
isa_<cg_file_name>.jsonisa_instructions_<model>_...jsonUnified ISA structure:
{
"metadata": {
"op_count": 1110836224
},
"0": [
{"opcode": 45, "rd": 16, "imm": 8},
{"opcode": 48, "rs": 0, "rt": 2, "rd": 1, "imm": 0}
],
"1": [
{"opcode": 45, "rd": 16, "imm": 8}
]
}Intermediate Files
OP-level writes temporary per-core files under each_core/ before merging them into the final unified ISA JSON. These can be removed after compilation.
Last updated on