요약

image.png

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 한다.

image.png

implemetation tools (나의 추측)

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

implementation details

MLIR level에서 모든 optimization 작업을 하고, 새로운 instruction들도 집어 넣는다. 하지만 마지막에 LLVM IR로 가서 ptx로 code-gen 할 수 있게끔 한다.

ONNX IR → DNN IR (MLIR) → LLVM IR → CUDA Runtime API → Executable

MLIR에서는 dialect 하나를 추가했다.