Repository navigation
fix(build): compile the ggml objects with -DNDEBUG - #1050
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <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.
Description
llama.cpp/BUILD.mkused the-DNDEBUGflag withllamaandcommontargets, but not with the ggmlobjects, so plain
assert()stayed live in the CPU hot path (upstream's Release build, instead, compiles them out).LLAMA_CPP_OBJSis the existing umbrella variable (GGML + LLAMA + COMMON + GGUF).What was running: 25
#ifndef NDEBUGblocks inops.cppthat re-read each FFNactivation output row checking
isnan/isinf(swiglu, silu, gelu, geglu…), plusper-row asserts in the quant dot-products.
Measured (token generation, interleaved A/B, medians):
metal.crebuilds ggml at runtime, already with-DNDEBUGBinary shrinks 77–94 KB.
make checkpasses.Trade-off: two
GGML_LOG_DEBUGdiagnostics go quiet (ggml-backend.cpp:496"slow copy",
:899"no backend supports op"), both useful when debugging offload.Same as upstream Release.
Not covered:
whisper.cppandtranscribe.cppbuild their own ggml copies andstill lack the flag — separate PR.
stable-diffusion.cppreuses$(GGML_OBJS)andbenefits for free.
PR Type
Relevant issues
#980 - see this in particular, TY @dexhunter !
Checklist