Skip to content

Deduplicate q4 quantization functions#383

Merged
ggerganov merged 4 commits into
ggml-org:masterfrom
sw:quant-dedup
Mar 22, 2023
Merged

Deduplicate q4 quantization functions#383
ggerganov merged 4 commits into
ggml-org:masterfrom
sw:quant-dedup

Conversation

@sw

@sw sw commented Mar 22, 2023

Copy link
Copy Markdown
Contributor

As suggested in #356, this de-duplicates the code in ggml_quantize_q4_0 and ggml_quantize_q4_1, which were recently moved to ggml.c

To ensure deterministic creation of model files, I introduced a new "reference" implementation for the q4_0 quantization. For q4_1 this wasn't necessary, as that has no SIMD optimizations.
This quashes @ggerganov's hope of making the quantize program faster, but I believe deterministic model files are more important.

Note that the checksum for models/7B/ggml-model-q4_0.bin is wrong in SHA256SUMS, see #374

@gjmulder gjmulder added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Mar 22, 2023
@sw sw removed bug Something isn't working documentation Improvements or additions to documentation labels Mar 22, 2023
@sw sw force-pushed the quant-dedup branch 2 times, most recently from f59fe8e to e0fe526 Compare March 22, 2023 13:04
@sw

sw commented Mar 22, 2023

Copy link
Copy Markdown
Contributor Author

I've added a basic test for the quantization functions, but it is failing on macOS due to an illegal instruction. I suspect that the CMakeLists.txt selects some optimization flags that the CI machine does not support.

I've disabled the test on macOS for now as I don't have macOS and don't want to hammer this PR further with pushes.

@sw sw requested a review from ggerganov March 22, 2023 13:28
@ggerganov

Copy link
Copy Markdown
Member

I've added a basic test for the quantization functions, but it is failing on macOS due to an illegal instruction. I suspect that the CMakeLists.txt selects some optimization flags that the CI machine does not support.

Weird, the test passes on my M1.
The test does not go through any SIMD code, so I don't see why it would cause illegal instruction.

@ggerganov ggerganov merged commit 69c9229 into ggml-org:master Mar 22, 2023
@sw sw deleted the quant-dedup branch March 23, 2023 10:12
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
* Deduplicate q4 quantization functions

* Use const; add basic test

* Re-enable quantization test

* Disable AVX2 flags in CI

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
* Deduplicate q4 quantization functions

* Use const; add basic test

* Re-enable quantization test

* Disable AVX2 flags in CI

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
* Deduplicate q4 quantization functions

* Use const; add basic test

* Re-enable quantization test

* Disable AVX2 flags in CI

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
* Deduplicate q4 quantization functions

* Use const; add basic test

* Re-enable quantization test

* Disable AVX2 flags in CI

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
ddvnguyen pushed a commit to ddvnguyen/llama.cpp that referenced this pull request Jul 3, 2026
…gml-org#383 T2)

T2 implements --peer-only: starts llama-engine without loading any
model, just exposing the local GPU backend(s) as a ggml-RPC server and
serving HTTP health checks. Replaces the nomic-embed-text workaround
for the 3060 peer.

Also fixes the start_shared_backend_rpc_server fallback path: when
the scheduler has no non-CPU backends (e.g. tiny placeholder model),
enumerate globally registered accelerator devices instead — same
approach as rpc-server.cpp.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ddvnguyen pushed a commit to ddvnguyen/llama.cpp that referenced this pull request Jul 3, 2026
hydra-z Bot pushed a commit to ddvnguyen/llama.cpp that referenced this pull request Jul 5, 2026
…ra_vortex ggml-org#383)

- --combined-split-mode layer for dense/SSM models: register peer RPC before model load, stock tensor_split places layers cleanly avoiding SSM-corruption
- --peer-only engine mode: GPU backend + HTTP health, no model loaded
- /slots returns empty array in peer-only mode (health check compatibility)
- fit-params build target for VMM integration
ddvnguyen pushed a commit to ddvnguyen/llama.cpp that referenced this pull request Jul 7, 2026
The unified engine's model-loaded path hard-coded set_hydra_capabilities(...
peer_reachable=false, combined_pattern="", split_mode="solo") even when it
was launched with --rpc-engine PEER + --tensor-split, i.e. the peer was
registered as an RPC device BEFORE load and llama.cpp's stock allocator
placed whole layers across CUDA0 + RPC0 (COMBINED-static layer-split, ggml-org#383).

Report the real state instead:
- peer_reachable now reflects whether the peer actually registered (was
  always false, a reporting bug — /health and INFO claimed the peer was
  unreachable even while layers were split onto it).
- split_mode="layer" when a peer registered before load with a tensor-split,
  so Hydra Core can route to the layer-split engine instead of the runtime
  expert path (the add-RPC-after-load path that causes the 35-graph-split
  regression + recurrent-state corruption on dense/SSM models).
- combined_pattern kept EMPTY on purpose: it is the expert regex consumed by
  SET_EXPERT_MODE("combined") -> llama_hydra_rebind_combined_experts
  (server-context.cpp:3651); a non-empty value would trigger the after-load
  expert re-partition that layer-split exists to avoid.

Observability/routing only; no compute-path change. Not compiled in this
environment (no CUDA/2-GPU host) — needs a build_sm86_sm120 build to confirm.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012d7PtURptwKpgMcFZ2MvYn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants