Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/transactional_emulator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ jobs:
rust-lint:
runs-on: ubuntu-latest
steps:
# Submodules: clippy compiles `--all-targets`, and one test guard reads the
# compiler's `doc/operation.svh` through `include_str!` to check that every
# opcode the compiler emits decodes here. Without the submodule that is a
# compile error, not a skipped test.
- uses: actions/checkout@v4
with:
submodules: recursive

# Pinned: with `-D warnings`, a rolling channel reds unrelated PRs.
- name: Install Rust toolchain
Expand Down Expand Up @@ -147,3 +153,24 @@ jobs:
- name: Run emulator timing gates
run: |
nix develop --command bash -c "just test-timing-gates"

# Mamba-2 / selective SSM. Synthetic like the tests above -- no checkpoint,
# no HF libs. Inputs are drawn exactly representable in MX-FP8 so the
# reported error is the kernel's rather than the input quantisation's.
#
# All four cases are bit-exact (max absolute error 0.000000), so any
# regression shows up as a hard failure rather than as tolerance drift.
- name: Run Mamba-2 stage tests
run: |
nix develop --command bash -c "just test-mamba2-all"

# The chunked-SSD reference vs the plain recurrence, plus the cross-repo
# stage-marker contract. Pure torch.
- name: Run Mamba-2 reference cross-check
run: |
nix develop --command bash -c "just test-mamba2-reference"

# Bandwidth term + the two KV-cost bugs it exposed in the analytic model.
- name: Run analytic performance-model regression tests
run: |
nix develop --command bash -c "just test-perf-model"
2 changes: 1 addition & 1 deletion PLENA_Compiler
Submodule PLENA_Compiler updated 70 files
+90 −0 .github/workflows/ci.yml
+553 −0 asm_templates/mamba_conv1d_asm.py
+4 −3 asm_templates/preload_act.py
+23 −9 assembler/assembly_to_binary.py
+16 −2 assembler/parser.py
+69 −0 assembler/tests/test_vector_rmask_handling.py
+74 −0 aten/models/kda/__init__.py
+327 −0 aten/models/kda/reference.py
+54 −0 aten/models/kda/shape.py
+95 −0 aten/models/kda/state_precision.py
+21 −0 aten/models/mamba2/__init__.py
+370 −0 aten/models/mamba2/reference.py
+106 −0 aten/native_ops.yaml
+98 −0 aten/ops/cpu/mamba_ops.py
+134 −0 aten/ops/plena/mamba_ops.py
+140 −15 aten/plena/compiler.py
+211 −0 aten/plena/instruction_stream.py
+13 −0 aten/plena/isa_compiler.py
+327 −6 aten/plena/isa_tile_rows.py
+14 −2 aten/plena/memory_state.py
+175 −6 aten/plena/program_fp_tile_ops.py
+298 −0 aten/plena/program_kda_chunk.py
+640 −0 aten/plena/program_kda_common.py
+192 −0 aten/plena/program_kda_conv.py
+248 −0 aten/plena/program_kda_gates.py
+402 −0 aten/plena/program_kda_layer.py
+238 −0 aten/plena/program_kda_mixer.py
+820 −0 aten/plena/program_kda_prefill.py
+290 −0 aten/plena/program_kda_recurrent.py
+640 −0 aten/plena/program_mamba_common.py
+613 −0 aten/plena/program_ssd.py
+272 −0 aten/plena/program_ssm_recurrent.py
+9 −6 aten/plena/program_tensors.py
+374 −0 aten/tests/isa_interpreter.py
+879 −0 aten/tests/test_instruction_budget.py
+607 −0 aten/tests/test_isa_interpreter.py
+246 −0 aten/tests/test_kda_conv.py
+625 −0 aten/tests/test_kda_decode_step.py
+392 −0 aten/tests/test_kda_gates.py
+942 −0 aten/tests/test_kda_layer.py
+461 −0 aten/tests/test_kda_lowering.py
+471 −0 aten/tests/test_kda_mixer.py
+301 −0 aten/tests/test_kda_normalize.py
+336 −0 aten/tests/test_kda_prefill.py
+558 −0 aten/tests/test_kda_prefill_structure.py
+410 −0 aten/tests/test_kda_reference.py
+112 −0 aten/tests/test_kda_stage_contract.py
+220 −0 aten/tests/test_mamba2_reference.py
+95 −0 aten/tests/test_mamba_stage_contract.py
+179 −0 aten/tests/test_no_state_engine.py
+200 −0 aten/tests/test_real_checkpoint.py
+43 −0 aten/tests/test_registry_cpu_signatures.py
+99 −0 aten/tests/test_spill_precision_guard.py
+188 −0 aten/tests/test_ssm_decode_step.py
+302 −0 aten/tests/test_v_fma_vf.py
+86 −0 doc/Model_Lib/kimi-linear-48b-a3b.json
+38 −0 doc/Model_Lib/mamba2-2.7b.json
+54 −0 doc/Model_Lib/nemotron-3-nano-4b.json
+69 −0 doc/Model_Lib/nemotron-3-super-120b-a12b.json
+6 −1 doc/configuration.svh
+12 −3 doc/operation.svh
+102 −1 doc/plena_isa_spec.md
+21 −1 docs/ARCHITECTURE.md
+36 −0 docs/COMPILATION_PIPELINES.md
+435 −17 generator/parser/llm_parser.py
+523 −2 generator/passes/code_gen.py
+74 −4 generator/passes/utilization_report.py
+316 −0 generator/tests/test_mamba_code_gen.py
+403 −0 generator/tests/test_mamba_parser.py
+25 −4 utils/load_config.py
11 changes: 9 additions & 2 deletions analytic_models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
from . import memory, performance, utilisation
"""PLENA analytic models.

__all__ = ["memory", "performance", "utilisation"]
Only the `performance` package exists in this checkout; the previous
`from . import memory, performance, utilisation` raised ImportError on any
`import analytic_models` because `memory` and `utilisation` were never added.
"""

