Skip to content

cuda: add PTQ1_0 support - #29676

Open
bri-prism wants to merge 5 commits into
ggml-org:masterfrom
PrismML-Eng:ptq1_0-cuda
Open

bri-prism wants to merge 5 commits into
ggml-org:masterfrom
PrismML-Eng:ptq1_0-cuda

Conversation

@bri-prism

@bri-prism bri-prism commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Add PTQ1_0 CUDA dequantization, row access, matrix-vector and MMQ support. Depends on #29672; the first two commits are the rebased codec and its quantizer documentation/CLI regressions, followed by the CUDA implementation, compile repair and host mapping test update. The CUDA delta changes 15 files.

Rebased onto codec fd6d992c2a153bd3f561f348a4701955b0dd39ac (upstream base 5a4afd80779ba51166b59986e61a0bfbb9e1a4c6). Fixed mul_mat_q_case instantiation to supply GGML_PREC_Q8, matching the current two-parameter template. The original head fails offline compilation with the missing-template-argument error; the repaired and rebased translation unit passes.

Fresh validation (CUDA toolkit 12.8.61, explicit targets, offline compilation only):

  • Eight compile checks pass: PTQ MMQ template instance for sm_80, sm_89 and sm_120a; mmq.cu for sm_89; mmvq.cu, convert.cu, getrows.cu and ggml-cuda.cu for sm_80. Rebased mmq.cu also passes sm_80 separately. This is not a full CUDA backend link or device run.
  • Host accessor-replica test now compares against the linked production CPU dequantizer rather than another copied traversal: 2,560,000 comparisons, zero mismatches.
  • Separately extracting the actual production integer accessor (removing device/forceinline qualifiers only) and comparing every packed-byte position/value against the production CPU dequantizer passes 851,968 comparisons. This proves host integer mapping, not native CUDA execution.
  • Codec CPU and GGUF compatibility validation is recorded in ggml: add PTQ1_0, ternary at group 128 #29672; existing TQ1_0 and the published PTQ1_0 layout are preserved.

Follow-up to the Pascal build-warning report: offline mmvq.cu compilation for sm_61 passes with --diag-error=128 (unreachable-loop warnings treated as errors). This used Linux/CUDA 12.8.61; the reported Windows/CUDA 12.9 warning is not reproduced or claimed fixed. No warning suppression or unrelated MSVC narrowing changes were added. CUDA production code is byte-identical to the previous validated head; this restack only adds the codec documentation/CLI tests.

The original PR reported backend passes on A100, RTX 4090 and Blackwell. Those historical results have not been rerun on this rebased head. Native numerical correctness, fallback behavior, persistent memory, real-model kernel traces and matched throughput remain unverified for this update. No GPU, GPU job or GPU CI was started. [skip ci] prevents ordinary CI from starting automatically.

AI assistance: original development used Claude Code; Codex assisted the scoped rebase, precision fix and host-side validation.

@github-actions github-actions Bot added testing Everything test related examples ggml changes relating to the ggml tensor library for machine learning SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language Apple Metal https://en.wikipedia.org/wiki/Metal_(API) CUDA Related to the CUDA backend conversion labels Sep 29, 2026
@bri-prism
bri-prism marked this pull request as ready for review October 14, 2026 17:54
@bri-prism
bri-prism requested review from a team, CISC and ggerganov as code owners October 14, 2026 17:54
@CeruleanSky

CeruleanSky commented Oct 14, 2026 •

Copy link
Copy Markdown

Thanks for doing this, hoping to see a PQ2_0 as well, I built and tried it out, hopefully these tests and log excerpts for compiler warnings are useful to you.

Here are the test results for the commands from the OP for a NVIDIA GeForce GTX 1070 sm_61 with CUDA 12.9:

Test results
D:\llama-model-data\release_bin>test-backend-ops -b CUDA0 -o MUL_MAT -p ptq1_0
ggml_cuda_init: found 1 CUDA devices (Total VRAM: 8191 MiB):
  Device 0: NVIDIA GeForce GTX 1070, compute capability 6.1, VMM: yes, VRAM: 8191 MiB
Testing 2 devices

