Skip to main content

Validate and measure Preproc

Use the existing correctness and device fixtures to check Preproc. Host models verify contracts and the source arithmetic; only a matching EV74 firmware run exercises device instructions and physical DMA. Performance qualification also requires a matching baseline and controlled measurement conditions.

See the operation contract, numerical order and memory and execution when diagnosing a failure.

Correctness and latency fixtures​

EV74/preproc/tests/correctness.cpp covers metadata/codec/native-entry rejection, independent reference goldens and at least 300 distinct source geometries across formats/modes/dtypes/ranks, NV16 odd heights and ROI phase, worker caps 1–4, required padding and dirty output reuse. Production-output comparisons, guards and dirty-reuse checks require the Clang/OpenCL host model; without it, the catalogue exercises metadata, codec and mocked native dispatch, not EV arithmetic. The shared named catalogue adds all 240 combinations of six input formats, five interpolation modes and eight output profiles (four dense, two compact MLA and two PadTo16 MLA), plus bounded integer/fractional-ratio, odd-chroma-phase, Gray expansion, tile/tail, canvas, regular-row eligibility and multi-axis batch overlays. Unsupported combinations are never counted as successful route coverage.

When Clang is available, the suite includes the actual OpenCL source under immediate/deferred checked DMA models. Host models do not qualify EV instructions or real DMA scheduling. The model checks pitched-copy holes, deferred slot reuse, exact plane bounds and exclusive 16-byte output ownership across workers. A separate local-writer check covers pixel counts 1–16, all legal storage/channel orders, every fragment start byte and legal fragment length, padding repetitions and untouched guard bytes. Band-writer checks independently reconstruct physical bytes for tile widths, band heights, row positions, cross-tile starts and masked tails. Source-DMA count checks verify cache effectiveness, not merely correct output: the Gray33×5 compact tile5×1 case needs five row loads with one worker. Additional cases cover full eviction, pinning a later-needed row, batch invalidation, repeated border taps and unused-row elimination. Counts are host-model evidence, not a claim that a particular target latency has been achieved.

specialization_cases.h is shared by the existing host and device correctness executables. It adds eligible and fallback neighbors, full-vector/odd tails, maximum source width, oversized tile pitches, RGB/BGR permutations, both YUV matrices and all ROI chroma phases, batch/rank-six cases, asymmetric affine parameters and quantization extremes. The host fixture dispatches the actual selected OpenCL implementation and checks completed-DMA bounds for dense and pitched loads/gathers as well as byte gathers. These checks supplement, not replace, full-catalogue device latency comparison and worker-cap validation.

Real-device correctness and latency use the standalone fixture, with installed Kernels and Runtime packages. Configure on the development host using the A65 cross toolchain, then run the resulting binary through the architecture-safe DevKit launcher:

cmake -S EV74/preproc/tests/e2e -B build/preproc-e2e \
-DCMAKE_TOOLCHAIN_FILE="$PWD/cmake/toolchains/a65-linux.cmake" \
-DSimaKernels_DIR=/path/to/kernels/lib/cmake/SimaKernels \
-DSimaRuntime_DIR=/path/to/runtime/lib/cmake/SimaRuntime
cmake --build build/preproc-e2e

Follow build and test for architecture-safe execution. The default invocation runs correctness, the 33 standard latency anchors, then 24 camera-scale cases from tests/camera_cases.h. The camera panel preserves a compiler-authored BGR 544×306 → RGB INT8 640×640 letterbox with compact MLA tiles H=640, W=32, C=3, plus distinct topology neighbors. It also measures dense and PadTo16 storage, fractional bicubic and identity sampling, shared NV12 planes, independently pitched I420 planes, an odd-origin NV16 ROI, partial tiles and BF16 output. These are batch-one examples, not exhaustive coverage of every admitted shape, batch, ROI list or physical output size.

--probe-only, --smoke-only, --correctness-only and --latency-only select narrower checks. --latency-only retains the 33 standard anchors; --extended-latency-only retains the 509-case extended catalogue: those anchors plus the shared route/optimization cases. Both perform smoke and per-case correctness checks. --list-cases lists those catalogues without connecting to a device.

--camera-latency-only runs smoke checks and the 24 camera cases through the same public submit/wait and independent byte-verification path. Each case uses 10 warmups and 100 individual samples. Each median must be strictly below its case's CI acceptance limit in tests/camera_cases.h. The default is 1000 µs, with these explicit limits for slower families:

Camera caseMedian limit (µs)
BGR stretch compact H160, H320 and H6401400
BGR stretch Pad16 INT81100
BGR fractional bicubic compact2900
NV12 2× compact, shared planes1200
NV16 odd-ROI compact1450
BGR partial compact 6391250

These are acceptance budgets, not speed improvements or a universal submillisecond guarantee. p95 and maximum are diagnostic, not failure criteria. Both this mode and default invocation finish the camera panel and return exit code 2 if any median misses the target. A correctness failure returns exit code 1. There is no early stop merely because a camera case is slow.

--camera-measurements-only explicitly disables only that absolute-target exit status for investigations: it still verifies output and reports every target miss. --list-camera-latency lists stable camera IDs and descriptors without connecting to a device. ABSOLUTE_TARGET records and the panel summary separate absolute performance from correctness. They always retain qualified=false: meeting the absolute target does not establish matched-baseline regression qualification, a worst-case bound or end-to-end application throughput.

--fractional-cubic-only separately measures 18 camera-sized bicubic cases with noninteger or mixed integer/noninteger scale ratios, RGB/NV12/NV16 input, and dense/padded BF16 output. --list-fractional-cubic lists this supplemental panel without a device connection. It is separate from the 509-case extended catalogue, and requires its own matching baseline/candidate evidence. The default correctness suite also includes cache and band-route cases with aligned output offsets around page boundaries.

A matching explicitly composed native firmware is required; building a host codec does not install it. Device firmware changes require authorization and restoration checks.

Latency measures the checked public submit/wait path with correctness outside timing. It reports chronological samples, percentiles and process-wide CPU time; CPU accounting includes the fixture's timed-loop bookkeeping and is not whole-system interrupt/driver accounting. Every latency row includes a complete semantic descriptor with exact floating-point coefficient bits, effective ROI/destination, shape, batch, layout and binding offsets. Its FNV-1a hash is a stable comparison key, not a cryptographic attestation. Physical addresses, FDs and allocation identities are excluded; compiler, firmware, Runtime, worker cap and clock provenance must be captured separately by the qualification runner. Compare only matching workloads under matched conditions, retaining all raw chronology and repeated paired cohorts. Supplemental panels are separate from the standard 33 anchors and 509-case extended catalogue. Pitched camera measurements also record the effective byte-stride vectors. Seeded family cold lists and measured logs record the same shared/pitched-plane profile, minimum source pitch and input/output byte phases. Measured profile sidecars are emitted after timing, never inside an invocation.

Timed calls reuse output without re-dirtying it; separate correctness cases verify dirty reuse. New measurements without a reviewed matching baseline are measurement-only. The existing median-only regression policy applies; non-median statistics remain diagnostic. Do not claim an A65 kernel benchmark or complete target qualification from the host reference.