Skip to content

fix(dnn): preserve explicit int8 paths in session open - #2203

Merged
lusoris merged 3 commits into
masterfrom
fix/dnn-session-int8-explicit-path
Oct 5, 2026
Merged

lusoris merged 3 commits into
masterfrom
fix/dnn-session-int8-explicit-path

Conversation

@lusoris

@lusoris lusoris commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

When vmaf_dnn_session_open() was called with an explicit .int8.onnx path, resolve_load_path() lacked the kInt8Suffix early return present in dnn_attach_api.c, causing it to append a redundant .int8 suffix and derive <name>.int8.int8.onnx before falling back to the fp32 path.

Preserve explicit int8 paths directly by returning 0 when the onnx_path already ends in kInt8Suffix, matching the behavior in dnn_attach_api.c.

Evidence

  • core/test/dnn/test_dnn_session_api.c: test_session_open_explicit_int8_path_preserves_path verifies explicit path preservation (failed on master: loaded model.int8.int8.onnx instead of explicit model); test_session_open_int8_invalid_falls_back_to_fp32 passes (40 of 40 pass).
  • core/test/dnn/test_vmaf_use_tiny_model.c: test_use_tiny_model_int8_invalid_falls_back_to_fp32 passes (25 of 25 pass).
  • core/test/dnn/test_cli.sh: section 5c CLI tests pass.
  • fast suite: 347 of 347 passed.
  • tidy: cpu core/src/dnn/dnn_api.c core/test/dnn/test_dnn_session_api.c core/test/dnn/test_vmaf_use_tiny_model.c 0 findings.
  • MSVC static checks: pass.

Closes T-DNN-SESSION-INT8-EXPLICIT-PATH-2026-10-05.

Deep-dive deliverables (ADR-0108)

  • Research digest — no digest needed: bug fix, resolve_load_path mirrors dnn_attach_api.c
  • Decision matrix — no alternatives needed: bug fix, preserves explicit int8 paths
  • AGENTS.md invariant note — core/src/dnn/AGENTS.d/int8-quantization-and-scaling.md
  • Reproducer / smoke-test command — build/test/dnn/test_dnn_session_api
  • CHANGELOG fragment — changelog.d/fixed/dnn-session-int8-explicit-path.md
  • Rebase note — docs/rebase-notes.md

…ing a frame twice (#2206)

* fix(model): read a model collection's stored score instead of predicting a frame twice

vmaf_score_at_index_model_collection() predicted every member model and
wrote the members' and the four named bootstrap scores of the frame into
the feature collector, which refuses a second write of a frame. A second
per-frame call of a frame, or vmaf_score_pooled_model_collection() over a
range holding a frame already scored per frame (its loop predicts every
frame of the range again), therefore failed with -EINVAL ("feature ...
cannot be overwritten"). No score was wrong; the call failed.

A frame whose four named bootstrap scores are already in the collector
now returns them, as vmaf_score_at_index() reads a single model's stored
score first. The values are the first prediction's, bit for bit, so a
pooled score equals a fresh session's. Upstream Netflix/vmaf has the same
code.

test_model_collection_score_repeat fails on master without the fix: the
second per-frame call and the pooled call after a per-frame call both
return -EINVAL. Golden gate 280 passed, 3 skipped.
…t index of vif_tools.c (#2204)

* fix(feature): refuse a float_vif or SpEED prescaled plane past the int index of vif_tools.c

vif_tools.c indexes a plane as y * stride + x in int. With vif_prescale or
speed_prescale above about 1.414 at the 32768x32768 picture cap the
prescaled plane passes INT_MAX samples, the index overflows and the
resamplers write outside the plane (16K stays inside at every accepted
prescale, up to 4.0). vif_plane_fits_int_index() in vif_tools.h is now
checked by float_vif's init (init_scaled_plane()), speed.c's
speed_init_dimensions() and speed_internal_init_dimensions(), the geometry
of every SpEED device twin; such a plane fails init with -EINVAL before any
allocation. No accepted input and no score changes.

T-PRESCALED-PLANE-INT-INDEX-2026-10-05. Found by the RC3 accumulator audit.
test_prescaled_plane_int_index fails on master's SpEED geometry.
* fix(dnn): preserve explicit int8 paths in session open

When vmaf_dnn_session_open() was called with an explicit .int8.onnx path,
resolve_load_path() lacked the kInt8Suffix early return present in
dnn_attach_api.c, causing it to append a redundant .int8 suffix and
derive <name>.int8.int8.onnx before falling back to the fp32 path.

Preserve explicit int8 paths directly by returning 0 when the onnx_path
already ends in kInt8Suffix, matching the behavior in dnn_attach_api.c.

Closes T-DNN-SESSION-INT8-EXPLICIT-PATH-2026-10-05.
@lusoris
lusoris force-pushed the fix/dnn-session-int8-explicit-path branch from f49f17e to 0f7b2dd Compare October 5, 2026 23:12
@lusoris
lusoris merged commit 0f7b2dd into master Oct 5, 2026
5 of 79 checks passed
@lusoris
lusoris deleted the fix/dnn-session-int8-explicit-path branch October 5, 2026 23:12
@github-actions github-actions Bot added the type:bug Something isn't working label Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants