Repository navigation
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
cpegeric
left a comment
There was a problem hiding this comment.
I will handle this bug.
74b6b42 to
f64ee24
Compare
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
What type of PR is this?
Which issue(s) this PR fixes:
issue #29183
What this PR does / why we need it:
Fixes #29183, an IVFFLAT 10M-row CREATE INDEX performance regression introduced after #29143.
Root cause
#29143 correctly widened float32 brute-force results to float64 to preserve #29083 extreme-value correctness. However, normal float32 L2 distances were then routed through
StableL2DistanceSq, whose per-call scale/NaN/Inf scan became the dominant CPU cost during IVFFLAT centroid assignment. The #29183 profile shows this exact path.Fix and behavior
Keep float64 accumulation and ordering, but use a dedicated finite float32 -> float64 squared-L2 kernel that converts operands before subtraction and accumulates in one pass with no allocations. For non-finite input or an unexpected non-finite accumulator, it falls back to
StableL2DistanceSqto preserve existing NaN/Inf semantics. The fast path is used for both L2 metric enum variants in the wide float32 resolver; unrelated metrics and narrow-result paths are unchanged.Regression coverage includes extreme values, subnormals, precision/order preservation, NaN/Inf semantics, dimension mismatch, resolver dispatch, and both
SearchandSearchFloat32brute-force consumers.Validation
GOWORK=off go test -mod=readonly ... ./pkg/vectorindex/metric— passed.GOWORK=off go test -mod=readonly ... ./pkg/vectorindex/brute_force— passed.GOWORK=off go vet -mod=readonly ... ./pkg/vectorindex/metric ./pkg/vectorindex/brute_force— passed.The local repository CGo wrapper could not build a fresh native dependency set because the ONNX Runtime download timed out. The package tests above used the generated third-party headers/libs and a previously built compatible native
libmo; the resulting linker duplicate-library/rpath warnings were non-fatal. A 10M-row TKE run remains required to verify end-to-end CREATE INDEX wall time and ISCP timeout behavior in the target deployment environment. At PR creation, CI preflight and coverage eligibility passed; Linux build/UT/SCA/coverage and Mergify checks were still queued or running.Compatibility and performance risk
The change is isolated to wide float32 L2 distance dispatch and preserves a stable fallback for non-finite inputs. The new helper is build-tag independent and allocation-free; amd64/SIMD and target-cluster validation are covered by CI/TKE rather than the local Apple arm64 host.
Final head:
74b6b420ac5693e589da8e356753300e4fe488bc.