Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed changes
Sorting a
boolarray on the GPU fails, while the same call works on the CPU:The cause is that
sort.metalinstantiates the sort kernels for every dtype exceptbool, so no bool kernel is ever built. This PR addsbool_to both instantiation lists:i didnt change anything else as sorting relies on comparison and its worknig for bool(false<true), and on a padding value, which in turn exists as Limits::max = true.
argsort,topkandpartitionuse the same kernels, so this fixes them for bool too.Testing
test_sort_booltotest_ops.py. It fails before this change and passes after.argsortindices,topk,partition, 2D and sliced inputs, and all-True, all-False and empty arrays.test_ops.pypass, and the formatting checks pass.Tested on my Apple M4, on current main