Skip to content

Add function bitwise_count#9390

Merged
asi1024 merged 9 commits into
cupy:mainfrom
0xtoward:feature-bitwise-count
Oct 1, 2025
Merged

Add function bitwise_count#9390
asi1024 merged 9 commits into
cupy:mainfrom
0xtoward:feature-bitwise-count

Conversation

@0xtoward
Copy link
Copy Markdown
Contributor

#6078

  • Adds GPU ufunc cupy.bitwise_count and exposes cupy.bit_count as an alias for old version of Numpy.
  • return uint8

@0xtoward 0xtoward requested a review from a team as a code owner September 15, 2025 12:30
@kmaehashi kmaehashi added cat:feature New features/APIs prio:high labels Sep 16, 2025
@0xtoward 0xtoward force-pushed the feature-bitwise-count branch from 0c80b06 to 1711f64 Compare September 16, 2025 07:41
@0xtoward 0xtoward force-pushed the feature-bitwise-count branch from 1711f64 to 95ba01e Compare September 16, 2025 08:14
Comment thread cupy/__init__.py Outdated
Comment thread tests/cupy_tests/binary_tests/test_elementwise.py Outdated
Comment thread cupy/_core/_routines_binary.pyx Outdated
@0xtoward 0xtoward requested a review from kmaehashi September 17, 2025 10:26
@leofang
Copy link
Copy Markdown
Member

leofang commented Sep 17, 2025

Could you fix the linter errors?

Comment thread cupy/_core/_routines_binary.pyx Outdated
@0xtoward 0xtoward force-pushed the feature-bitwise-count branch from 625448e to 375059e Compare September 17, 2025 17:14
@0xtoward 0xtoward changed the title Add function bitwise_count and alias bit_count Add function bitwise_count Sep 17, 2025
@leofang
Copy link
Copy Markdown
Member

leofang commented Sep 17, 2025

/test mini

Comment thread tests/cupy_tests/binary_tests/test_elementwise.py Outdated
@0xtoward 0xtoward force-pushed the feature-bitwise-count branch from a367ed0 to 5f220fc Compare September 18, 2025 04:06
Comment thread tests/cupy_tests/binary_tests/test_elementwise.py Outdated
@testing.numpy_cupy_array_equal()
def test_bitwise_count(self, xp, dtype):
import numpy as np
info = np.iinfo(dtype)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto

Suggested change
info = np.iinfo(dtype)
info = xp.iinfo(dtype)

Comment thread tests/cupy_tests/binary_tests/test_elementwise.py Outdated
Comment thread tests/cupy_tests/binary_tests/test_elementwise.py Outdated
@leofang
Copy link
Copy Markdown
Member

leofang commented Sep 26, 2025

/teat mini

@leofang
Copy link
Copy Markdown
Member

leofang commented Sep 26, 2025

/test mini

@leofang
Copy link
Copy Markdown
Member

leofang commented Sep 28, 2025

Could you check the CI failures? I think we need to constrain the NumPy version using @testing.with_requires(...), since this API is new in NumPy.

@0xtoward
Copy link
Copy Markdown
Contributor Author

/test mini

@leofang
Copy link
Copy Markdown
Member

leofang commented Sep 29, 2025

Sorry, we only allow maintainers to trigger the CI pipelines in this repo 😅

@leofang
Copy link
Copy Markdown
Member

leofang commented Sep 29, 2025

/test mini

@asi1024
Copy link
Copy Markdown
Member

asi1024 commented Oct 1, 2025

LGTM! Thanks for your contribution!

@asi1024 asi1024 merged commit 6d5d0ae into cupy:main Oct 1, 2025
68 checks passed
@leofang leofang added this to the v14.0.0rc1 milestone Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:feature New features/APIs prio:high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants