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

Add workarounds for https://github.com/numba/numba/issues/9242 #121

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions sklearn_numba_dpex/common/topk.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,12 @@ def compute_radixes(
# fmt: on
# If `col_idx` is outside the bounds of the input, ignore this location.
is_in_bounds = col_idx < n_cols

# Workaround for https://github.com/numba/numba/issues/9242
mask_for_desired_value_ = uint_type(0)
item_lexicographically_mapped = uint_type(0)
desired_masked_value_ = uint_type(0)
radix_position_ = uint_type(0)
if is_in_bounds:
item = array_in_uint[row_idx, col_idx]

Expand Down Expand Up @@ -1030,6 +1036,7 @@ def check_radix_histogram(
# NB: `numba_dpex` seem to produce inefficient (branching) code for `break`,
# use `if/else` instead
desired_mask_value_search = True
count = np.int64(0) # Workaround for https://github.com/numba/numba/issues/9242
for _ in range(radix_size):
if desired_mask_value_search:
count = counts[row_idx, current_count_idx]
Expand Down