Repository navigation
Speed up AVX2 inference with exact batched quantization and channel-major pointwise kernels - #22
Open
varyagnord wants to merge 4 commits into
Open
varyagnord wants to merge 4 commits into
varyagnord wants to merge 4 commits into
Conversation
Quantize eight frequency positions directly and transpose outputs in registers, avoiding sixteen full float transposes per graph. Preserve exact arithmetic, AVX2/FMA requirements, original fallback paths, weights and state ABI. Add guarded FP-mode and all-mask regression coverage, and preserve the paired measurement records for the precision repeats and rejected optimization trials.
Compare the pre-i7 baseline with the final runtime in 288 paired blocks per model and power condition. Preserve SD, SE, adjusted intervals, A/A discrepancies, raw block observations and isolation verification.
Collaborator
|
@varyagnord there are too many changes ~24K, can you make sure you didn't include unnecessary generated files? (this is also true for #23 which contains ~121K(!) additional lines...) |
Keep the validation summary and link to the preserved reports at the original branch revision. Runtime and test sources are unchanged. Verified with a Release build and CTest.
Author
|
Thanks for pointing this out. I removed the generated benchmark JSON from the review diffs for both #22 and #23. That brings #22 down from 24,064 to 505 added lines and #23 from 121,308 to 3,242. The docs link to the original reports at pinned revisions, and both Release builds and CTest suites passed. #25 is available for independent review as the standalone model-8 AVX-VNNI change. |
This branch has not been deployed
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.
AVX2 W7A8 inference currently computes K64 quantization parameters row by row and materializes channel-major/row-major float conversions around eight pointwise projections. This batches exact quantization parameters across four rows and adds a direct channel-major K64×N64 path, removing sixteen full float transposes per graph while preserving outputs and complete recurrent state bitwise.
This targets
optimized-inference, on top of merged #21 (98df765). The implementation commits are26c7a9candcf16ba6;41d0aa8adds the direct cumulative measurement record.Implementation
Incremental measurements for the changes in this PR
Intel Core i7-7700T, GCC 14.2 with independently fresh model-8 PGO, performance governor/EPP and continuous neural calls. Each study uses 36 randomized mirrored ABBA/BAAB blocks, two fresh processes per version/block and 120 warmup hops/process.
98df765→26c7a9c26c7a9c→cf16ba6Intervals are multiplicity-adjusted: family four / 98.75% for quantization and family eight / 99.375% for CM. These are separate studies and their percentages must not be added or multiplied to claim a directly measured PR-only total. The quantization confirmation was separately fixed after its initial screens; all discovery/confirmation records remain available.
Original-power/10 ms results are reported separately. The larger 288-block model-8 quantization repeat remains inconclusive at +0.463% (95% interval [-0.345, +1.264]%). The separate 288-block CM repeat also remains inconclusive at +0.793% (adjusted interval [-0.453, +2.023]%).
Direct cumulative measurement, including already-merged #21
A new fixed-count study directly compares
afa8292(before #21 and these two optimizations) withcf16ba6. This table therefore describes the complete three-stage i7 result, including #21; it is not the incremental effect of this PR alone. The baseline already contains the earlier native W7A8 runtime and optional VNNI, rather than the original PyTorch FP32 model.Each model/condition has 288 blocks, 576 runs/version, six equally weighted recorded inputs, balanced orders within each input and randomized interleaving of models. Continuous runs use 600 timed hops, original-power paced runs 250; both have 120 warmup hops. Including the independent A/A controls, the new campaign contains 4,992 processes / 2,121,600 timed calls. No slow observations are discarded, no historical data are pooled, and collection does not stop on a favorable effect.
The inferential unit is the complete four-process block. Primary estimates use equally input-weighted paired log ratios, within-input variances and Welch–Satterthwaite t intervals. Bonferroni covers the four aggregate contrasts. Time reduction and throughput increase transform the same ratio; the arithmetic run means above are descriptive. Independent standard-library reconstruction matches the reported means, SD, SE and degrees of freedom. Stratified whole-block bootstrap, HAC lag 3 and chronological residual-block bootstrap lengths 4/8 support the same main conclusions. Original-power model 8 has no confirmed mean improvement.
The original-power model-8 A/A control has an apparent +2.996% effect and a t interval excluding zero; its prespecified conditional randomization test does not pass the corrected threshold (raw p=0.02723, adjusted p=0.10892). That discrepancy, including the post-plan sensitivity audit of all four A/A controls, is preserved explicitly. It was not subtracted as a fixed bias correction, and the collection/gating rules were unchanged.
Validation and scope
d52b21267579dc3a75c22c35dc13a3d55bb3e68ddc1300ec568110c45f26c80a, byte-identical to the measured CM implementation. Both cumulative-study builds receive one byte-identical measurement driver and identical weights/inputs.The performance summary describes the methods and results. The archived validation reports preserve the generated JSON and paired block observations at the original revision.
Verified CI for published head
41d0aa8f94fbd725f11b24a9b7482c17979d50e6All five jobs passed in the upstream PR workflow and all five passed independently in the fork push workflow. All ten complete job logs were inspected and retained locally. Both workflows used GCC 11.4.0 on Ubuntu 22.04; performance figures above remain scoped to GCC 14.2.
The six direct VNNI contracts executed and passed in both upstream static-PGO phases and in the upstream sanitizer job. They explicitly skipped on runners without the required instruction. Both CM contracts and the four-row quantization oracle passed in every applicable configuration. There were no test failures, sanitizer diagnostics or PGO linkage failures. CI validates correctness and build portability; it does not supply VNNI speed measurements.