Skip to content

[stream-3] PR #5b — bindgen + SailMatmul real-device + ggml-spanker review nits #7

@marcos-mendez

Description

@marcos-mendez

Context

PR #5 (feat(ggml): ggml-spanker crate with MatmulInt4 trait + MockSail) merged 2026-05-06 with deferred review findings. This issue tracks all five plus the originally-planned PR #5b scope (bindgen + real-device SailMatmul).

Items to address in PR #5b

From Agent R review of PR #5

# Severity File:Line Action
1 HIGH src/backends/ggml/src/lib.rs:49 Add #[non_exhaustive] to Error enum before PR #6 anchors on it (semver protection for the v0 contract).
2 HIGH src/backends/ggml/src/lib.rs:58, mock.rs:95-130 Either implement the OutputTooSmall check (out.len() < expected) or remove the variant. Fix surface is the same as Finding #4.
3 MEDIUM .gitmodules:4 Drop branch = master line (or replace with branch = <stable tag>). The committed SHA is the reproducible anchor; branch = master only matters for --remote updates and undercuts reproducibility.
4 MEDIUM src/backends/ggml/src/mock.rs:95 (matmul_q4_k) Cross-check a.len(), b.len(), and out.len() against declared m × (k/QK_K) × Q4_K_BLOCK_BYTES. Same code site as Finding #2.
5 LOW src/backends/ggml/src/lib.rs:111-118 Replace q4_k_block_bytes_constant_matches_known_layout (currently tautological) with a bindgen-derived cross-check against the actual GGML header. Not a supplement — a replacement.

Originally-planned PR #5b scope (per PR #5's body)

  • bindgen at whatever version reconciles with then-current MSRV
  • src/backends/ggml/build.rs invoking bindgen over wrapper.h
  • private mod ffi { include!("bindings.rs") } in lib.rs
  • real-device SailMatmul body using SPANKER_IOC_WORK_SUBMIT
  • CI: submodules: recursive + libclang-dev

Test coverage gaps to close

  • m=0 / n=0 with valid k should be either explicitly accepted (and tested as a no-op) or rejected with BadDims
  • OutputTooSmall triggered by undersized out slice
  • Mismatched-dim slice lengths trigger BadDims
  • SailMatmul::matmul_q4_k returns NotImplemented (assertion test for the deferred-stub state)

Dependencies

Owner

Agent 3 (Software Stack).

Branch suggestion

feat/stream-3/pr-05b-bindgen-and-real-device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    stream-3Software Stack (Agent 3) — driver, runtime, GGML, Spanker

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions