vLLM-CENT compiles model-specific operations into a typed CENT program. The
first frontend lowers one batch-one Llama decode block; the generic cent/
package contains no Llama or transformer definitions.
This project does not execute a model and does not require an emulator. Its output is an ordered sequence of instructions for the architecture described in the CENT paper.
The instruction classes model all commands in Tables 2 and 3 with their full operand lists:
- Near-bank PUs:
MAC_ABK,EW_MUL, andAF. - PNM units:
EXP,RED,ACC, andRISCV. - CXL movement:
SEND_CXL,RECV_CXL, andBCAST_CXL. - Shared Buffer and DRAM movement:
WR_SBK,RD_SBK, andWR_ABK. - Global Buffer and PU movement:
COPY_BKGB,COPY_GBBK,WR_BIAS,RD_MAC, andWR_GB.
Python fields use readable names while docstrings retain the paper terms. For
example, CentMemoryAddress.row is the paper's RO, column is CO, and
CentSharedBufferAddress.slot is used as Rs or Rd according to whether it
is a source or destination. accumulation_register is Regid.
OPsize is represented by operation_size. One instruction causes the CENT
decoder to generate that many micro-operations over consecutive 256-bit Shared
Buffer slots and DRAM column regions. A five-burst transfer that fits in one
row is therefore one instruction with operation_size=5, not five duplicate
instructions.
render_text_program emits the Table 2/3 assembly. The package deliberately
does not model SYNC, EOC, or RD_AF: a full-text search of the paper found
no such instructions, and they belong to the old reference simulator's trace
protocol rather than CENT's published ISA. CentProgram is therefore just an
immutable, nonempty ordered tuple of real ISA instructions; finishing a builder
does not append an artificial terminator.
models/llama/ cent/
-------------------------- --------------------------
Llama dimensions CENT hardware geometry
Llama tensor layout complete typed CENT ISA
Llama lowering stages hardware-aware validation
Llama block orchestration generic program builder
assembly renderers
\ /
CompileRequest
|
compile_transformer_block
|
CentProgram
A future model family belongs in its own models/<family>/ package and reuses
the target types. compiler.py remains only a small family dispatcher.
LlamaModelSpecdescribes one Llama block.CentHardwareSpecdescribes DRAM geometry, the 64KB Shared Buffer as 2,048 256-bit slots by default, PU accumulation-register capacity, and the target ABI's sigmoidAFid.CentBlockPlacementSpecassigns physical channels to one block.DecodeStepSpecprovides current and reserved context lengths.CompileRequestcombines the source model, target, placement, and decode step.compile_transformer_blockreturns a validatedCentProgram.render_text_programemits paper-ISA assembly.
The Llama frontend currently lowers RMSNorm, Q/K/V projections, rotary embedding data movement and multiplication, KV-cache updates, attention-score GEMV, the existing two-pass softmax data path, value-cache GEMV, output projection, residual additions, and the gated SiLU feed-forward network.
Two paper-to-implementation gaps remain explicit rather than guessed:
- The paper names
AFidbut does not publish numeric function IDs. Rather than guessing,CentHardwareSpec.sigmoid_activation_function_idrequires the caller to provide the target ABI's value. Tests use zero only as a documented fake target value. - The paper explains that uncommon operations such as reciprocal and square
root run through
RISCV, but does not publish their program-counter entry addresses. Consequently the current softmax/RMSNorm lowering is not yet a complete executable paper algorithm; wiring those operations requires a target runtime ABI that supplies the correctPCvalues.
From this directory, either install the package in editable mode or expose its
src directory:
python3 -m pip install -e .
python3 -m unittest discover -s tests -vPYTHONPATH=src python3 -m unittest discover -s tests -vThe tests render all 18 paper instructions with distinct operands, validate DRAM/Shared Buffer/register boundaries, verify immutable static opcodes, test every nontrivial lowering helper directly, preserve exact small-model golden counts, and compile Llama 3 8B and 70B block dimensions.