Skip to content

IVF-Flat: fix irrelevant assert in the fused kernel mode#1890

Open
achirkin wants to merge 3 commits intomainfrom
fix-ivf-flat-irrelevant-assert
Open

IVF-Flat: fix irrelevant assert in the fused kernel mode#1890
achirkin wants to merge 3 commits intomainfrom
fix-ivf-flat-irrelevant-assert

Conversation

@achirkin
Copy link
Contributor

@achirkin achirkin commented Mar 6, 2026

Variable max_samples inside the interleaved_scan_kernel is only used in the non-fused codepath and tells how many distances to compute. It's not set in the fused-kernel mode, yet checked by an assert, causing assertion failures incorrectly. This PR fixes the problem by guarding the assert using a constexpr condition on the fused/unfused mode.

Variable `max_samples` inside the `interleaved_scan_kernel` is only used in the non-fused codepath and tells how many distances to compute. It's not set in the fused-kernel mode, yet checked by an `assert`, causing assertion failures incorrectly.
This PR fixes the problem by guarding the assert using a constexpr condition on the fused/unfused mode.
@achirkin achirkin self-assigned this Mar 6, 2026
@achirkin achirkin added bug Something isn't working non-breaking Introduces a non-breaking change labels Mar 6, 2026
@achirkin achirkin requested a review from a team as a code owner March 6, 2026 07:49
Copy link
Contributor

@tfeher tfeher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@divyegala divyegala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are maintaining 2 versions of the kernel temporarily due to JIT LTO, can you please mirror the changes in the JIT version of this kernel?

assert(sample_offset + list_length <= max_samples);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change

Projects

Development

Successfully merging this pull request may close these issues.

3 participants