Repository navigation
refactor(simd): bring the integer motion SIMD kernels to the lint and HISS standard (ADR-1142) - #1868
Merged
Merged
Conversation
… HISS standard (ADR-1142) (#1868) * refactor(simd): bring the integer motion SIMD kernels to the lint and HISS standard (ADR-1142) core/src/feature/x86/motion_avx2.c, motion_avx512.c and core/src/feature/arm64/motion_neon.c had 7, 18 and 2 clang-tidy findings and ten functions over 60 lines, which is why the SPDX backfill (#1739) could not touch them. Each motion_score_pipeline_{8,16}_* keeps its name and signature and is a row loop over inlined stages: the vertical pass of one row (y_conv_row_{8,16}_*), which reports whether the row is non-zero, and the horizontal pass (x_conv_row_sad_*), each with one vector block helper and one scalar helper for the columns the vector loop cannot reach. The three test-only convolution kernels of motion_avx512.c share two filter helpers; x_convolution_16_neon is three passes over two helpers. Each file includes its own header. All arithmetic is integer and every statement moved whole. Verified: master's and the new objects in one process, 286 952 comparisons on generated input with GCC, clang and icx, 0 mismatches (NEON: 3 920 under qemu). motion, motion_v2, float_motion and the default model at --precision max: 105 of 105 cases identical on x86-64 under scalar, AVX2 and AVX-512 dispatch, 48 of 48 on aarch64 under scalar and NEON. Netflix golden gate on x86-64 GCC: 271 passed, 12 skipped. Fast suite: 244 of 244. clang-tidy 0 in every lane that reads the files (lane totals: cpu 310 to 285, cuda 662 to 637, hip 664 to 639, sycl 766 to 741, arm64 558 to 556). HISS baseline 242 to 232. The three files carry SPDX-License-Identifier: BSD-2-Clause-Patent (ADR-1250: upstream paths).
lusoris
force-pushed
the
refactor/std-motion-simd
branch
from
October 2, 2026 17:14
f5e310f to
b801f28
Compare
This was referenced Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First of four PRs for the 16 files that still had no
SPDX-License-Identifierline because they carried baselined debt. This one covers the integer motion SIMD kernels:core/src/feature/x86/motion_avx2.c,core/src/feature/x86/motion_avx512.candcore/src/feature/arm64/motion_neon.care at the lint and HISS standard, carry their SPDX line, and no bit of any score moves.x86/motion_avx2.c, clang-tidyx86/motion_avx512.c, clang-tidyarm64/motion_neon.c, clang-tidyscripts/ci/tidy-baseline-<lane>.jsonHISS: ten rows gone (three in
motion_avx2.c, six inmotion_avx512.c, one inmotion_neon.c, all "function over 60 lines");.standards-baseline.json242 → 232, recorded withpraetorctl baseline --record; the README count follows. UncitedNOLINTs: 0, and the three files have noNOLINTat all.SPDX:
BSD-2-Clause-Patenton all three.scripts/dev/relicense_fork_files.py --listclassifies themupstream-path(the files exist in Netflix/vmaf), so they keep Netflix's terms (ADR-1250).What changed
Each
motion_score_pipeline_{8,16}_*keeps its name and signature and is a row loop:y_rowvalue is non-zeroy_conv_row_{8,16}_avx2overy_conv16_8_avx2/y_conv8_16_avx2y_conv_row_{8,16}_avx512overy_conv32_8_avx512/y_conv16_16_avx512x_conv_row_sad_avx2overx_conv_abs8_avx2,x_conv_abs_scalar,hsum_epi32_avx2x_conv_row_sad_avx512overx_conv_abs16_avx512,x_conv_abs_scalarThe three test-only kernels of
motion_avx512.c(y_convolution_8_avx512,y_convolution_16_avx512,x_convolution_16_avx512) sharefilter5_epu32_avx512()andfilter5_scalar(), andx_convolution_16_neonis three passes over two helpers.sad_avx512is untouched.Every statement that computes moved whole: the widths of the accumulators, the order of the widening additions, the rounding constants, the logical
_mm256_srlv_epi64of the AVX2 16-bit path and the arithmetic_mm512_srav_epi64of the AVX-512 one are as they were. All arithmetic in these files is integer.The findings, by check:
readability-function-sizemisc-use-internal-linkagereadability-isolate-declarationreadability-braces-around-statementsy_convolution_8_avx512is one braced helperNot one bit moves
Kernels, old against new in one process. Master's and this PR's objects linked into one harness under different names, compared on generated input (noise, extremes, flat, near-equal pictures; widths 3 to 140 and 576, 1919, 1920, 3840; 8, 10, 12 and 16 bit; the returned SAD and the whole
y_rowscratch; the destination buffers of the three convolution kernels including their padding): 286 952 comparisons, 0 mismatches, with GCC 16, clang 22 and icx 2026.0.x_convolution_16_neonunder qemu-aarch64: 3 920 comparisons, 0 mismatches, with aarch64 GCC and clang.Scores.
motion,motion=debug=true,motion_v2,float_motionand the default model at--precision max, this PR against master513d2a6fc:Netflix golden gate. x86-64 GCC: 271 passed, 12 skipped. aarch64 GCC under qemu: 271 passed, 12 skipped (86 minutes; the aarch64 binary was built from this PR's sources on
25fe95d73, one rebase before the pushed head, so master's two later aarch64 changes, refactor(feature): bring the NEON float ADM kernels to the lint and HISS standard (ADR-1142) #1865 and the NEONpsnr_hvsfix, are not in that binary).x_convolution_16_neon, the one aarch64 function this PR changes, is called bycore/test/test_motion_neon.conly; no extractor reaches it.Unit tests.
--suite=faston the CPU build: 244 of 244 (includestest_motion_avx512_parity,test_motion_v2_simd,test_integer_motion_coverage). Under qemu:test_motion_neonandtest_motion_pipeline_neonpass.Speed. The helpers are
static inlineand the two AVX2 pipelines are the only symbols of their object file, as before. One process, 1920x1080, minimum of 300 calls, old then new, load 56 on the host:pipeline_8_avx2pipeline_16_avx2(10 bit)pipeline_8_avx512pipeline_16_avx512(10 bit)Between 0.92x and 1.07x with no direction; not a timing claim on a host this loaded.
GPU twins. No header changes;
feature/integer_motion.his untouched, so the CUDA, HIP and SYCL motion twins compile the same text.scripts/dev/preflight.sh --stage msvcism: pass.Lane notes
sycllane: on master the two x86 files cannot be measured there at all (T-SYCL-TIDY-OVERRIDING-OPTION-2026-10-02, fixed by fix(ci): silence clang's fp-override driver note so the SYCL tidy lane measures the x86 SIMD units #1867). The numbers above were taken with that fix's flag (-Wno-overriding-option) passed to clang-tidy.misc-static-asserton glibc 2.44): none in these three files.aarch64-linux-gnuforarm64); nothing was left unmeasured.Type
feat— new featurefix— bug fixperf— performance improvementrefactor— no behavior changedocs— documentation onlytest— test-onlybuild/ci— tooling / infraport— cherry-pick from upstream Netflix/vmafsycl/cuda/simd— backend-specificChecklist
make format && make lintis green locally. (clang-format and the commit hooks; clang-tidy 0 for the three files in every lane that reads them.)python3 scripts/ci/run_meson_test.py -- -C build. (--suite=faston a CPU build: 244 of 244.)/cross-backend-diffand the worst ULP is ≤ 2. (Bit-identical: old and new kernels compared directly, and scores under every dispatch.).c/.cpp/.cu/.h/.hpp, it has the appropriate license header (seeCONTRIBUTING.md). (None added; the SPDX line of the three files added.)!orBREAKING CHANGE:and the migration path is documented below. (Not breaking.)docs/adr/_index_fragments/<NNNN-slug>.md. (No ADR: ADR-1142 is the rule.)Bug-status hygiene (ADR-0165)
docs/state.mdupdated in this PR. no state delta: refactor to the lint and HISS standard; no row names these files' debt.Netflix golden-data gate (ADR-0024)
assertAlmostEqual(...)score in the Netflix golden Python tests.Deep-dive deliverables (ADR-0108)
AGENTS.mdinvariant note —core/src/feature/x86/AGENTS.d/motion.md, "Pipelines are row loops over inlined stages".changelog.d/changed/std-motion-simd.md.docs/rebase-notes.md, "Integer motion SIMD kernels split into stages".Reproducer
Known follow-ups
compat/python-vmaf/__init__.py, one PR each.