How openxla/xla works
XLA is an ML compiler that accepts computations from framework integrations, represents them as HLO, optimizes them through compiler passes, lowers them for hardware backends, and executes compiled programs. Its runtime-facing clients and PJRT interfaces support device interaction, while CPU and GPU backends provide distinct code generation and execution paths. The README documents the product workflow and hardware scope; the source index supports several internal links. Other backend and client details are represented at subsystem level where source excerpts were not available.
Main entry points: local_client.cc Local client · pjrt PJRT clients · ir HLO module and IR · codegen CPU code generation
Components 21
Frontend and clients
- Local client
xla/client/local_client.cc - Python client
xla/python/xla_client.py - PJRT clients
xla/pjrt - Host transfer
xla/pjrt/host_to_device_transfer_manager.cc
Compiler IR and passes
- HLO module and IR
xla/hlo/ir - Shape and layout
xla/shape.h - Shape utilities
xla/shape_util.h - Literal values
xla/literal.h - HLO pass pipeline
xla/hlo/pass/hlo_pass_pipeline.cc - Collective pipelining
xla/service/collective_pipeliner.cc - GPU SPMD pipeline
xla/service/gpu/gpu_spmd_pipeline.cc
Hardware backends
- CPU code generation
xla/backends/cpu/codegen - CPU execution engine
xla/backends/cpu/codegen/execution_engine.cc - GPU code generation
xla/backends/gpu/codegen - GPU thunk pipeline
xla/backends/gpu/runtime/thunk_pass_pipeline.h - Autotuning
xla/backends/autotuner
Execution and services
- CPU runtime
xla/backends/cpu/runtime - GPU runtime
xla/backends/gpu/runtime - Stream Executor
xla/stream_executor - IFRT proxy client
xla/python/ifrt_proxy/client/grpc_client_session.cc
Other components
- ML frameworks
Connections 23
- ML frameworks → Local client: submit computations
- ML frameworks → Python client: submit computations
- Local client → HLO module and IR: compile input
xla/client/local_client.cc - HLO module and IR → HLO pass pipeline: optimize
- HLO pass pipeline → Collective pipelining: runs pass
- GPU SPMD pipeline → HLO pass pipeline: builds pipeline
xla/service/gpu/gpu_spmd_pipeline.cc - HLO module and IR → Shape and layout: uses shapes
xla/hlo/ir/hlo_module.h - Shape utilities → Shape and layout: operates on
xla/shape_util.h - Local client → Literal values: accepts values
xla/client/local_client.cc - Local client → CPU code generation: selects backend
- Local client → GPU code generation: selects backend
- CPU code generation → CPU execution engine: loads generated code
xla/backends/cpu/codegen/execution_engine.cc - CPU execution engine → CPU runtime: executes kernels
- GPU code generation → GPU thunk pipeline: lowers for runtime
- GPU thunk pipeline → GPU runtime: dispatches thunks
xla/backends/gpu/runtime/thunk_pass_pipeline.h - CPU code generation → Autotuning: tunes kernels
- GPU code generation → Autotuning: tunes kernels
- PJRT clients → Host transfer: transfers buffers
xla/pjrt/host_to_device_transfer_manager.cc - PJRT clients → Stream Executor: uses device services
- Python client → PJRT clients: connects runtime
- IFRT proxy client → PJRT clients: connects remotely
xla/python/ifrt_proxy/client/grpc_client_session.cc - CPU runtime → Stream Executor: uses platform services
- GPU runtime → Stream Executor: uses platform services
xla/backends/gpu/runtime/thunk_pass_pipeline.h