Backend 1/2: CUDA0
  Device description: NVIDIA GeForce GTX 1070
  Device memory: 8191 MB (7202 MB free)

ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=1,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=2,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=3,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=4,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=5,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=6,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=7,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=8,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=9,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=1,k=4096,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=8,k=4096,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=1,k=128,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=16,n=1,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  MUL_MAT(type_a=ptq1_0,type_b=f32,m=1,n=64,k=256,bs=[1,1],nr=[1,1],per=[0,1,2,3],k_v=0,o=1,src_overlap=0,m_v=0,pad=0): OK
  14/14 tests passed
  Backend CUDA0: OK
Backend 2/2: CPU
  Skipping
2/2 backends passed
OK

D:\llama-model-data\release_bin>test-backend-ops -b CUDA0 -o MUL_MAT_ID -p ptq1_0
ggml_cuda_init: found 1 CUDA devices (Total VRAM: 8191 MiB):
  Device 0: NVIDIA GeForce GTX 1070, compute capability 6.1, VMM: yes, VRAM: 8191 MiB
Testing 2 devices

Backend 1/2: CUDA0
  Device description: NVIDIA GeForce GTX 1070
  Device memory: 8191 MB (7202 MB free)

ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
  MUL_MAT_ID(type_a=ptq1_0,type_b=f32,n_mats=4,n_used=2,b=0,m=64,n=16,k=384,amax=1.000000,m_v=0): OK
  MUL_MAT_ID(type_a=ptq1_0,type_b=f32,n_mats=4,n_used=2,b=0,m=512,n=1,k=256,amax=1.000000,m_v=0): OK
  MUL_MAT_ID(type_a=ptq1_0,type_b=f32,n_mats=4,n_used=2,b=0,m=512,n=32,k=256,amax=1.000000,m_v=0): OK
  3/3 tests passed
  Backend CUDA0: OK
Backend 2/2: CPU
  Skipping
2/2 backends passed
OK

D:\llama-model-data\release_bin>test-backend-ops -b CUDA0 -o GET_ROWS -p ptq1_0
ggml_cuda_init: found 1 CUDA devices (Total VRAM: 8191 MiB):
  Device 0: NVIDIA GeForce GTX 1070, compute capability 6.1, VMM: yes, VRAM: 8191 MiB
Testing 2 devices

Backend 1/2: CUDA0
  Device description: NVIDIA GeForce GTX 1070
  Device memory: 8191 MB (7202 MB free)

ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
  GET_ROWS(type=ptq1_0,n=256,m=5,r=4,be1=1,be2=1,v=0,vs0=0,offset_cols=0): OK
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
  GET_ROWS(type=ptq1_0,n=256,m=5,r=4,be1=1,be2=1,v=0,vs0=1,offset_cols=0): OK
  GET_ROWS(type=ptq1_0,n=256,m=5,r=4,be1=1,be2=1,v=1,vs0=0,offset_cols=0): OK
ggml_cuda_graph_set_enabled: disabling CUDA graphs due to GPU architecture
  GET_ROWS(type=ptq1_0,n=256,m=5,r=4,be1=1,be2=1,v=1,vs0=1,offset_cols=0): OK
  GET_ROWS(type=ptq1_0,n=256,m=5,r=4,be1=7,be2=1,v=0,vs0=0,offset_cols=0): OK
  GET_ROWS(type=ptq1_0,n=256,m=5,r=4,be1=7,be2=1,v=0,vs0=1,offset_cols=0): OK
  GET_ROWS(type=ptq1_0,n=256,m=5,r=4,be1=7,be2=1,v=1,vs0=0,offset_cols=0): OK
  GET_ROWS(type=ptq1_0,n=256,m=5,r=4,be1=7,be2=1,v=1,vs0=1,offset_cols=0): OK
  8/8 tests passed
  Backend CUDA0: OK
Backend 2/2: CPU
  Skipping
2/2 backends passed
OK

D:\llama-model-data\release_bin>test-ptq1_0-element-map
  checked 2560000 element positions across 20000 random blocks
  mismatches: 0
  CUDA element mapping MATCHES the CPU codec exactly

Can you rebase, got a merge conflict with master:

ggml/src/ggml-cpu/arch-fallback.h
ggml/src/ggml-cuda/mmq.cuh
tests/CMakeLists.txt

