fix(autotune): coli tune swept GLM-only CUDA and NUMA knobs on every engine - #1584
Merged
Merged
Conversation
candidate_steps offered cuda-pipe-1, cuda-pipe-2 and cuda-sync whenever the plan listed a GPU, whatever the engine. COLI_CUDA_PIPE is read in colibri.c only, and COLI_CUDA_ASYNC only inside expert_group_impl, which is reached from colibri.c alone. On any other engine those candidates were identical runs: each cost a full engine start, and a timing wobble could be accepted as a gain and written into the saved profile. Gate the CUDA sweep on arch == "glm", the same rule JustVugg#898 applied to PIPE and DIRECT. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
numa-on was offered to every engine on a multi-socket host, and the docstring called COLI_NUMA engine-agnostic. The only reader is colibri.c's numa_init, which mbinds colibri's own expert slabs; no other engine reads the variable. Gate it on arch == "glm" with the CUDA pair and correct the docstring. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
coli tuneoffers four knobs to every engine that only GLM-5.2 reads:cuda-pipe-1,cuda-pipe-2andcuda-sync, whenever the plan lists a GPU;numa-on, on a multi-socket host.On any other engine each of those candidates runs the baseline again. It costs a full engine start and a full request rotation, and timing noise can be accepted as a gain and written into the saved profile.
coli tuneon the tiny Qwen3.6 fixture (Windows, RTX 5080 visible to the planner, CPU-onlyqwen36.exe), unfixeddev:qwen36 never reads
COLI_CUDA_PIPE. The reported +70.7% isomp-8plus noise, and the profile now carries a knob that does nothing.Root cause
candidate_stepschecksarchforPIPEandDIRECT(#898), but not for these four:COLI_CUDA_PIPEcolibri.conly (g_cuda_pipe, line 11098)COLI_CUDA_ASYNCexpert_group_implin backend_cuda.cu. That function is reached throughcoli_cuda_expert_group/_pinned, andcolibri.cis their only caller. qwen36 and qwen38 use the_issue/_takepair, which does not read it. olmoe, glm53, deepseek_v41 and inkling do not linkbackend_cuda.o.COLI_NUMAcolibri.conly (numa_init, which mbinds colibri's own expert slabs)The docstring said
COLI_NUMAwas read by every engine.git grepfinds no other reader.Fix
numa-onand the CUDA candidates only whenarch == "glm", the same gatePIPEandDIRECTalready have.OMP_NUM_THREADSstays universal.Two commits: the CUDA pair, then
COLI_NUMA.Tests
In
c/tests/test_autotune.py:test_cuda_and_numa_knobs_are_not_swept_on_other_enginesuses a plan with a GPU and two sockets.numa-on,cuda-pipe-1,cuda-pipe-2andcuda-sync.numa-*orcuda-*candidate and noCOLI_NUMAorCOLI_CUDA_*key, and keep theiromp-*candidate.coli tunebanners DeepSeek V4 but calibrates with the GLM engine and fails #898 test uses one socket and no GPU, so it could not see this.test_sibling_tune_with_a_gpu_and_two_sockets_launches_only_omprunsrun_tunefor qwen36 through the existingFakeServeEngine, with the same plan. The candidates arebaselineandomp-4, no launch sees any of the three variables, and there are 4 engine launches.Fail-before on unfixed
dev:That is 8 subtests plus the
run_tunetest.Verification
tests.test_autotune,tests.test_autotune_engine_output_locale,tests.test_v4_cli(every test module that imports autotune): 47 tests OK, in the cp949 locale and withPYTHONUTF8=1.coli tune --tokens 4 --repeats 1(fixtures fromtools/make_qwen36_tiny.py+convert_qwen36.py,tools/make_olmoe_tiny.py+convert_olmoe_merged.py,tools/make_glm_oracle.py):qwen36_tiny_c:baseline,omp-8, then the gate; no CUDA candidate.olmoe_tiny_c:baseline,omp-8,confirm-winner,confirm-baseline.glm_tiny:baseline,omp-8,cuda-pipe-2,cuda-sync,confirm-winner,confirm-baseline, as before.numa-onis covered by the unit tests only.PYTHONUTF8=1, first commit): 1085 tests, 1 failure and 6 errors, none from this change.test_cuda_test_makefile, which needsmakeon PATH.test_kimi_usage_cli.test_no_arguments_points_at_the_launcher_and_fails. On Windows the engine printscoli.cmd chatand the test looks forcoli chat; it has nothing to do with autotune.🤖 Generated with Claude Code