This document captures the compilation-side contract that turns source code or an SCF-level candidate region into a DFG suitable for mapping.
LOOM compilation is organized into these conceptual stages:
- source to LLVM IR
- LLVM dialect MLIR
- CF-stage MLIR
- SCF-stage MLIR
- DFG-domain selection
- DFG-stage lowering
The software-only artifact family is:
<name>.ll
<name>.llvm.mlir
<name>.cf.mlir
<name>.scf.mlir
<name>.dfg.mlir
Exact emission policy may vary by mode, but these stage boundaries are architecturally significant.
When compilation continues into mapping against a selected ADG, later artifacts that contain both software and hardware meaning must switch to mixed naming:
<dfg>.<adg>.map.json
<dfg>.<adg>.map.txt
<dfg>.<adg>.config.json
<dfg>.<adg>.config.bin
<dfg>.<adg>.config.h
<dfg>.<adg>.viz.html
Hardware-only artifacts such as the ADG itself continue to use <adg>.*
names, for example:
<adg>.fabric.mlir
<adg>.fabric.viz.json
LOOM does not hardcode "convert the whole function" as the only model. Instead:
- a candidate region is selected from SCF-level IR
- the candidate must respect SCF hierarchy boundaries
- the chosen candidate is what proceeds into DFG lowering
The exploration logic itself is specified in spec-dse.md.
The DFG stage must produce a graph suitable for mapping and later validation.
Important LOOM-side requirements include:
- unsupported fanout or merge patterns should be normalized away by the lowering pipeline when required by the mapper model
- kernels with memory side effects must preserve enough structure for extmemory reconstruction and later validation
- unused outputs are handled by discard semantics rather than by introducing
handshake.sinkas the primary model
The DFG stage must also respect the hardware join capacity exported by the ADG.
Normative rules:
- the ADG exporter annotates the selected hardware with a maximum supported
handshake.joinfan-in - LOOM lowers this limit into the compilation pipeline as
loom.adg_max_join_fanin - if the software DFG contains a
handshake.joinwhose fan-in is less than or equal to that limit, it may remain unchanged - if the software DFG contains a
handshake.joinwhose fan-in exceeds that limit, LOOM must rewrite it into a tree of smaller joins whose fan-in does not exceed the hardware limit - the current mapper/config encoding supports hardware join fan-in up to
64 - if the hardware limit is less than
2, LOOM must reject any software join whose fan-in is greater than1
This legalization happens before mapping. The mapper therefore only needs to handle software joins whose fan-in is within the ADG-advertised hardware capacity.
LOOM retains the legacy design's broad direction that memory-related routing may involve tag mechanisms and explicit memory interface structure, but the current contract is no longer restricted to one hardware extmemory per software array.
Normative compilation-side expectations are:
- DFG memory nodes must preserve enough identity for later mapping onto either distinct or shared hardware memory interfaces
- multi-port or shared-interface memory traffic may require tagged routing and explicit tag-boundary structure
- the detailed hardware-family and region-table rules live in spec-fabric-memory-interface.md