So I just built the PR branch straight, got a couple build warnings for GGML_TYPE_PTQ1_0 building the cu files, for more completeness I included the other warnings as well from other parts of the code though they may not be caused by this pr:

Build warnings
[64/591] Building CUDA object ggml\src\ggml-cuda\CMakeFiles\ggml-cuda.dir\moe-weighted-reduction.cu.obj
moe-weighted-reduction.cu

tmpxft_0000766c_00000000-7_moe-weighted-reduction.cudafe1.cpp

[65/591] Building CUDA object ggml\src\ggml-cuda\CMakeFiles\ggml-cuda.dir\mmvq.cu.obj
D:\llama-model-data\llama.cpp\ggml\src\ggml-cuda\mmvq.cu(783): warning #128-D: loop is not reachable
          for (int j = 0; j < ncols_dst; ++j) {
          ^
          detected during:
            instantiation of "void mul_mat_vec_q<type,ncols_dst,has_fusion,small_k,halve_iters>(const void *, const void *, const int32_t *, ggml_cuda_mm_fusion_args_device, float *, uint32_t, uint3, uint32_t, uint32_t, uint32_t, uint3, uint32_t, uint32_t, uint32_t, uint3, uint32_t, uint32_t, uint32_t, uint32_t) [with type=GGML_TYPE_PTQ1_0, ncols_dst=2, has_fusion=false, small_k=false, halve_iters=false]" at line 1087
            instantiation of "void mul_mat_vec_q_switch_fusion<type,c_ncols_dst,small_k,halve_iters>(const void *, const void *, const int32_t *, ggml_cuda_mm_fusion_args_device, float *, uint32_t, uint3, uint32_t, uint32_t, uint32_t, uint3, uint32_t, uint32_t, uint32_t, uint3, uint32_t, uint32_t, uint32_t, const dim3 &, const dim3 &, int, uint32_t, cudaStream_t) [with type=GGML_TYPE_PTQ1_0, c_ncols_dst=2, small_k=false, halve_iters=false]" at line 1261
            instantiation of "void mul_mat_vec_q_switch_ncols_dst<type>(const void *, const void *, const int32_t *, ggml_cuda_mm_fusion_args_device, float *, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, cudaStream_t) [with type=GGML_TYPE_PTQ1_0]" at line 1332

Remark: The warnings can be suppressed with "-diag-suppress <warning-number>"

D:\llama-model-data\llama.cpp\ggml\src\ggml-cuda\mmvq.cu(783): warning #128-D: loop is not reachable
          for (int j = 0; j < ncols_dst; ++j) {
          ^
          detected during:
            instantiation of "void mul_mat_vec_q<type,ncols_dst,has_fusion,small_k,halve_iters>(const void *, const void *, const int32_t *, ggml_cuda_mm_fusion_args_device, float *, uint32_t, uint3, uint32_t, uint32_t, uint32_t, uint3, uint32_t, uint32_t, uint32_t, uint3, uint32_t, uint32_t, uint32_t, uint32_t) [with type=GGML_TYPE_PTQ1_0, ncols_dst=3, has_fusion=false, small_k=false, halve_iters=false]" at line 1087
            instantiation of "void mul_mat_vec_q_switch_fusion<type,c_ncols_dst,small_k,halve_iters>(const void *, const void *, const int32_t *, ggml_cuda_mm_fusion_args_device, float *, uint32_t, uint3, uint32_t, uint32_t, uint32_t, uint3, uint32_t, uint32_t, uint32_t, uint3, uint32_t, uint32_t, uint32_t, const dim3 &, const dim3 &, int, uint32_t, cudaStream_t) [with type=GGML_TYPE_PTQ1_0, c_ncols_dst=3, small_k=false, halve_iters=false]" at line 1269
            instantiation of "void mul_mat_vec_q_switch_ncols_dst<type>(const void *, const void *, const int32_t *, ggml_cuda_mm_fusion_args_device, float *, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, cudaStream_t) [with type=GGML_TYPE_PTQ1_0]" at line 1332



mmvq.cu

tmpxft_00004280_00000000-7_mmvq.cudafe1.cpp
[238/591] Building CXX object src\CMakeFiles\llama.dir\llama-graph.cpp.obj
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\memory(3659): warning C4244: 'argument': conversion from 'const int64_t' to 'uint32_t', possible loss of data
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\memory(3659): note: the template instantiation context (the oldest one first) is
D:\llama-model-data\llama.cpp\src\llama-graph.cpp(2507): note: see reference to function template instantiation 'std::unique_ptr<llm_graph_input_out_ids,std::default_delete<llm_graph_input_out_ids>> std::make_unique<llm_graph_input_out_ids,const llama_hparams&,const llama_cparams&,const int64_t&,0>(const llama_hparams &,const llama_cparams &,const int64_t &)' being compiled
[255/591] Building CXX object src\CMakeFiles\llama.dir\llama-quant.cpp.obj
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\type_traits(1688): warning C4244: 'argument': conversion from 'unsigned __int64' to 'int', possible loss of data
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\type_traits(1688): note: the template instantiation context (the oldest one first) is
D:\llama-model-data\llama.cpp\src\llama-quant.cpp(275): note: see reference to function template instantiation 'std::thread &std::vector<std::thread,std::allocator<std::thread>>::emplace_back<llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f>&,ggml_type&,const uint8_t*,float*,size_t&>(llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f> &,ggml_type &,const uint8_t *&&,float *&&,size_t &)' being compiled
D:\llama-model-data\llama.cpp\src\llama-quant.cpp(275): note: see the first reference to 'std::vector<std::thread,std::allocator<std::thread>>::emplace_back' in 'llama_tensor_dequantize_impl'
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\vector(924): note: see reference to function template instantiation '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_one_at_back<llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f>&,ggml_type&,const unsigned char*,float*,size_t&>(llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f> &,ggml_type &,const unsigned char *&&,float *&&,size_t &)' being compiled
        with
        [
            _Ty=std::thread
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\vector(845): note: see reference to function template instantiation '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_back_with_unused_capacity<llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f>&,ggml_type&,const unsigned char*,float*,size_t&>(llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f> &,ggml_type &,const unsigned char *&&,float *&&,size_t &)' being compiled
        with
        [
            _Ty=std::thread
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\vector(863): note: see reference to function template instantiation 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f>&,ggml_type&,const unsigned char*,float*,size_t&>(_Alloc &,_Objty *const ,llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f> &,ggml_type &,const unsigned char *&&,float *&&,size_t &)' being compiled
        with
        [
            _Alloc=std::allocator<std::thread>,
            _Ty=std::thread,
            _Objty=std::thread
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\xmemory(736): note: see reference to function template instantiation 'std::thread::thread<llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f>&,ggml_type&,_Ty,float*,size_t&,0>(_Fn,ggml_type &,_Ty &&,float *&&,size_t &)' being compiled
        with
        [
            _Ty=const uint8_t *,
            _Fn=llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f> &
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\thread(93): note: see reference to function template instantiation 'void std::thread::_Start<llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f>&,ggml_type&,_Ty,float*,size_t&>(_Fn,ggml_type &,_Ty &&,float *&&,size_t &)' being compiled
        with
        [
            _Ty=const uint8_t *,
            _Fn=llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f> &
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\thread(76): note: see reference to function template instantiation 'unsigned int (__cdecl *std::thread::_Get_invoke<std::thread::_Start::_Tuple,0,1,2,3,4>(std::integer_sequence<size_t,0,1,2,3,4>) noexcept)(void *) noexcept' being compiled
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\thread(67): note: see reference to function template instantiation 'unsigned int std::thread::_Invoke<_Tuple,0,1,2,3,4>(void *) noexcept' being compiled
        with
        [
            _Tuple=std::thread::_Start::_Tuple
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\thread(60): note: see reference to function template instantiation 'void std::invoke<llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f>,ggml_type,const uint8_t*,_Ty*,unsigned __int64>(_Callable &&,_Ty1 &&,const uint8_t *&&,_Ty *&&,unsigned __int64 &&) noexcept(false)' being compiled
        with
        [
            _Ty=float,
            _Callable=llama_tensor_dequantize_impl::<lambda_121cf0dbfedb4a0daa40ff737e80b57f>,
            _Ty1=ggml_type
        ]
[256/591] Building CXX object src\CMakeFiles\llama.dir\llama-model.cpp.obj
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\utility(274): warning C4244: 'initializing': conversion from '_Ty' to '_Ty2', possible loss of data
        with
        [
            _Ty=int64_t
        ]
        and
        [
            _Ty2=uint32_t
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\utility(274): note: the template instantiation context (the oldest one first) is
D:\llama-model-data\llama.cpp\src\llama-model.cpp(646): note: see reference to function template instantiation 'std::pair<int64_t,uint32_t>::pair<const int64_t&,int64_t,0>(_Other1,_Other2 &&) noexcept' being compiled
        with
        [
            _Other1=const int64_t &,
            _Other2=int64_t
        ]
D:\llama-model-data\llama.cpp\src\llama-model.cpp(646): note: see the first reference to 'std::pair<int64_t,uint32_t>::pair' in 'llama_meta_device_get_split_state::<lambda_b20fc24749696ae3d939259f6a701660>::operator ()'
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\utility(274): warning C4244: 'initializing': conversion from 'const int64_t' to '_Ty2', possible loss of data
        with
        [
            _Ty2=uint32_t
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\utility(274): note: the template instantiation context (the oldest one first) is
D:\llama-model-data\llama.cpp\src\llama-model.cpp(649): note: see reference to function template instantiation 'std::pair<int64_t,uint32_t>::pair<const int64_t&,const int64_t&,0>(_Other1,_Other2) noexcept' being compiled
        with
        [
            _Other1=const int64_t &,
            _Other2=const int64_t &
        ]
D:\llama-model-data\llama.cpp\src\llama-model.cpp(649): note: see the first reference to 'std::pair<int64_t,uint32_t>::pair' in 'llama_meta_device_get_split_state::<lambda_b20fc24749696ae3d939259f6a701660>::operator ()'
[327/591] Building CXX object tools\mtmd\CMakeFiles\mtmd.dir\mtmd-audio.cpp.obj
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\xutility(5421): warning C4244: '=': conversion from 'const _Ty' to 'float', possible loss of data
        with
        [
            _Ty=double
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\xutility(5421): note: the template instantiation context (the oldest one first) is
D:\llama-model-data\llama.cpp\tools\mtmd\mtmd-audio.cpp(323): note: see reference to function template instantiation 'void std::fill<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>,double>(const _FwdIt,const _FwdIt,const double &)' being compiled
        with
        [
            _Ty=float,
            _FwdIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<float>>>
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\xutility(5421): warning C4244: '=': conversion from 'const _Ty' to 'float', possible loss of data
        with
        [
            _Ty=int
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\xutility(5421): note: the template instantiation context (the oldest one first) is
D:\llama-model-data\llama.cpp\tools\mtmd\mtmd-audio.cpp(407): note: see reference to function template instantiation 'void std::fill<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>,int>(const _FwdIt,const _FwdIt,const int &)' being compiled
        with
        [
            _Ty=float,
            _FwdIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<float>>>
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\type_traits(1688): warning C4244: 'argument': conversion from '__int64' to 'int', possible loss of data
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\type_traits(1688): note: the template instantiation context (the oldest one first) is
D:\llama-model-data\llama.cpp\tools\mtmd\mtmd-audio.cpp(1318): note: see reference to function template instantiation 'std::thread::thread<void(__cdecl &)(int,const float *,int,const std::vector<float,std::allocator<float>> &,int,int,int,int,int,const mtmd_audio_cache &,mtmd_audio_mel &),int,const float*&,const int&,std::reference_wrapper<const std::vector<float,std::allocator<float>>>,unsigned __int64,const int&,const int&,const int&,int64_t&,std::reference_wrapper<const mtmd_audio_cache>,std::reference_wrapper<mtmd_audio_mel>,0>(_Fn,int &&,const float *&,const int &,std::reference_wrapper<const std::vector<float,std::allocator<float>>> &&,unsigned __int64 &&,const int &,const int &,const int &,int64_t &,std::reference_wrapper<const mtmd_audio_cache> &&,std::reference_wrapper<mtmd_audio_mel> &&)' being compiled
        with
        [
            _Fn=void (__cdecl &)(int,const float *,int,const std::vector<float,std::allocator<float>> &,int,int,int,int,int,const mtmd_audio_cache &,mtmd_audio_mel &)
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\thread(93): note: see reference to function template instantiation 'void std::thread::_Start<void(__cdecl &)(int,const float *,int,const std::vector<float,std::allocator<float>> &,int,int,int,int,int,const mtmd_audio_cache &,mtmd_audio_mel &),_Ty,const float*&,const int&,std::reference_wrapper<const std::vector<float,std::allocator<float>>>,unsigned __int64,const int&,const int&,const int&,int64_t&,std::reference_wrapper<const mtmd_audio_cache>,std::reference_wrapper<mtmd_audio_mel>>(_Fn,_Ty &&,const float *&,const int &,std::reference_wrapper<const std::vector<float,std::allocator<float>>> &&,unsigned __int64 &&,const int &,const int &,const int &,int64_t &,std::reference_wrapper<const mtmd_audio_cache> &&,std::reference_wrapper<mtmd_audio_mel> &&)' being compiled
        with
        [
            _Ty=int,
            _Fn=void (__cdecl &)(int,const float *,int,const std::vector<float,std::allocator<float>> &,int,int,int,int,int,const mtmd_audio_cache &,mtmd_audio_mel &)
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\thread(76): note: see reference to function template instantiation 'unsigned int (__cdecl *std::thread::_Get_invoke<std::thread::_Start::_Tuple,0,1,2,3,4,5,6,7,8,9,10,11>(std::integer_sequence<size_t,0,1,2,3,4,5,6,7,8,9,10,11>) noexcept)(void *) noexcept' being compiled
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\thread(67): note: see reference to function template instantiation 'unsigned int std::thread::_Invoke<_Tuple,0,1,2,3,4,5,6,7,8,9,10,11>(void *) noexcept' being compiled
        with
        [
            _Tuple=std::thread::_Start::_Tuple
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\thread(60): note: see reference to function template instantiation 'void std::invoke<void(__cdecl *)(int,const float *,int,const std::vector<float,std::allocator<float>> &,int,int,int,int,int,const mtmd_audio_cache &,mtmd_audio_mel &),int,const float*,int,std::reference_wrapper<const std::vector<float,std::allocator<float>>>,unsigned __int64,int,int,int,__int64,std::reference_wrapper<const mtmd_audio_cache>,std::reference_wrapper<mtmd_audio_mel>>(_Callable &&,_Ty1 &&,const float *&&,int &&,std::reference_wrapper<const std::vector<float,std::allocator<float>>> &&,unsigned __int64 &&,int &&,int &&,int &&,__int64 &&,std::reference_wrapper<const mtmd_audio_cache> &&,std::reference_wrapper<mtmd_audio_mel> &&) noexcept(false)' being compiled
        with
        [
            _Callable=void (__cdecl *)(int,const float *,int,const std::vector<float,std::allocator<float>> &,int,int,int,int,int,const mtmd_audio_cache &,mtmd_audio_mel &),
            _Ty1=int
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\type_traits(1688): warning C4244: 'argument': conversion from 'unsigned __int64' to 'int', possible loss of data
[339/591] Building CXX object tools\mtmd\CMakeFiles\mtmd.dir\clip.cpp.obj
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\xutility(5421): warning C4244: '=': conversion from 'const _Ty' to 'float', possible loss of data
        with
        [
            _Ty=double
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\xutility(5421): note: the template instantiation context (the oldest one first) is
D:\llama-model-data\llama.cpp\tools\mtmd\clip.cpp(4995): note: see reference to function template instantiation 'void std::fill<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>,double>(const _FwdIt,const _FwdIt,const double &)' being compiled
        with
        [
            _Ty=float,
            _FwdIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<float>>>
        ]

[391/591] Building CXX object examples\diffusion\CMakeFiles\llama-diffusion.dir\diffusion.cpp.obj
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\utility(274): warning C4267: 'initializing': conversion from 'size_t' to '_Ty2', possible loss of data
        with
        [
            _Ty2=int32_t
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\utility(274): note: the template instantiation context (the oldest one first) is
D:\llama-model-data\llama.cpp\examples\diffusion\diffusion.cpp(338): note: see reference to function template instantiation 'std::pair<float,int32_t> &std::vector<std::pair<float,int32_t>,std::allocator<std::pair<float,int32_t>>>::emplace_back<float&,size_t&>(float &,size_t &)' being compiled
D:\llama-model-data\llama.cpp\examples\diffusion\diffusion.cpp(338): note: see the first reference to 'std::vector<std::pair<float,int32_t>,std::allocator<std::pair<float,int32_t>>>::emplace_back' in 'diffusion_generate'
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\vector(924): note: see reference to function template instantiation '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_one_at_back<float&,size_t&>(float &,size_t &)' being compiled
        with
        [
            _Ty=std::pair<float,int32_t>
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\vector(845): note: see reference to function template instantiation '_Ty &std::vector<_Ty,std::allocator<_Ty>>::_Emplace_back_with_unused_capacity<float&,size_t&>(float &,size_t &)' being compiled
        with
        [
            _Ty=std::pair<float,int32_t>
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\vector(860): note: see reference to function template instantiation 'void std::_Construct_in_place<std::pair<float,int32_t>,float&,size_t&>(_Ty &,float &,size_t &) noexcept' being compiled
        with
        [
            _Ty=std::pair<float,int32_t>
        ]
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.50.35717\include\xutility(522): note: see reference to function template instantiation 'std::pair<float,int32_t>::pair<float&,size_t&,0>(_Other1,_Other2) noexcept' being compiled
        with
        [
            _Other1=float &,
            _Other2=size_t &
        ]
[402/591] Building CXX object tools\completion\CMakeFiles\llama-completion-impl.dir\completion.cpp.obj
D:\llama-model-data\llama.cpp\tools\completion\completion.cpp(386): warning C4804: '>': unsafe use of type 'bool' in operation
[449/591] Building CXX object tests\CMakeFiles\test-gguf.dir\test-gguf.cpp.obj
D:\llama-model-data\llama.cpp\tests\test-gguf.cpp(714): warning C4319: '~': zero extending 'uint32_t' to 'size_t' of greater size

Here is my cmake step so you can see my cuda toolchain, compiler, and other environmental parameters:

Cmake configure

D:\llama-model-data\llama.cpp\build>cmake .. -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_BUILD_TYPE=Release -DOPENSSL_USE_STATIC_LIBS=TRUE -DLLAMA_OPENSSL=ON -DOPENSSL_ROOT_DIR=D:\llama-model-data\llamacpp-builddeps\openssl-3.6.0\x64 -DBUILD_SHARED_LIBS=ON -DGGML_CCACHE=ON -DGGML_STATIC=OFF -DGGML_CUDA=ON -DGGML_CUDA_FA_QUANTS=all -DGGML_CUDA_FORCE_MMQ=TRUE -DGGML_AVX2=ON -DGGML_FMA=ON -DGGML_NATIVE=ON -DGGML_MAX_NAME=128 -DCMAKE_CUDA_ARCHITECTURES=61 -DCMAKE_CUDA_FLAGS="-Wno-deprecated-gpu-targets -allow-unsupported-compiler --diag-suppress 221,177" -DCMAKE_CXX_FLAGS_INIT="/DGGML_MAX_NAME=128 /bigobj" -G Ninja
-- The C compiler identification is MSVC 19.50.35721.0
-- The CXX compiler identification is MSVC 19.50.35721.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- llama.cpp version: 0.5.0-dev
CMAKE_BUILD_TYPE=Release
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.56.0.rc0.windows.1")
-- The ASM compiler identification is MSVC
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-4.2/Modules/CMakeDetermineASMCompiler.cmake:234 (message):
  Policy CMP194 is not set: MSVC is not an assembler for language ASM.  Run
  "cmake --help-policy CMP194" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
Call Stack (most recent call first):
  ggml/CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found assembler: C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- ccache found, compilation results will be cached. Disable with GGML_CCACHE=OFF.
-- CMAKE_SYSTEM_PROCESSOR: AMD64
-- CMAKE_GENERATOR_PLATFORM:
-- GGML_SYSTEM_ARCH: x86
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
-- Including CPU backend
-- x86 detected
-- Performing Test HAS_AVX_1
-- Performing Test HAS_AVX_1 - Success
-- Performing Test HAS_AVX2_1
-- Performing Test HAS_AVX2_1 - Success
-- Performing Test HAS_FMA_1
-- Performing Test HAS_FMA_1 - Success
-- Performing Test HAS_AVX512_1
-- Performing Test HAS_AVX512_1 - Failed
-- Performing Test HAS_AVX512_2
-- Performing Test HAS_AVX512_2 - Failed
-- Adding CPU backend variant ggml-cpu: /arch:AVX2 GGML_AVX2;GGML_FMA;GGML_F16C
-- Found CUDAToolkit: D:/NVIDIA GPU Computing Toolkit/CUDA/v12.9/include (found version "12.9.86")
-- CUDA Toolkit found
-- The CUDA compiler identification is NVIDIA 12.9.86 with host compiler MSVC 19.50.35721.0
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: D:/NVIDIA GPU Computing Toolkit/CUDA/v12.9/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Using CMAKE_CUDA_ARCHITECTURES=61 CMAKE_CUDA_ARCHITECTURES_NATIVE=61-real
-- FlashAttention K-V type combinations: q4_0-q4_0;q4_1-q4_0;q5_0-q4_0;q5_1-q4_0;q8_0-q4_0;bf16-q4_0;f16-q4_0;q4_0-q4_1;q4_1-q4_1;q5_0-q4_1;q5_1-q4_1;q8_0-q4_1;bf16-q4_1;f16-q4_1;q4_0-q5_0;q4_1-q5_0;q5_0-q5_0;q5_1-q5_0;q8_0-q5_0;bf16-q5_0;f16-q5_0;q4_0-q5_1;q4_1-q5_1;q5_0-q5_1;q5_1-q5_1;q8_0-q5_1;bf16-q5_1;f16-q5_1;q4_0-q8_0;q4_1-q8_0;q5_0-q8_0;q5_1-q8_0;q8_0-q8_0;bf16-q8_0;f16-q8_0;q4_0-bf16;q4_1-bf16;q5_0-bf16;q5_1-bf16;q8_0-bf16;bf16-bf16;f16-bf16;q4_0-f16;q4_1-f16;q5_0-f16;q5_1-f16;q8_0-f16;bf16-f16;f16-f16
-- Could NOT find NCCL (missing: NCCL_LIBRARY NCCL_INCLUDE_DIR)
-- Warning: NCCL not found, performance for multiple CUDA GPUs will be suboptimal
-- Including CUDA backend
-- ggml version: 0.25.3
-- ggml commit:  a294e8d5b
-- Found OpenSSL: D:/llama-model-data/llamacpp-builddeps/openssl-3.6.0/x64/lib/libcrypto.lib (found version "3.6.0")
-- Performing Test OPENSSL_VERSION_SUPPORTED
-- Performing Test OPENSSL_VERSION_SUPPORTED - Success
-- OpenSSL found: 3.6.0
-- Generating embedded license file for target: llama-app
-- Configuring done (30.9s)
-- Generating done (0.8s)
-- Build files have been written to: D:/llama-model-data/llama.cpp/build

Preserve the published 128-element, 28-byte codec contract on upstream 5a4afd8. Add CPU byte, CLI and GGUF compatibility coverage. Model-level quality and performance acceptance remains pending.

Assisted-by: Claude Code and Codex
Document the existing group-128 packing and CLI option without changing published names or IDs. Verify actual CLI shape fallbacks to Q4_0/F16 and COPY payload preservation.

Assisted-by: Codex
Assisted-by: Claude Code
Use the linked CPU dequantizer rather than a second copied traversal. This is a host-side accessor replica check and does not claim native CUDA execution.

Assisted-by: Codex
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Apple Metal https://en.wikipedia.org/wiki/Metal_(API) conversion CUDA Related to the CUDA backend documentation Improvements or additions to documentation examples ggml changes relating to the ggml tensor library for machine learning SYCL https://en.wikipedia.org/wiki/SYCL - GPU programming language testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants