Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Binary Inventory & the .so Map

Sizes and paths are from the neuronx_cc-2.24.5133.0+58f8de22-cp310 wheel. cp311/cp312 differ only as noted under Version Provenance.

Abstract

neuronx_cc is not one binary; it is a Python package that orchestrates a handful of large standalone tool ELFs, a set of eight C++ shared libraries under starfish/lib, and several hundred Cython extension modules that hold the Penguin middle-end and the NKI frontend. This page is the atlas: where the compiler's logic actually lives, so that when a later page says "in libwalrus.so" or "the BirCodeGenLoop module", the reader knows which artifact to open. Sizes are a rough proxy for how much logic each carries.

The package root is neuronxcc/. Three sub-trees matter: starfish/ (the C++ compiler core — tools, libs, and the Cython penguin middle-end), nki/ (the kernel DSL), and driver/ (the Python/Cython command layer that drives everything).

The standalone tool ELFs

These live in neuronxcc/starfish/bin/ and are forked by the driver as subprocesses. The five largest are five distinct ~230 MB statically-linked ELFs, each with its own mainnot one multi-call image. This is verifiable: they have distinct inodes and differing sizes (229–234 MB). They are similar in size because each statically links the same bulk of XLA / MLIR / LLVM. Each tool's link-count of 3 is cross-wheel sharing — the file is hardlinked into the cp310, cp311, and cp312 wheel directories — so a given tool is byte-identical across the three wheels, but the five tools are not copies of one another.

ToolSizeRoleDocumented in
xla_infergoldens234 MBReference (golden) evaluator — runs HLO on a CPU oracle for numeric checking3.16
hlo2penguin232 MBMLIR front half: mhlo/stablehlo → Penguin Python IRPart 4
hlo-opt229 MBHLO/MHLO/StableHLO optimizer; the --passes registryPart 4
hlo-neff-wrapper227 MBWraps backend output into the NEFF (the "Kelper" stage)12.x
snapshot-unpack226 MBUnpacks a decomposed/snapshot compile input3.17
walrus_bugpoint_driver36 MBDelta-debugging driver over the backendPart 8
coloring_allocator_with_loop3.8 MBStandalone register/memory allocator (loop-aware) entry8.16
full_unroll2.9 MBStandalone loop-unroll pass entry8.3
walrus_driver708 KBThin shim — argument marshalling; the backend itself is libwalrus.so3.7

QUIRK — walrus_driver is under a megabyte, but it is the entry point to the entire backend. It is a launcher: it parses the backend CLI, dlopens libwalrus.so, and calls in. Do not look for scheduling or allocation logic in the driver — it is all in the 65 MB library.

Two Python tools also ship in bin/: analyze_neff_artifacts.py (a json.load + os.stat walk over an extracted NEFF directory) and internal_nki_stubgen.py.

The starfish/lib shared libraries

Eight C++ .so carry the backend, the IR core, the simulators, and logging. They are loaded by walrus_driver and by the Cython modules.

LibrarySizeOwnsDocumented in
libwalrus.so65 MBThe backend: ~150 passes, the dependence graph, the three schedulers, the SB/PSUM/DRAM/Reg allocators, loop optimization, LNC split, lower_dma, the CoreV{2,3,4}Gen per-engine code generators, the BIR linker, and NeffPackagerPart 8, Part 2, Part 12
libBIRSimulator.so36 MBThe BIR functional simulator (birsim), the whole-machine state model, and the DAP debugger7.34–7.41
liblogging.so35 MBNeuronLogger and the Boost.Log sink stack3.18
libLncBarriercheck.so33 MBThe inter-core (LNC) barrier verifier8.43
libBIR.so9.5 MBThe BIR core: bir::Instruction and the 110-opcode hierarchy, the Dtype tables, CastToNewDType, and the BIR-JSON SerDePart 7
libBIRParserDumper.soparserdumper / bir_roundtrip (BIR-JSON read-write round trip)8.44
libBIRRacecheck.soThe intra-core race checker (vector-clock + overlap geometry)8.42
libpwp_sim.soThe piecewise-polynomial activation simulator (evaluate_generic)7.40, Part 10

The Cython module galaxy

The Penguin middle-end and the NKI frontend ship as per-Python-version Cython extension modules (*.cpython-3xx-x86_64-linux-gnu.so). There are several hundred; the heaviest carry the most logic. A representative slice:

Module (path under neuronxcc/)SizeOwns
starfish/penguin/simulation/Jit.so20 MBThe Penguin simulation JIT
nki/compiler/backends/neuron/KernelBuilder.so15 MBNKI forward codegenNeuronCodegen; ships with Cython debug info
starfish/penguin/targets/codegen/BirCodeGenLoop.so11 MBThe beta3 Penguin → BIR driver
starfish/penguin/targets/tonga/TongaISAInst.so11 MBThe Tonga ISA instruction model (Python side)
starfish/penguin/targets/transforms/TritiumFusionBase.so10 MBThe Tritium fusion planner base
starfish/penguin/transforms/LowerTensorOp.so10 MBHigh-level TensorOp → tiled-loop lowering
starfish/penguin/ir/IRBuilder.so8.5 MBThe Penguin IR builder
starfish/penguin/ir/Intrinsics.so8.3 MBThe Penguin intrinsic set
nki/compiler/backends/neuron/sema.so6.0 MBNKI semantic legality engine
starfish/penguin/ir/Access.so6.0 MBAccess-pattern / tile-access model
starfish/penguin/targets/codegen/NkiCodegen.so4.9 MBThe Penguin IR → NKI-text re-emit printer
nki/isa/neuron_isa.so3.3 MBThe nki.isa.* intrinsic surface
pelican.so2.6 MBpelican::Expr — the symbolic index/address algebra
starfish/birpy/InstructionOpcodes.so2.9 MBThe BIR opcode bindings (Python side)
driver/commands/CompileCommand.so2.5 MBThe top-level compile command
driver/jobs/WalrusDriver.so, XLAInferGoldens.so3.1 MB ea.The Python job wrappers that fork the tools

NOTE — the two-codegen split is visible right here in the file list: KernelBuilder.so (NeuronCodegen) is the forward builder that turns traced NKI Python into Penguin IR, while NkiCodegen.so (NkiCodegen) is the reverse printer that re-emits NKI text from compiled Penguin IR. They are different classes in different files; do not conflate them. See 6.5.1 and 6.5.9.

Reading the tree

  • starfish/ — the C++ compiler core. bin/ (tools), lib/ (the eight .so), and the Cython penguin/ middle-end + birpy/ bindings.
  • nki/ — the kernel DSL: isa/ (intrinsics), language/ (the nl.* ops), compiler/backends/neuron/ (tracing, sema, codegen), and _private_kernels/ / _private/ (the production kernel library).
  • driver/ — the Python command layer: commands/, jobs/, Arguments, CommandDriver, JobRegistry.
  • hwm/, kra/, logging/ — the hardware model, the runtime-adjacent kra/krt libraries, and the ErrorMessages / Assert diagnostic modules.

Cross-References