Repository Analysis

ggml-org/ggml

Tensor library for machine learning

2.2 Likely human-written View on GitHub
2.2
Adjusted Score
2.2
Raw Score
100%
Time Factor
2026-05-29
Last Push
14,729
Stars
C++
Language
311,980
Lines of Code
563
Files
640
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 7MEDIUM 11LOW 622

Pattern Findings

640 matches across 12 categories. Click a row to expand file-level details.

Over-Commented Block582 hits · 564 pts
SeverityFileLineSnippet
LOWci/run.sh1#/bin/bash
LOWci/run.sh241 gg_printf '```\n'
LOWci/run.sh261#
LOWinclude/ggml-cpp.h1#pragma once
LOWinclude/ggml-sycl.h1//
LOWinclude/ggml-backend.h1#pragma once
LOWinclude/ggml-backend.h381 // - most tensors have n_segments == 1 and a contiguous slice of the tensor data
LOWinclude/ggml-cuda.h1#pragma once
LOWinclude/ggml-opt.h1// This file contains functionality for training models using GGML.
LOWinclude/ggml-opt.h181 struct ggml_tensor * inputs,
LOWinclude/ggml-metal.h1// Note: this description is outdated
LOWinclude/ggml-metal.h21
LOWinclude/gguf.h1// This file contains functionality related to "GGUF" files, the binary file format used by ggml.
LOWinclude/gguf.h21// 1. The size of the tensor in the dimension (int64_t).
LOWinclude/gguf.h161 // add tensor to GGUF context, tensor name must be unique
LOWinclude/gguf.h181 // fwrite(f, ...); // write tensor data
LOWinclude/ggml-rpc.h1#pragma once
LOWinclude/ggml.h1#pragma once
LOWinclude/ggml.h21//
LOWinclude/ggml.h41// struct ggml_context * ctx = ggml_init(params);
LOWinclude/ggml.h61// struct ggml_cgraph * gf = ggml_new_graph(ctx);
LOWinclude/ggml.h81// and after defining the computation graph, call the ggml_used_mem() function to find out how much memory was
LOWinclude/ggml.h101// - ggml_conv_1d_2s()
LOWinclude/ggml.h121// assert(c->src[0] == a);
LOWinclude/ggml.h141// *(float *) ((char *) a->data + y*a->nb[1] + x*a->nb[0]) = x + y;
LOWinclude/ggml.h161//
LOWinclude/ggml.h181# define GGML_API __declspec(dllimport) extern
LOWinclude/ggml.h201#elif defined(__MINGW32__) && !defined(__clang__)
LOWinclude/ggml.h221
LOWinclude/ggml.h241 #define GGML_MEM_ALIGN 8
LOWinclude/ggml.h261__host__ __device__ constexpr inline void ggml_unused_vars_impl(Args&&...) noexcept {}
LOWinclude/ggml.h281#elif defined(_MSC_VER)
LOWinclude/ggml.h1781 struct ggml_context * ctx,
LOWinclude/ggml.h1801 // ext_factor = 0.0f
LOWinclude/ggml.h1821 float freq_base,
LOWinclude/ggml.h1841 // - for VISION, n_dims must be head_size/2
LOWinclude/ggml.h2101 // example:
LOWinclude/ggml.h2381 GGML_API struct ggml_tensor * ggml_arange(
LOWinclude/ggml.h2661 struct ggml_tensor * adamw_params); // parameters such as the learning rate
LOWinclude/ggml.h2681 // [0 1 ... idx ... n-1] <-- ggml_build_forward_select(..., n, idx)
LOWinclude/ggml.h2741
LOWinclude/ggml.h2781# define GGML_RESTRICT __restrict__
LOWtests/test-conv2d.cpp1#include "ggml.h"
LOWtests/test-timestep_embedding.cpp1#include "ggml.h"
LOWtests/test-conv1d-dw-c1.cpp1#include "ggml.h"
LOWtests/test-conv1d-dw-c2.cpp1#include "ggml.h"
LOWtests/test-pad-reflect-1d.cpp1#include "ggml.h"
LOWtests/test-quantize-fns.cpp1// Unit tests for quantization specific functions - quantize, dequantize and dot product
LOWtests/test-roll.cpp1#include <ggml.h>
LOWtests/test-opt.cpp1// TODO refactor
LOWtests/test-conv-transpose-1d.cpp1#include "ggml.h"
LOWtests/test-quantize-perf.cpp1// Benchmark quantization specific functions on synthetic data
LOWtests/test-arange.cpp1#include "ggml.h"
LOWtests/test-customop.c1#include "ggml.h"
LOWtests/test-conv1d.cpp1#include "ggml.h"
LOWtests/test-backend-ops.cpp1// This file defines tests for various GGML ops and backends.
LOWtests/test-backend-ops.cpp21#include <ggml-cpp.h>
LOWtests/test-backend-ops.cpp41#include <sstream>
LOWtests/test-backend-ops.cpp421#define VARS_TO_STR2(a, b) VAR_TO_STR(a) + "," + VAR_TO_STR(b)
LOWtests/test-backend-ops.cpp1901// ####################################
522 more matches not shown…
Verbosity Indicators16 hits · 26 pts
SeverityFileLineSnippet
LOWtests/test-backend-ops.cpp1932 // Step 1: create input tensors that don't depend on any other tensors:
LOWtests/test-backend-ops.cpp1939 // Step 2: use the op that you want to test in the GGML compute graph.
LOWtests/test-backend-ops.cpp1943 // Step 3: return the output tensor.
LOWsrc/ggml-webgpu/ggml-webgpu.cpp1290 // For set rows specifically, we need to check if src and idx are empty
LOWsrc/ggml-cann/aclnn_ops.cpp2809 // Step 5: multiply by attn_factor
LOWsrc/ggml-cann/aclnn_ops.cpp2826 // Step 6: repeat
LOWsrc/ggml-cann/aclnn_ops.cpp3090 // Step 1: Prepare trans tensors for F16 type conversion to F32 if needed
LOWsrc/ggml-cann/aclnn_ops.cpp3115 // Step 2: Prepare head tensors for tail splitting if needed
LOWsrc/ggml-cann/aclnn_ops.cpp3144 // Step 3: Execute RotaryPositionEmbedding
LOWsrc/ggml-cann/aclnn_ops.cpp3191 // Step 4: Copy unrotated tail portion from source to destination
LOWsrc/ggml-cann/aclnn_ops.cpp3220 // Step 5: Cast back to F16 if needed
LOWsrc/ggml-cann/aclnn_ops.cpp3906 // Step 1: cast the src0 (Query) to fp16 if needed
LOWsrc/ggml-cann/aclnn_ops.cpp3929 // Step 2: create the acl tensors for src1 (Key), src2 (Value),
LOWsrc/ggml-cann/aclnn_ops.cpp3973 // Step 3: create the PSEShift tensor if needed
LOWsrc/ggml-cann/aclnn_ops.cpp4042 // Step 4: set the inputs for FusedInferAttention.
LOWsrc/ggml-cann/aclnn_ops.cpp4103 // Step 6: post-processing — slice padded output and/or cast to f32
AI Slop Vocabulary7 hits · 21 pts
SeverityFileLineSnippet
MEDIUMexamples/mnist/mnist-common.h20// The physical batch size determines how many datapoints are processed in parallel, larger values utilize compute bette
MEDIUMsrc/ggml-zendnn/ggml-zendnn.cpp600 // gather + batched matmul + scatter approach. Future versions will leverage
MEDIUMsrc/ggml-cpu/amx/mmq.cpp603 // pack again with 128 to fully utilize vector length
MEDIUMsrc/ggml-cpu/amx/mmq.cpp645 // pack again with 128 to fully utilize vector length
MEDIUMsrc/ggml-cpu/amx/mmq.cpp743 // pack again with 128 to fully utilize vector length
MEDIUMsrc/ggml-opencl/ggml-opencl.cpp4396 // that wraps around q and d to utilize image access path.
MEDIUMsrc/ggml-opencl/ggml-opencl.cpp4430 // that wraps around q and d to utilize image access path.
Cross-File Repetition4 hits · 20 pts
SeverityFileLineSnippet
HIGHexamples/gpt-2/convert-ckpt-to-ggml.py0returns list of utf-8 byte and a corresponding list of unicode strings. the reversible bpe codes work on unicode strings
HIGHexamples/gpt-2/convert-h5-to-ggml.py0returns list of utf-8 byte and a corresponding list of unicode strings. the reversible bpe codes work on unicode strings
HIGHexamples/gpt-2/convert-cerebras-to-ggml.py0returns list of utf-8 byte and a corresponding list of unicode strings. the reversible bpe codes work on unicode strings
HIGHexamples/gpt-j/convert-h5-to-ggml.py0returns list of utf-8 byte and a corresponding list of unicode strings. the reversible bpe codes work on unicode strings
Synthetic Comment Markers3 hits · 15 pts
SeverityFileLineSnippet
HIGHtests/test-backend-ops.cpp9804 printf(" --test-file reads test operators from a test file generated by llama-export-graph-ops\n");
HIGHsrc/ggml-virtgpu/regenerate_remoting.py3# Generated by Claude AI
HIGHsrc/ggml-hexagon/ggml-hexagon.cpp2484 // Check for F16 support only as requested
Hyper-Verbose Identifiers10 hits · 10 pts
SeverityFileLineSnippet
LOWinclude/ggml-backend.h211 typedef ggml_backend_buffer_type_t (*ggml_backend_split_buffer_type_t)(int main_device, const float * tensor_split
LOWexamples/mnist/server.py9class CustomHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
LOWexamples/python/ggml/utils.py172def __check_shape_consistent_with_type(tensor: TensorLike):
LOWsrc/ggml-virtgpu/regenerate_remoting.py49 def _check_clang_format_available(self) -> bool:
LOWsrc/ggml-virtgpu/regenerate_remoting.py53 def _format_file_with_clang_format(self, file_path: Path) -> bool:
LOWsrc/ggml-virtgpu/regenerate_remoting.py78 def generate_backend_function_name(self, group_name: str, function_name: str) -> str:
LOWsrc/ggml-virtgpu/regenerate_remoting.py89 def generate_frontend_function_name(self, group_name: str, function_name: str) -> str:
LOWsrc/ggml-virtgpu/regenerate_remoting.py125 def generate_apir_backend_header(self) -> str:
LOWsrc/ggml-virtgpu/regenerate_remoting.py176 def generate_backend_dispatched_header(self) -> str:
LOWsrc/ggml-virtgpu/regenerate_remoting.py222 def generate_virtgpu_forward_header(self) -> str:
Excessive Try-Catch Wrapping6 hits · 8 pts
SeverityFileLineSnippet
MEDIUMexamples/mnist/server.py35 print(f"Error: {e}")
LOWexamples/python/example_test_all_quants.py65 except Exception as e:
MEDIUMexamples/python/example_test_all_quants.py66 print(f'Error: {e}')
LOWsrc/ggml-virtgpu/regenerate_remoting.py69 except Exception as e:
LOWsrc/ggml-virtgpu/regenerate_remoting.py327 except Exception as e:
MEDIUMsrc/ggml-virtgpu/regenerate_remoting.py323def main():
Example Usage Blocks4 hits · 6 pts
SeverityFileLineSnippet
LOWscripts/sync-whisper-am.sh5# Usage:
LOWscripts/release.sh8# Usage:
LOWscripts/sync-llama-am.sh5# Usage:
LOWsrc/ggml-sycl/dpct/helper.hpp3012 /// Example usage:
Redundant / Tautological Comments2 hits · 4 pts
SeverityFileLineSnippet
LOWscripts/release.sh124 # Check if we have the latest from master (skip in dry-run)
LOWsrc/ggml-virtgpu/regenerate_remoting.py46 # Check if clang-format is available
Self-Referential Comments1 hit · 3 pts
SeverityFileLineSnippet
MEDIUMci/run.sh367 # Create a fresh python3 venv and enter it
Unused Imports3 hits · 3 pts
SeverityFileLineSnippet
LOWexamples/python/stubs.py7
LOWexamples/gpt-2/convert-cerebras-to-ggml.py9
LOWexamples/gpt-j/convert-h5-to-ggml.py23
Deep Nesting2 hits · 2 pts
SeverityFileLineSnippet
LOWexamples/python/ggml/utils.py118
LOWsrc/ggml-webgpu/wgsl-shaders/embed_wgsl.py68