Building a Rust-Native, Cross-Language Foundation for Agentic ML Compilers The Apache TVM project proposed a cross-language compiler foundation that gives Rust, C++ and Python native, zero-cost in-memory access to the same intermediate representation (IR) node objects, built on the open TVM-FFI C ABI rather than conventional single-language bindings. Under the design, every language shares the same reference-counted objects, and a registry records each type's fields and memory layout so a Rust library can read C++ objects directly and a Rust module can operate on the same objects as a C++ pass. TVM argues the approach matters because coding agents are writing a growing share of systems code and favor Python for prototyping and Rust or C++ for robust implementations, making multi-language compiler support central to inspecting, verifying and transforming agent-generated programs. Recent work on agent-driven kernel generation and systems optimization has shown that coding agents can take on substantial systems development. With agents writing a growing share of systems code, validating its correctness has become an increasingly important problem. As we discussed in our recent post “Rethinking Abstractions in the Agentic Era” https://tvm.apache.org/2026/11/03/rethinking-abstractions-in-the-agentic-era , ML compiler foundation will continue to play a central role in the agentic era, to inspect, verify, and transform the programs that agents generate. One natural consequence is that agents should now be able to get access to the intermediate program representations IR , such as loops and calls and write customized compiler routines. In this scenario, the compiler foundation no longer only serves the human developers and increasingly becomes agent facing. One natural question arises: which programming language should agents pick to write ML compiler routines in? Many language options are available and each comes with its own tradeoffs: Rust is a very natural choice, as its safety guarantees enable us to catch memory bugs early while maintaining high performance in programming. Its ownership and borrowing rules, static type system, and concurrency guarantees prevent many memory-safety errors and data races at compile time. Not surprisingly, we start to see a big movement of rewriting systems entirely onto Rust with the help of AI agents. The safety and efficiency seems to make Rust the language of choice. Python remains a strong choice, and is still the language in machine learning land, thanks to its rich ecosystem, and dynamic nature to enable quick prototyping. The ability to quickly prototype helps to cut down agent iteration time greatly. C++ continues to have a strong base and admittedly the best infrastructure support for low-level compiler tool chains. As a matter of fact, the vast majority of production compiler frameworks are still written in C++, thanks to established frameworks like LLVM infrastructure. Traditionally, most compilers are built around a single main language. The IR and other core data structures are defined in that language, typically C++, and languages such as Python reach them through bindings or wrappers. As we can see in the above discussion, there is not a really clear winner in terms of languages. In our experience agents would favor Python for prototyping, and Rust/C++ for robust stable implementations. The above observations make us ask one question: why not natively support multiple languages? Our main insight is that most of the compiler routines operate on trees of nodes that represent the program, which we call IR, if we can enable in-memory, zero-cost access to these IR node objects across languages , and build first-class ergonomic APIs around them , we will be able to enable a first class cross language foundation that works across Rust, C++ and Python. To understand how it works, it is helpful to distinguish our approach from traditional ones. Most traditional ML compilers would build solutions in one primary language, while exposing bindings to others. Those bindings typically bring additional indirections and may not present an idiomatic API for all the features needed. Instead, we want to provide fine-grained native access to the IR objects . Concretely, a Rust module should work on the same objects as a C++ pass, whether IR nodes or other compiler data structures, and read their fields directly. This calls for an agreement that sits below any single language. We build our solution on top of TVM-FFI https://tvm.apache.org/ffi/ , an open ABI for ML systems. Through its C ABI, every language shares the same reference-counted objects, and a registry records each type’s fields and where they sit in memory . Any library can add types to this registry when the library loads. A Rust library can therefore read C++ objects in place and contribute new types of its own. We call our effort TIRx Rust, a Rust-Native, Cross-Language Foundation for Agentic ML Compilers . TIRx Rust builds on top of TIRx, a minimal and stable ML compiler foundation, while providing cross-language native IR access, ergonomic Rust APIs, and dynamic extension. We envision a fundamentally new way to explore ML compiler development with the help of agents: instead of completely rewriting everything into one language like Rust, we allow agents to pick the best language for different modules at different stages of development while being able to mix and match at fine grained levels. Our preliminary experiences show that this approach empowers agents to develop faster with python prototyping, building robust code with Rust, while connecting to stable compiler toolchains in C++ organically. Building Ergonomic Rust APIs While the TVM-FFI ABI provides a basic way to access the data structures, we still need to provide idiomatic and safe Rust APIs to inspect, traverse and transform the program structures. Each of the IR objects in Rust is stored as a reference counted object that follows Rust’s ownership rules. Different IR nodes can be represented by different node types. One typical need in compiler analysis is to take a node dispatch based on its type, whether it is a For node, a constant or expression. The match any macro matches the IR node type: php fn describe expr: &PrimExpr - Result