
memory copy는 asynchronous copy로 가려질 수 있지만, memory alloc/de-alloc은 synchronization primitive 때문에
design : occamy (3 steps)
Liveness-aware Memory Operation Insertion
malloc, memcpy, dealloc) into DNN IR.
Use this data to build a liveness table per tensor.
Conv + ReLU → Conv-ReLU
Add
Memory Pool Code Generation :Generates instructions to emulate mallocs within the pool. → Eliminates need for dynamic allocation or deallocation calls at runtime.
DNN.Mem-offset(base, offset, size)
implementation
ONNX IR -> DNN IR -> LLVM IR -> executible binary
ONNX , DNN IR level에서 liveness table을 유지하고, DNN IR level에서 layer fusion/Tensor coaleascing을 유지하고, DNN IR level에서 memory pool 관련된 (de)alloc도 일원화해서 마지막으로 LLVM IR로 간다. 물론 MLIR 특징 처럼 DNN IR 단계에서 ONNX IR도 일부 존재한다. 이후, DNN.Conv 등의 IR은 cuDNN kerenl call로 대체하고, link 걸어서 GPU 를 enable 한다.

| Step | Verdict | Notes |
|---|---|---|
| ONNX-MLIR frontend | ✅ ✔️ | Used ONNX dialect as input |
| ONNX → DNN IR | ✅ ✔️ | Via MLIR rewrite passes |
| Optimization passes | ✅ ✔️ | Custom MLIR passes for fusion & pooling |
| DNN IR → LLVM IR | ✅ ✔️ | Using MLIR pattern rewrites |
| Linking with cuDNN | 🔶 Mostly right | Probably used clang -lcudnn, not llc directly |
| Executable binary | ✅ ✔️ | Result is a GPU-inference binary |
MLIR level에서 모든 optimization 작업을 하고, 새로운 instruction들도 집어 넣는다. 하지만 마지막에 LLVM IR로 가서 ptx로 code-gen 할 수 있게끔 한다.
ONNX IR → DNN IR (MLIR) → LLVM IR → CUDA Runtime API → Executable
MLIR에서는 dialect 하나를 추가했다.