Skip to content

fix(cmake): adopt DFLASH27B_* options left from before the rename - #751

Open
Graffioh wants to merge 1 commit into
Luce-Org:mainfrom
Graffioh:codex/cmake-legacy-option-migration
Open

Graffioh wants to merge 1 commit into
Luce-Org:mainfrom
Graffioh:codex/cmake-legacy-option-migration

Conversation

@Graffioh

@Graffioh Graffioh commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

The luce rename (#748) moved every CMake option from DFLASH27B_* (and DFLASH_GPU_SAMPLER) to LUCE_* with no migration. A build directory configured under the old names keeps them in its cache, so its next configure silently falls back to the defaults:

  • An R9700 build dir with DFLASH27B_HIP_ARCHITECTURES=gfx1201 got LUCE_HIP_ARCHITECTURES empty and compiled ggml for the gfx1151 default. Unit tests still passed because they launch no kernels, but a live luce_server segfaulted in its first HIP kernel launch (rms_norm_mul_f32_cuda in the PFlash drafter forward) and logged nothing.
  • A DFLASH27B_GPU_BACKEND=hip dir would switch to CUDA.

CI configures fresh dirs with the new names, so it never sees this.

Fix: each renamed user option adopts its old cached value once, when the new option is unset, empty, or still at its declared default (the list in the shim mirrors each option's declaration). It prints a rename warning and then drops the old entry. Checking against the default matters because a single configure caches LUCE_GPU_BACKEND=cuda and the ON switches. So an old -D on an existing dir, or a stale old entry in a dir reconfigured once after the rename, is adopted too. A LUCE_* value set away from its default wins, and the old flag is reported as ignored. The adopted entry keeps the new option's cache type, or BOOL for an untyped ON/OFF option that this backend doesn't declare (LUCE_GPU_SAMPLER on HIP).

Checked with two real configures (HIP, ROCm 7.2.4):

  • A fresh dir with -DDFLASH27B_GPU_BACKEND=hip -DDFLASH27B_HIP_ARCHITECTURES=gfx1201 gives --offload-arch=gfx1201 for ggml-hip and luce_common.
  • A dir first configured without an arch (gfx1151 default), then reconfigured with -DDFLASH27B_HIP_ARCHITECTURES=gfx1201, switches to --offload-arch=gfx1201.
  • A dir with defaults cached (LUCE_TESTS:BOOL=ON), reconfigured with -DDFLASH27B_TESTS=OFF -DDFLASH27B_HIP_ARCHITECTURES=gfx1201, gives LUCE_TESTS:BOOL=OFF and 227 gfx1201 / 0 gfx1151 offload-arch flags.
  • A fresh HIP dir with -DDFLASH_GPU_SAMPLER=OFF gives LUCE_GPU_SAMPLER:BOOL=OFF, and a second plain reconfigure prints no rename warnings.
  • A standalone copy of the shim covers GPU_BACKEND: a cached cuda default plus -DDFLASH27B_GPU_BACKEND=hip, or a stale old hip entry, both give hip. A user-set LUCE_HIP_ARCHITECTURES=gfx1100 beats an old gfx1201. (This box has no nvcc, so a real CUDA-default configure can't finish here.)

🤖 Generated with Claude Code

Review in cubic

@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 1 file

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread server/CMakeLists.txt Outdated
@Graffioh
Graffioh force-pushed the codex/cmake-legacy-option-migration branch 4 times, most recently from 9c5e4d3 to 2f20420 Compare September 24, 2026 07:22
The luce rename moved every CMake option from DFLASH27B_* (and
DFLASH_GPU_SAMPLER) to LUCE_* with no migration. A build directory
configured under the old names keeps them in its cache, and its next
configure silently falls back to the defaults: an R9700 build dir
reconfigured with LUCE_HIP_ARCHITECTURES empty compiled ggml for gfx1151
and the server segfaulted in the first HIP kernel launch; a
DFLASH27B_GPU_BACKEND=hip dir would switch to CUDA. Fresh CI build dirs
never see it.

Each renamed user option now adopts its old cached value once, with a
warning, and the old entry is dropped. The value is adopted when the
new option is unset, empty, or still at its declared default: a single
configure caches GPU_BACKEND=cuda and the ON switches, so an old -D on
an existing dir, or a stale old entry in a dir reconfigured once after
the rename, must still win over them. A LUCE_* value set away from its
default wins, and the old flag is reported as ignored. The adopted
entry keeps the new option's cache type, or BOOL for an untyped ON/OFF
option not declared on this backend.

Checked with real HIP configures: a fresh dir with the old names, and a
dir already configured with the defaults, both give
--offload-arch=gfx1201 for ggml-hip and luce_common; the second also
gives LUCE_TESTS:BOOL=OFF from -DDFLASH27B_TESTS=OFF, and
-DDFLASH_GPU_SAMPLER=OFF gives LUCE_GPU_SAMPLER:BOOL=OFF.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Graffioh
Graffioh force-pushed the codex/cmake-legacy-option-migration branch from 2f20420 to ee26c18 Compare September 24, 2026 07:22
@davide221

Copy link
Copy Markdown
Contributor

@cubic review this

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

@cubic review this

@davide221 I have started the AI code review. It will take a few minutes to complete.

@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.

No issues found across 1 file

Re-trigger cubic

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