Inferensys

Glossary

Application Binary Interface (ABI)

An Application Binary Interface (ABI) is a low-level specification that defines how binary code interacts with an operating system or other programs, covering calling conventions, data structure layout, and object file formats.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
VENDOR SDK AND INTRINSIC MAPPING

What is Application Binary Interface (ABI)?

A foundational specification for low-level software compatibility and hardware acceleration.

An Application Binary Interface (ABI) is a low-level contract that defines how compiled machine code interacts with an operating system, libraries, and other binaries. It specifies critical details like calling conventions for function arguments and return values, the memory layout of data structures, system call numbers, and object file formats like ELF. This ensures binary compatibility, allowing separately compiled modules—such as a program and a vendor runtime library—to interoperate correctly without access to source code.

In the context of hardware acceleration, such as for a Neural Processing Unit (NPU), the ABI is essential for integrating vendor-provided binaries. A vendor SDK delivers pre-compiled libraries that adhere to a specific ABI, governing how an application passes tensor data, launches kernels, and manages device memory via a driver API. The ABI also defines the mapping for hardware intrinsics and the layout of ELF sections containing accelerator code, enabling the linker to correctly build a final executable that can leverage specialized silicon.

VENDOR SDK AND INTRINSIC MAPPING

Core Components of an ABI

An Application Binary Interface (ABI) is the low-level contract between compiled machine code and its execution environment. For NPU programming, the ABI defines how kernels interact with the accelerator's hardware and software stack.

01

Calling Convention

The calling convention is a fundamental ABI rule that dictates how functions pass arguments, return values, and manage the stack and registers during a subroutine call. For NPU kernels, this defines how host CPU code invokes an accelerator kernel and how data pointers are passed.

  • Key Aspects: Specifies which registers are caller-saved vs. callee-saved, the order of arguments (e.g., passed in registers R0-R3, then on the stack), and stack alignment requirements.
  • NPU Relevance: A vendor's NPU driver and runtime enforce a specific calling convention for kernel launches. Mismatches between the compiler's expectation and the runtime's implementation cause catastrophic crashes.
02

Data Structure Layout & Alignment

This component specifies how data types (structs, unions, arrays) are arranged in memory, including byte ordering (endianness), alignment boundaries, and padding. Consistency is critical for data exchange between host CPU and NPU.

  • Packing: Defines if struct members are packed tightly or aligned to natural boundaries (e.g., a 4-byte int aligned to a 4-byte address).
  • Impact: An NPU kernel expecting a tightly packed struct of float values will read garbage data if the host compiler pads the struct differently. Vendor SDK header files define standard data types with explicit alignment attributes (e.g., __attribute__((aligned(16)))).
03

Object File Format

The ABI specifies the binary container format for compiled code and data, such as ELF (Executable and Linkable Format) or Mach-O. This format organizes the executable into sections (.text, .data, .rodata) and contains metadata for linking and loading.

  • Sections: The .text section holds executable machine code (the NPU kernels), .data holds initialized global variables, and symbol tables (.symtab) map names to addresses.
  • NPU Toolchains: Vendor-specific compilers (a key part of the vendor toolchain) generate object files in a format the NPU's loader and runtime can parse. The linker (guided by a linker script) combines these into a final binary image loadable by the vendor runtime.
04

System Call Interface

For NPUs integrated into an OS-managed system, the ABI defines the mechanism for user-space code to request services from the kernel driver, such as memory allocation or kernel submission. This is often implemented via a Driver API.

  • Mechanism: Typically involves issuing a specific software interrupt or using a special instruction (like SVC on ARM) that traps into the kernel. The driver then validates the request and communicates with the NPU hardware.
  • Example: An application calls npucalloc() from the Vendor SDK, which internally makes a system call to the driver to allocate device-accessible memory, adhering to the defined ABI for parameter passing.
05

Name Mangling & Symbol Encoding

Name mangling (or decoration) is a compiler technique for encoding function and variable names with additional information (like argument types) into a single symbol string in the object file. This enables features like function overloading in C++ and ensures unique symbols for linking.

  • ABI Role: The mangling scheme is part of the ABI. Different compilers (or versions) using different schemes cannot link objects together.
  • NPU Development: When using a C++ Vendor SDK, the mangled kernel names in the host code must exactly match the symbols exported by the NPU-compiled kernel object. Mismatches result in "undefined symbol" linker errors.
06

Exception Handling & Unwinding

This ABI component defines the mechanism for propagating runtime error conditions (exceptions) and for unwinding the call stack during error recovery or debugging. For NPU programming, this often relates to host-side error reporting from the accelerator.

  • Frame Unwinding: Specifies how to walk back through the stack frames to find exception handlers, using unwind tables or specific frame pointer registers.
  • NPU Context: If an NPU kernel encounters a hardware fault (e.g., illegal instruction), the vendor runtime must translate this into a host-side signal or exception that conforms to the host OS ABI, allowing the application to handle it gracefully.
LOW-LEVEL INTEGRATION

How ABI Enables NPU Acceleration

The Application Binary Interface (ABI) is the critical low-level contract that allows compiled machine code to execute correctly on a specific hardware and operating system combination. In the context of Neural Processing Unit (NPU) acceleration, the ABI defines the precise rules for how host CPU code interacts with the NPU's specialized runtime and kernels.

An Application Binary Interface (ABI) is a system-level specification that dictates how compiled binary code interacts with an operating system and hardware. It defines calling conventions, system call mechanisms, register usage, and data structure layout in memory. For NPU acceleration, the ABI ensures that function calls from the host CPU to the vendor runtime and submitted compute kernels adhere to the NPU's expected binary format and execution model, enabling seamless integration.

This low-level contract is essential for binary portability and performance. A stable ABI allows pre-compiled vendor libraries and optimized kernels from an SDK to link and run correctly with an application, regardless of the compilation environment. It governs how parameters are passed to NPU kernels, how memory buffers are shared between CPU and NPU address spaces, and how execution synchronization occurs, forming the foundational layer for reliable hardware acceleration.

APPLICATION BINARY INTERFACE (ABI)

Frequently Asked Questions

The Application Binary Interface (ABI) is the foundational contract between compiled machine code and its execution environment. This FAQ clarifies its critical role in hardware acceleration, system compatibility, and low-level software development.

An Application Binary Interface (ABI) is a low-level specification that defines how binary machine code interacts with an operating system, hardware, or other compiled libraries. It works by establishing a precise contract covering calling conventions (how function arguments are passed and values returned), system call mechanisms, data structure layout and alignment in memory, register usage rules, and object file formats (like ELF or Mach-O). This contract ensures that separately compiled modules—such as a main application and a vendor's NPU runtime library—can correctly link and execute together, even if they were built with different compilers, as long as they adhere to the same ABI. For NPU programming, the ABI dictates how host CPU code calls into accelerator kernels and exchanges data buffers.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.