Kina.ai

Specification

ADR: reverseMode result ABI

Context

Section 10 types handle f(args) with reverseMode as a nested pair (primal, (grads…)) and builds that pair in IR. The emitter then prints func.func @main() with no results, because infer_type only accepts tensors. Section 11 therefore takes g as an explicit argument.

MLIR tuple<> types do not bufferize on the existing one-shot-bufferize + LLVM C-wrapper path. The bootstrap surface also cannot write a one-element tuple type (T), so a nested (primal, (g)) cannot be used as a fn annotation.

Decision

Specify the ABI in 12-reversemode-result-abi.md:

Consequences