Skip to content

chore(optimizations): remove legacy pflash and spark Python packages - #1117

Merged
davide221 merged 1 commit into
mainfrom
chore/remove-legacy-pflash-pkg
Dec 1, 2026
Merged

davide221 merged 1 commit into
mainfrom
chore/remove-legacy-pflash-pkg

Conversation

@Graffioh

@Graffioh Graffioh commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Why

PFlash v2 and Luce Spark both run in-process in C++ inside luce_server. The standalone Python packages in optimizations/pflash/ (DflashClient, bench_niah_cpp.py, niah_gen.py) and optimizations/spark/ (_daemon.py, calibrate.py, bench.py, train_pregate.py) were legacy test_dflash stdin wrappers with zero callers in server/ or harness/, yet pflash was still installed into every uv workspace, Docker image, and pytest run.

Change

  • Remove legacy Python packages: Delete optimizations/pflash/{pflash,tests,pyproject.toml} and optimizations/spark/{spark,pyproject.toml} while keeping each directory's README.md, RESULTS.md, and media.
  • Unwire pflash from workspace, Docker, and CI: Remove pflash from pyproject.toml (dependencies, ruff exclude, pytest testpaths, uv workspace members/sources), regenerate uv.lock (removes only pflash v0.3.0; luce and torch still supply transformers and setuptools), drop COPY optimizations/pflash layers from Dockerfile and Dockerfile.rocm, and update .github/workflows/ci.yml, .github/ci/test_ci_plan.py, CONTRIBUTING.md, variables.md, and server/test/python/test_full_compress_cache.py.
  • Document optimization ownership: Add optimizations/README.md mapping each subdirectory to its runtime owner in server/src/ (and noting megakernel/ as the only compiled subproject here).
  • Align surviving docs with luce_server: Update optimizations/pflash/README.md (direct download of published Qwen3.5-0.8B-BF16.gguf and DFlash config.json, seg-scoring-head.gguf + --pflash on, aggregate region admission rules, --fa-window vs LUCE_FA_WINDOW, test_dflash --daemon stdin/stream-fd protocol, supported backends exposing pflash_gives_candidate_scores(), citation URL), optimizations/spark/README.md (--spark-vram target semantics, first-boot history bootstrap, citation URL), and label historical script references in server/RESULTS.md, optimizations/spark/RESULTS.md, and server/docs/laguna_integration_plan.md.
  • Unblock CUDA Docker build (GCC 11): Add #include <cstddef> and use std::size_t in contiguous_block_run (server/src/common/concurrency/paged_kv_pool.h), fixing the pre-existing main GCC 11 compile failure in Docker prebuilds / cuda12.
  • Unchanged: optimizations/megakernel/, optimizations/image_gen/, optimizations/kvflash/, optimizations/paged_attention/, and server runtime behavior.

Measured / Tested

  • uv lock --check --offline: passed (85 packages; uv.lock diff removes only pflash v0.3.0).
  • ruff check: passed.
  • pytest .github/ci/: 122 passed (including test_ci_plan.py, test_docs_paths.py, test_check_commit_messages.py).
  • Relative Markdown link check across all 8 modified/added .md files: 0 broken links.
  • test_paged_kv_pool (g++ -std=c++17): 18 passed, plus standalone syntax check on paged_kv_pool.h.
  • CI on prior head: Docker prebuilds / rocm, uv workspace, Build megakernel, Commit messages, CodeQL, GPU tests (DGX GB10), and Build Windows (ROCm HIP) all passed.
  • End-to-end model run skipped: the only C++ edit is adding #include <cstddef> / std::size_t to paged_kv_pool.h, with no runtime behavior change.

Review

  • Fixed all 13 verified findings from Sol 6.2 (high) and cubic-dev-ai: replaced missing convert_hf_to_gguf.py with published Qwen3.5-0.8B-BF16.gguf, added DFlash config.json download, fixed seg-scoring-head.gguf path and --pflash on, corrected aggregate region admission (active tool outputs only aggregate within the current turn), fixed test_dflash --daemon launch/command/--stream-fd protocol, separated --fa-window (luce_server) from LUCE_FA_WINDOW (test_dflash / entrypoint), updated supported PFlash backends (pflash_gives_candidate_scores(), adding inkling2 and excluding laguna), fixed Spark --spark-vram / history bootstrap wording, updated CONTRIBUTING.md and optimizations/README.md ownership links, fixed 404 citation URLs, and labeled historical scripts in server/RESULTS.md, optimizations/spark/RESULTS.md, and server/docs/laguna_integration_plan.md.
  • Also included the GCC 11 #include <cstddef> fix in server/src/common/concurrency/paged_kv_pool.h to unblock Docker prebuilds / cuda12.

