Skip to content

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

Closed
achirkin wants to merge 0 commit intorelease/26.04from
fix-ivf-flat-irrelevant-assert
Closed

IVF-Flat: fix irrelevant assert in the fused kernel mode#1890
achirkin wants to merge 0 commit intorelease/26.04from
fix-ivf-flat-irrelevant-assert

Conversation

@achirkin
Copy link
Copy Markdown
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.

@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
Copy Markdown
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
Copy Markdown
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);

Ludu-nuvai added a commit to Nuvai/cuvs that referenced this pull request Mar 23, 2026
Cherry-picked from upstream PR rapidsai#1890.
Removes incorrect assertion that triggered crashes in valid
IVF-Flat fused kernel use cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@achirkin achirkin requested a review from divyegala March 24, 2026 08:09
@achirkin achirkin changed the base branch from main to release/26.04 March 24, 2026 08:10
@achirkin achirkin requested review from a team as code owners March 24, 2026 08:10
@achirkin achirkin requested a review from AyodeAwe March 24, 2026 08:10
@achirkin achirkin changed the base branch from release/26.04 to main March 24, 2026 08:11
@achirkin achirkin removed request for a team and AyodeAwe March 24, 2026 08:12
@achirkin achirkin changed the base branch from main to release/26.04 March 24, 2026 10:33
@achirkin achirkin closed this Mar 24, 2026
@achirkin achirkin force-pushed the fix-ivf-flat-irrelevant-assert branch from f414d39 to 0545fa2 Compare March 24, 2026 10:34
rapids-bot bot pushed a commit that referenced this pull request Mar 24, 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.
This PR is open to fix incorrectly closed and already reviewed PR #1890

Authors:
  - Artem M. Chirkin (https://github.com/achirkin)

Approvers:
  - Tamas Bela Feher (https://github.com/tfeher)

URL: #1941
jrbourbeau pushed a commit to jrbourbeau/cuvs that referenced this pull request Mar 25, 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.
This PR is open to fix incorrectly closed and already reviewed PR rapidsai#1890

Authors:
  - Artem M. Chirkin (https://github.com/achirkin)

Approvers:
  - Tamas Bela Feher (https://github.com/tfeher)

URL: rapidsai#1941
jrbourbeau pushed a commit to jrbourbeau/cuvs that referenced this pull request Mar 25, 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.
This PR is open to fix incorrectly closed and already reviewed PR rapidsai#1890

Authors:
  - Artem M. Chirkin (https://github.com/achirkin)

Approvers:
  - Tamas Bela Feher (https://github.com/tfeher)

URL: rapidsai#1941
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

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants