-
Notifications
You must be signed in to change notification settings - Fork 540
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
Fix UMAP sparse input crash #5494
Open
viclafargue
wants to merge
2
commits into
rapidsai:branch-23.12
Choose a base branch
from
viclafargue:fix-umap-sparse-input
base: branch-23.12
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+16
−3
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix looks good to me, can you just add a description of the fix to the PR description and fix the style issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry guys, this still isn't quite right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cjnolet, this is an older comment regarding the previous version. The current version should make use of the
workspace_resource_factory
to create alimiting_memory_resource
with the default amount (total_size / 2 ?
) and adjust the index batch size according to available memory. There may totally be things I missed, but could you give more precision to what is required here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the code slightly. But, since it's a RAFT call, the
limiting_memory_resource
cannot be used directly. The only thing that is doable is to update the handle, so that it has a resource factory that will in time be used to produce a workspace within the RAFT sparse kNN code. We can produce an estimate of the memory that will be available on the cuML side by callingresource::get_workspace_free_bytes
on the handle orget_allocation_limit
on the LMR. But, that's about it, isn't it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@achirkin can you offer suggestions here? The main goal is to emable smart batching without relying on a query to get the free memory from the GPU (which is not acceptable practice). We started using the
limiting_memory_resource_adapter
so that we could do this while allowing the user to control this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to understand the context here. In isolation, this change sets the batch size based on the available memory. If the
raft::sparse::selection::brute_force_knn
properly uses the workspace memory resource (which I hope it does but cannot check on my phone atm), then the solution looks good to me. Indeed, the workspace resource is always a limiting memory resource (the type is erased) andresource::get_workspace_free_bytes
is a correct way to gets its remaining limit.But I fail to see the connection to the linked issue. There, an invalid memory access error is reported, as suggested, likely due to integer overflow. If the workspace size is larger than 4gb, that still could be an issue, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look @achirkin. The changes in rapidsai/raft#1640 in addition to these changes should solve the issue. However, to allow any batch size to be used, it would be necessary to apply modifications to ensure that the integer values of
csr_batcher_t
anddistances_config_t
are also stored on 64 bits in order to guarantee that no operation would be made on 32 bits. This was much a more involved task, this is why I left it for later.