Cleanup

  • tidy (Standard + Deslop): verified all hunks, lockfile diff, and relative links; no extra code or slop found.
  • prune-tests / test-audit: deleted optimizations/pflash/tests/test_dflash_client.py with DflashClient; audited .github/ci/test_ci_plan.py and server/test/python/test_full_compress_cache.py — all remaining tests enforce live contracts (0 deletions).

Limits

  • Waiting for the re-triggered Docker prebuilds / cuda12 run to confirm the full CUDA image build and runtime uv sync pass end to end.

@davide221 davide221 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review

No issues found. Checked for bugs and logic errors in the changed code.

Reviewed 345bba6d · 0 candidate issues checked, kept at ≥70% confidence · add the code-review label to review again

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 17 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

View guided diff | Re-trigger cubic

Comment thread optimizations/pflash/README.md Resolved
Comment thread server/RESULTS.md Resolved
Comment thread optimizations/pflash/README.md Resolved
Comment thread pyproject.toml Resolved
@Graffioh
Graffioh force-pushed the chore/remove-legacy-pflash-pkg branch from 345bba6 to 7426c8b Compare November 30, 2026 11:17
@Graffioh Graffioh changed the title chore(pflash): remove legacy Python package from optimizations/pflash chore(optimizations): remove legacy pflash and spark Python packages Nov 30, 2026
@davide221

Copy link
Copy Markdown
Contributor

Docker prebuilds failed on 7426c8bf

Docker build fails compiling the server: a header uses size_t without including .

The Docker image build failed because a C++ header in the server uses the size_t type without including the standard header that defines it, so compilation stops. The pull request only removed Python packages and edited docs and Dockerfiles — it did not touch this C++ code. Editing the Dockerfiles is what triggered this Docker build, which compiles the C++ server from scratch and exposed a header bug that was already in the source tree.

How to fix: Add the missing #include to paged_kv_pool.h

  1. Edit server/src/common/concurrency/paged_kv_pool.h: add #include <cstddef> to the include block.
  2. Rebuild locally to confirm: cmake -S server -B server/build -G Ninja -DCMAKE_BUILD_TYPE=Release && cmake --build server/build -j.
  3. Commit and push; the Docker prebuilds workflow reruns automatically on the PR.

c++ compile error (missing include) · high confidence · run

Details and evidence

Failed: cuda12 › Build and push

Job cuda12, step Build and push, builder stage 14/19 (cmake --build ... --target test_dflash luce_server test_server_unit). The compile of server/src/qwen4exp/qwen4exp_seq_engine.cpp fails:

