Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Add invariant to GpuIndex #2006

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tmontaigu
Copy link
Contributor

This commit does 2 things:

  • It adds to GpuIndex the invariant that the index corresponds to a valid GPU, to do so, the inner u32 is made private and new/try_new method are now used to construct a GpuIndex these methods checks that the index is valid
  • It makes GpuIndex transparent, allowing to safely cast a *const GpuIndex to *const u32, this is to save same copies made to transform Vec to Vec that was used to get a *const u32

BREAKING CHANGES: GpuIndex(some_value) is no longer valid and GpuIndex::new(some_value) / GpuIndex::try_new(some_value) has to be used

@cla-bot cla-bot bot added the cla-signed label Jan 27, 2025
@tmontaigu tmontaigu force-pushed the tm/gpu-index-invariant branch 4 times, most recently from 2481ee9 to b89393d Compare January 29, 2025 13:57
This commit does 2 things:

* It adds to GpuIndex the invariant that the index corresponds
  to a valid GPU, to do so, the inner u32 is made private
  and new/try_new method are now used to construct a GpuIndex
  these methods checks that the index is valid
* It makes GpuIndex transparent, allowing to safely cast a *const
  GpuIndex to *const u32, this is to save same copies made to transform
  Vec<GpuIndex> to Vec<u32> that was used to get a *const u32

BREAKING CHANGES: GpuIndex(some_value) is no longer valid and
GpuIndex::new(some_value) / GpuIndex::try_new(some_value) has to be
used
@tmontaigu tmontaigu force-pushed the tm/gpu-index-invariant branch from b89393d to 54adb40 Compare January 30, 2025 14:05
@tmontaigu tmontaigu requested a review from mayeul-zama January 30, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant