Skip to content

Commit cbc15a0

Browse files
committed
feat: introduce neural debugger dashboard and update memory UI components to use CSS variables
1 parent d2cbdfe commit cbc15a0

97 files changed

Lines changed: 22003 additions & 1368 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cuda-lane.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CUDA Lane
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
cuda-tests:
12+
name: Run CUDA-only tests
13+
runs-on: [self-hosted, cuda]
14+
timeout-minutes: 30
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.13"
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -e ".[dev]"
27+
28+
- name: Run CUDA tests
29+
run: |
30+
python -m pytest -m "cuda_hardware or cuda_required" -v --tb=short

backend.log

Lines changed: 16799 additions & 0 deletions
Large diffs are not rendered by default.

cppmega_mlx/models/hybrid_lm.py

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
PathCPhysicalAbiBankOwner,
4949
logical_bank_view,
5050
make_physical_abi_bank_owner,
51+
path_c_top_level_kernel_buffer_specs,
5152
write_into_bank_slot,
5253
)
5354
from cppmega_mlx.runtime.path_c_taps import emit_and_tap_path_c_tensor
@@ -1130,10 +1131,17 @@ def path_c_fused_train_block_prim_func(
11301131
11311132
This drives the same schedule planner the production runtime uses and
11321133
returns the generated PrimFunc (carrying the physical-ABI attrs), or
1133-
``None`` when no Path C route region exists. The model never caches the
1134-
artifact — callers that need to reuse it across calls should hold the
1135-
returned reference themselves.
1134+
``None`` when no Path C route region exists. Results are cached per
1135+
``sequence_length`` so repeated calls return the same object.
11361136
"""
1137+
cache: dict[int | None, Any] = getattr(
1138+
self, "_prim_func_cache", None,
1139+
) or {}
1140+
if not hasattr(self, "_prim_func_cache"):
1141+
self._prim_func_cache = cache
1142+
if sequence_length in cache:
1143+
return cache[sequence_length]
1144+
11371145
from cppmega_mlx.runtime.path_c_fusion_schedules import (
11381146
plan_path_c_fusion_schedule_for_region,
11391147
)
@@ -1163,21 +1171,22 @@ def path_c_fused_train_block_prim_func(
11631171
schedule_target = getattr(planned, "schedule_target", None)
11641172
if schedule_target is None:
11651173
return None
1166-
return schedule_target.schedule_template(planned.region)
1174+
result = schedule_target.schedule_template(planned.region)
1175+
cache[sequence_length] = result
1176+
return result
11671177

11681178
def make_path_c_physical_abi_bank_owner(
11691179
self,
11701180
*,
11711181
sequence_length: int | None = None,
11721182
) -> PathCPhysicalAbiBankOwner | None:
1173-
"""Allocate the physical ABI banks the generated fused PrimFunc needs.
1183+
"""Allocate the caller-owned buffers the generated fused PrimFunc needs.
11741184
11751185
Returns a validated :class:`PathCPhysicalAbiBankOwner` whose ``buffers``
11761186
are freshly zero-initialised MLX arrays sized exactly to the generated
1177-
``_cppmega_path_c_physical_buffer_abi_shapes`` map (dtype is taken from
1178-
the corresponding logical-buffer placement so every bank reflects the
1179-
generated kernel ABI). The owner never repacks or copies model tensors;
1180-
it only owns the bank arrays so the runtime can bind kernel arguments
1187+
dtype banks plus any top-level spilled scratch parameters declared by
1188+
the generated PrimFunc. The owner never repacks or copies model
1189+
tensors; it only owns kernel buffers so the runtime can bind arguments
11811190
in declared order.
11821191
11831192
Returns ``None`` when no Path C route region exists for the model.
@@ -1219,6 +1228,17 @@ def make_path_c_physical_abi_bank_owner(
12191228
tuple(int(dim) for dim in tuple(shape)),
12201229
dtype=mx_dtype,
12211230
)
1231+
for name, spec in path_c_top_level_kernel_buffer_specs(
1232+
prim_func,
1233+
physical_abi_map=abi_map,
1234+
physical_abi_shapes=abi_shapes,
1235+
).items():
1236+
if name in bank_buffers:
1237+
continue
1238+
bank_buffers[name] = mx.zeros(
1239+
tuple(int(dim) for dim in tuple(spec["shape"])),
1240+
dtype=_path_c_bank_dtype(str(spec["dtype"])),
1241+
)
12221242
profile_name = str(
12231243
getattr(self, "path_c_profile_name", "HybridTinyLM")
12241244
)

cppmega_mlx/runtime/path_c_fusion.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,7 @@ def _build_legacy_mamba3_fp8_train_diagnostic_region() -> PathCFusionRegion:
20552055
def build_mamba3_fp8_train_acceptance_fixture_region(
20562056
*,
20572057
include_backward: bool = False,
2058+
model_config: Any | None = None,
20582059
) -> PathCFusionRegion:
20592060
"""Return the explicit named acceptance fixture for MRA train-block tests.
20602061
@@ -2064,14 +2065,15 @@ def build_mamba3_fp8_train_acceptance_fixture_region(
20642065
model's actual brick graph.
20652066
"""
20662067

2067-
from cppmega_mlx.recipes.model_factory import local_gb10_quarter_profile
2068+
if model_config is None:
2069+
from cppmega_mlx.recipes.model_factory import local_gb10_quarter_profile
20682070

2069-
acceptance_profile = local_gb10_quarter_profile()
2071+
model_config = local_gb10_quarter_profile().hybrid_config()
20702072
return _build_path_c_acceptance_fixture_region_from_route_symbols(
20712073
region_name="mamba3_m2rnn_attention_fp8_train_block",
20722074
route_symbols=("M", "R", "A"),
20732075
include_backward=include_backward,
2074-
model_config=acceptance_profile.hybrid_config(),
2076+
model_config=model_config,
20752077
acceptance_tags=("mamba3_fp8_train_acceptance",),
20762078
)
20772079

0 commit comments

Comments
 (0)