from . import performance

__all__ = ["performance"]
34 changes: 34 additions & 0 deletions analytic_models/performance/customISA_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@
"alone" : "6 + 3 + VECTOR_MUL_CYCLES + 1",
"pipelined" : "VECTOR_MUL_CYCLES"
},
"V_FMA_VF" : {
"alone" : "6 + 3 + VECTOR_MUL_CYCLES + 1",
"pipelined" : "VECTOR_MUL_CYCLES"
},

"V_EXP_V" : {
"alone" : "6 + 3 + VECTOR_EXP_CYCLES + 1",
Expand All @@ -119,6 +123,31 @@
"pipelined" : " 1 + VECTOR_MAX_CYCLES"
},

"V_MAX_VF" : {
"alone" : "6 + 3 + VECTOR_MAX_CYCLES + 1",
"pipelined" : "1 + VECTOR_MAX_CYCLES"
},

"V_MIN_VF" : {
"alone" : "6 + 3 + VECTOR_MAX_CYCLES + 1",
"pipelined" : "1 + VECTOR_MAX_CYCLES"
},

"V_PS_V" : {
"alone" : "6 + 3 + VECTOR_PREFIX_SCAN_CYCLES + 1",
"pipelined" : "VECTOR_PREFIX_SCAN_CYCLES"
},

"V_SHFT_V" : {
"alone" : "6 + 3 + VECTOR_SHIFT_CYCLES + 1",
"pipelined" : "VECTOR_SHIFT_CYCLES"
},

"V_SOFTPLUS_V" : {
"alone" : "6 + 3 + VECTOR_SOFTPLUS_CYCLES + 1",
"pipelined" : "1 + VECTOR_SOFTPLUS_CYCLES"
},

"S_BASIC" : {
"alone" : " SCALAR_FP_BASIC_CYCLES + 1",
"pipelined" : "SCALAR_FP_BASIC_CYCLES"
Expand Down Expand Up @@ -174,6 +203,11 @@
"pipelined" : "1"
},

"S_MAP_FP_V" : {
"alone" : "6 + 1",
"pipelined" : "1"
},

"S_ADD_INT" : {
"alone" : "2 + SCALAR_INT_BASIC_CYCLES + 1",
"pipelined" : "SCALAR_INT_BASIC_CYCLES"
Expand Down
Loading
Loading