[PR #90] [MERGED] Route log: the near misses (route ranks k+1 .. k+16) after a '|' - for cache studies, written only with STRATA_GLM_ROUTE_LOG #327

Closed
opened 2026-10-29 21:24:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/90
Author: @sociolog
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/10/2026
Merged by: @mw00

Base: main ← Head: pr-route-near


📝 Commits (2)

  • e3c9087 Route log: the near misses (route ranks k+1 .. k+16) after a '|' - for cache studies, written only with STRATA_GLM_ROUTE_LOG
  • f82ff9c Route log: the near misses' field is near_ids - windows.h defines near (#90 on Windows)

📊 Changes

3 files changed (+18 additions, -5 deletions)

View changed files

📝 include/strata/kernels/glm_fast.hpp (+2 -1)
📝 src/core/glm_fast_path.cu (+7 -2)
📝 src/kernels/cuda/glm_fast.cu (+9 -2)

📄 Description

What

As offered on #79: with STRATA_GLM_ROUTE_LOG=<prefix>, each route line becomes

layer e0 .. e7 fetch miss cpu | n0 .. n15

where n0 .. n15 are the experts that just missed the route - ranks k+1 .. k+16 by the same selection score, best first.
That is what a replay needs to ask whether a near miss predicts reuse (on Maya-M it did not: near-miss-weighted counts
and near-miss recency both stayed within a point of plain LFU / LRU - #79).

  • Route kernel: with near_n > 0 it continues its top-k selection for near_n more ranks (the top k are already
    -inf in s_sel; the prediction recomputes s_sel after it) and writes them into MoeRequest::near[16]. near_n is
    16 with the route log on and 0 without - then the extra selection and the 16 writes are skipped, so no more bytes
    cross PCIe per route than today.
  • Service thread: the log line gets | and the near misses up to the first -1; the existing comment line stays
    as it is (the explanation goes below it, so #88's route_dump line above it merges cleanly).
  • MoeRequest grows by 32 bytes (16 shorts, before x).

The replay that reads these lines (with or without the near misses): #91.

Checks

RTX 3090 + 3060, Maya-M (RAM_RESIDENT=1, split 30):

  • build sm_75 / sm_86; glm_dsa_parity, glm_ffn_parity, glm_hc_parity, glm_kda_parity, glm_layer_parity
    --selftest: all PASS; server tests OK (3 skipped);
  • STRATA_GLM_SCORE on 1,135 held-out tokens: without the log, the same numbers to the last digit as our build of
    v1.0.31's engine code (NLL 1.30094, 114,052 CPU-lane experts); with the log on, the same numbers again - the log
    does not touch the decode;
  • the trace: 32,373 + 17,985 routes, every line with 16 near misses after the |;
  • merges cleanly with the open PRs that touch these files (#75, #76, #78, #80, #81, #85, #86, #88).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mw00/project-maya/pull/90 **Author:** [@sociolog](https://github.com/sociolog) **Created:** 10/10/2026 **Status:** ✅ Merged **Merged:** 10/10/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `pr-route-near` --- ### 📝 Commits (2) - [`e3c9087`](https://github.com/mw00/project-maya/commit/e3c908775dbb154cbe73f67cff145438a8dfc0e0) Route log: the near misses (route ranks k+1 .. k+16) after a '|' - for cache studies, written only with STRATA_GLM_ROUTE_LOG - [`f82ff9c`](https://github.com/mw00/project-maya/commit/f82ff9c48b4e35e297821b161f93a3ebfc038e9d) Route log: the near misses' field is near_ids - windows.h defines near (#90 on Windows) ### 📊 Changes **3 files changed** (+18 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/kernels/glm_fast.hpp` (+2 -1) 📝 `src/core/glm_fast_path.cu` (+7 -2) 📝 `src/kernels/cuda/glm_fast.cu` (+9 -2) </details> ### 📄 Description ## What As offered on #79: with `STRATA_GLM_ROUTE_LOG=<prefix>`, each route line becomes layer e0 .. e7 fetch miss cpu | n0 .. n15 where n0 .. n15 are the experts that just missed the route - ranks k+1 .. k+16 by the same selection score, best first. That is what a replay needs to ask whether a near miss predicts reuse (on Maya-M it did not: near-miss-weighted counts and near-miss recency both stayed within a point of plain LFU / LRU - #79). - **Route kernel:** with `near_n > 0` it continues its top-k selection for `near_n` more ranks (the top k are already -inf in `s_sel`; the prediction recomputes `s_sel` after it) and writes them into `MoeRequest::near[16]`. `near_n` is 16 with the route log on and 0 without - then the extra selection and the 16 writes are skipped, so no more bytes cross PCIe per route than today. - **Service thread:** the log line gets ` |` and the near misses up to the first -1; the existing comment line stays as it is (the explanation goes below it, so #88's `route_dump` line above it merges cleanly). - `MoeRequest` grows by 32 bytes (16 shorts, before `x`). The replay that reads these lines (with or without the near misses): #91. ## Checks RTX 3090 + 3060, Maya-M (`RAM_RESIDENT=1`, split 30): - build sm_75 / sm_86; `glm_dsa_parity`, `glm_ffn_parity`, `glm_hc_parity`, `glm_kda_parity`, `glm_layer_parity` `--selftest`: all PASS; server tests OK (3 skipped); - `STRATA_GLM_SCORE` on 1,135 held-out tokens: without the log, the same numbers to the last digit as our build of v1.0.31's engine code (NLL 1.30094, 114,052 CPU-lane experts); with the log on, the same numbers again - the log does not touch the decode; - the trace: 32,373 + 17,985 routes, every line with 16 near misses after the `|`; - merges cleanly with the open PRs that touch these files (#75, #76, #78, #80, #81, #85, #86, #88). --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:24:13 +07:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mw00/project-maya#327
No description provided.