/src/server/src/common/concurrency/paged_kv_pool.h:283:8: error: 'size_t' does not name a type
  283 | inline size_t contiguous_block_run(const std::vector<uint32_t> & blocks,
note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?

Root cause: server/src/common/concurrency/paged_kv_pool.h:283-284 uses unqualified size_t, but its include block (paged_kv_pool.h:17-20) has only <cstdint>, <limits>, <unordered_map>, <vector> — no <cstddef>. The header is not self-contained: it only compiles when an earlier include happens to leak global ::size_t. In the failing TU, qwen4exp_seq_engine.h:3 includes paged_kv_pool.h first, before <cstddef> at qwen4exp_seq_engine.h:12, so no size_t declaration is in scope when the header is parsed. Other includers (e.g. seq_slot_manager.h, qwen35_backend.h) get size_t leaked from earlier includes and compile fine.

The PR itself changed no C++ (only Python removals, docs, and Dockerfiles). The Docker prebuilds workflow ran because the PR edits Dockerfile/Dockerfile.rocm, which are in the workflow's pull_request.paths filter (.github/workflows/docker.yml:48-55), and its from-scratch server compile surfaced the latent bug. I cannot tell from this tree whether main is currently green (ccache may be masking it there); the fix is the same either way.

Other things to try

  • Verify the header is self-contained locally: echo '#include "common/concurrency/paged_kv_pool.h"' | c++ -std=gnu++17 -I server/src -x c++ -fsyntax-only -
  • If main already carries this fix, rebasing the branch onto main would also clear the failure — check git log main -- server/src/common/concurrency/paged_kv_pool.h.
Patch (1 file)

Not applied anywhere. To try it, save the diff as fix.patch and run git apply fix.patch.

diff --git a/server/src/common/concurrency/paged_kv_pool.h b/server/src/common/concurrency/paged_kv_pool.h
index fda82874..8f3ff72f 100644
--- a/server/src/common/concurrency/paged_kv_pool.h
+++ b/server/src/common/concurrency/paged_kv_pool.h
@@ -14,6 +14,7 @@
 
 #pragma once
 
+#include <cstddef>
 #include <cstdint>
 #include <limits>
 #include <unordered_map>
Prompt for a coding agent
A GitHub Actions run failed in Luce-Org/lucebox. Please fix it.

- Pull request #1117 (branch `chore/remove-legacy-pflash-pkg`), commit 7426c8bf92e79c4be4e3d9f232755f7f40b737f3
- Workflow: Docker prebuilds (https://github.com/Luce-Org/lucebox/actions/runs/46408012380)
- Failed: cuda12 › Build and push

Diagnosis:
Job `cuda12`, step **Build and push**, builder stage 14/19 (`cmake --build ... --target test_dflash luce_server test_server_unit`). The compile of `server/src/qwen4exp/qwen4exp_seq_engine.cpp` fails:

```
/src/server/src/common/concurrency/paged_kv_pool.h:283:8: error: 'size_t' does not name a type
  283 | inline size_t contiguous_block_run(const std::vector<uint32_t> & blocks,
note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
```

Root cause: `server/src/common/concurrency/paged_kv_pool.h:283-284` uses unqualified `size_t`, but its include block (`paged_kv_pool.h:17-20`) has only `<cstdint>`, `<limits>`, `<unordered_map>`, `<vector>` — no `<cstddef>`. The header is not self-contained: it only compiles when an earlier include happens to leak global `::size_t`. In the failing TU, `qwen4exp_seq_engine.h:3` includes `paged_kv_pool.h` first, before `<cstddef>` at `qwen4exp_seq_engine.h:12`, so no `size_t` declaration is in scope when the header is parsed. Other includers (e.g. `seq_slot_manager.h`, `qwen35_backend.h`) get `size_t` leaked from earlier includes and compile fine.

The PR itself changed no C++ (only Python removals, docs, and Dockerfiles). The `Docker prebuilds` workflow ran because the PR edits `Dockerfile`/`Dockerfile.rocm`, which are in the workflow's `pull_request.paths` filter (`.github/workflows/docker.yml:48-55`), and its from-scratch server compile surfaced the latent bug. I cannot tell from this tree whether main is currently green (ccache may be masking it there); the fix is the same either way.

Proposed fix: Add the missing #include <cstddef> to paged_kv_pool.h
1. Edit `server/src/common/concurrency/paged_kv_pool.h`: add `#include <cstddef>` to the include block.
2. Rebuild locally to confirm: `cmake -S server -B server/build -G Ninja -DCMAKE_BUILD_TYPE=Release && cmake --build server/build -j`.
3. Commit and push; the `Docker prebuilds` workflow reruns automatically on the PR.

Suggested patch (a starting point):
```diff
diff --git a/server/src/common/concurrency/paged_kv_pool.h b/server/src/common/concurrency/paged_kv_pool.h
index fda82874..8f3ff72f 100644
--- a/server/src/common/concurrency/paged_kv_pool.h
+++ b/server/src/common/concurrency/paged_kv_pool.h
@@ -14,6 +14,7 @@
 
 #pragma once
 
+#include <cstddef>
 #include <cstdint>
 #include <limits>
 #include <unordered_map>
```

Check out that commit, confirm the diagnosis, make the fix (adjust it if the diagnosis is wrong), and re-run the failing step locally before pushing.

Reply with /ci-fix and what to change to get a revised diagnosis.

@Graffioh
Graffioh force-pushed the chore/remove-legacy-pflash-pkg branch from 7426c8b to 839942f Compare November 30, 2026 11:40
Both PFlash v2 and Luce Spark run in-process in C++ inside luce_server (server/src/pflash, server/src/server/pflash_unified.cpp, server/src/common, server/src/server, server/src/laguna, and server/src/qwen35moe). The standalone Python packages under optimizations/pflash/ and optimizations/spark/ (legacy test_dflash stdin wrappers and offline bench/calibration scripts) are unused by luce_server, eval scripts, or harnesses.

Keep their READMEs, RESULTS, and media as documentation, add optimizations/README.md to clarify where production implementations live, remove pflash from pyproject.toml, uv.lock, Dockerfiles, and CI, align the remaining docs with current luce_server behavior, and add the missing <cstddef> include in server/src/common/concurrency/paged_kv_pool.h so the GCC 11 CUDA Docker build succeeds.
@Graffioh
Graffioh force-pushed the chore/remove-legacy-pflash-pkg branch from 839942f to 6462901 Compare November 30, 2026 11:46
@davide221
davide221 merged commit c101cfd into main Dec 1, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants