ggml_test_backend_ops: Compare Backend Operations Against the CPU

View source: R/backend_ops_test.R

ggml_test_backend_opsR Documentation

Compare Backend Operations Against the CPU

Description

Runs each supported operation on backend and on the CPU with identical inputs, and reports the normalized mean squared error between the two. This is the differential test used to find operations whose accelerated implementation disagrees with the reference one.

Usage

ggml_test_backend_ops(backend, filter = NULL)

Arguments

backend

Backend pointer, e.g. from ggml_vulkan_init(0). Compared against a freshly created CPU backend.

filter

Optional substring; only operations whose name contains it are run. NULL (default) runs all of them.

Details

Each case is executed three times against the same allocated graph and the final run is the one compared, so faults that only appear when a graph is re-executed are visible. That matters: both backend defects found in this package so far were of that kind – the first run was exact and later ones were not.

Value

A data frame with columns op, nmse and note. nmse is NA when the case could not be run, and note then says why.

Examples


if (ggml_vulkan_available()) {
  be <- ggml_vulkan_init(0)
  res <- ggml_test_backend_ops(be)
  res[res$nmse > 1e-6, ]        # operations that disagree
  ggml_backend_free(be)
}


ggmlR documentation built on Oct. 23, 2026, 1:07 a.m.