Skip to content

Conversation

@alexfikl
Copy link
Contributor

No description provided.

@alexfikl alexfikl force-pushed the type-algorithm branch 3 times, most recently from 4803d16 to 6ba057f Compare January 23, 2026 19:33
Comment on lines +128 to +132
# FIXME: other scan_dtypes below use uint?
if len(ary) > np.iinfo(np.int32).max:
scan_dtype = np.int64
scan_dtype = np.dtype(np.int64)
else:
scan_dtype = np.int32
scan_dtype = np.dtype(np.int32)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure if this was on purposes, so wanted to bring it up?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used to be pretty sloppy about "dtype" vs "type". Not opposed to cleaning that up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I meant that this is using np.int and the other places are using np.uint?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. For copy_if, I think uint will also be OK.

Comment on lines +483 to +485
index_dtype: DTypeLike = np.int32,
key_dtype: DTypeLike = np.uint32,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these dtypes always meant to be integers? I'm guessing yes because "radix sort". (need to update key_dtype attribute if yes)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.

Comment on lines 1052 to 1053
double_support=all(
has_double_support(dev) for dev in self.context.devices),
Copy link
Contributor Author

@alexfikl alexfikl Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be using self.devices instead of self.context.devices? Not quite sure what the use case is for setting self.devices to something different though..

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.devices is better.

from pytools.persistent_dict import WriteOncePersistentDict

import pyopencl as cl
import pyopencl._mymako as mako
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this on purpose? From a quick grep, this seems to be the only place that uses _mymako.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Everywhere else should switch to _mymako, too. Mako isn't a hard dependency, and all _mymako does is provide a nicer error message. For type checking, you could go

if TYPE_CHECKING:
    import mako
else:
    import pyopencl._mymako as mako

Comment on lines 1072 to +1073
if neutral is None:
from warnings import warn
warn("not specifying 'neutral' is deprecated and will lead to "
"wrong results if your scan is not in-place or your "
"'output_statement' does something otherwise non-trivial",
stacklevel=2)
raise ValueError("must provide a 'neutral' element in scan")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting this to None would raise an exception below in _process_code_for_macro(neutral), so it doesn't seem like it's supported at all?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, kill it.

@alexfikl alexfikl marked this pull request as ready for review January 23, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants