Can MLIR nest Modules? (original) (raw)

October 17, 2025, 8:13am 1

Can MLIR nest Modules? Like this:

module {

func.func @main() → i32 {

%x = arith.constant 42 : i32

return %x : i32

}

module {

func.func @orphan() {

  return

}

}

}

Does MLIR allow the absence of a Module? Like this:

func.func @orphan() {

return

}

Yes, you can nest modules.

When there is no module, the entire IR is implicitly wrapped in a module.