Skip to content

Check in of generic reduction templates and some reductions #1399

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

Merged
merged 27 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
07ac2da
Implements necessary sycl utilities for custom reductions
ndgrigorian Sep 11, 2023
78f7aba
Implements dpctl.tensor.max and dpctl.tensor.min
ndgrigorian Sep 11, 2023
41671ae
Adds tests for min and max
ndgrigorian Sep 14, 2023
093fcca
Reductions now set max_wg to the minimum of the max work group size a…
ndgrigorian Sep 14, 2023
82688ed
max and min nan propagation fixed for CPU devices
ndgrigorian Sep 15, 2023
e5a39cf
Tweak to test_reduction_kernels
ndgrigorian Sep 15, 2023
3af754c
Implements dpctl.tensor.argmax and argmin
ndgrigorian Sep 19, 2023
7052ad1
Tests for argmin and argmax
ndgrigorian Sep 19, 2023
97efe7a
Argmin and argmax now handle identities correctly
ndgrigorian Sep 19, 2023
7aef816
Replaced `std::min` with `idx_reduction_op_`
ndgrigorian Sep 27, 2023
6c3abcc
reductions now well-behaved for size-zero arrays
ndgrigorian Sep 27, 2023
a00ac58
removed unnecessary copies in reduction templates
ndgrigorian Sep 27, 2023
2468d8a
Refactors sum to use generic reduction templates
ndgrigorian Sep 27, 2023
78829e7
Sum now uses a generic Python API
ndgrigorian Sep 27, 2023
f01991b
Docstrings added for argmax, argmin, max, and min
ndgrigorian Sep 27, 2023
8597300
Small reduction clean-ups
ndgrigorian Sep 28, 2023
2c18667
Added test for argmin with keepdims=True
oleksandr-pavlyk Sep 28, 2023
24b54d7
Added a test for raised errors in reductions
ndgrigorian Sep 29, 2023
df1c22f
Removed `void` overloads from reduction utilities
ndgrigorian Sep 30, 2023
478b30c
Added missing include, Identity to use has_known_identity
oleksandr-pavlyk Oct 1, 2023
0598416
Adding functor factories for product over axis
oleksandr-pavlyk Oct 1, 2023
ca0ff64
Added Python API for _prod_over_axis
oleksandr-pavlyk Oct 1, 2023
ee46ae1
Common reduction template takes functions to test if atomics are appl…
oleksandr-pavlyk Oct 2, 2023
1d9b7ce
Defined dpctl.tensor.prod
oleksandr-pavlyk Oct 2, 2023
8890d21
Added tests for dpt.prod, removed uses of numpy
oleksandr-pavlyk Oct 2, 2023
60a8ad7
Corrected prod docstring
ndgrigorian Oct 3, 2023
04ec23b
Merge pull request #1426 from IntelPython/implement-product
oleksandr-pavlyk Oct 3, 2023
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
3 changes: 2 additions & 1 deletion dpctl/tensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pybind11_add_module(${python_module_name} MODULE
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/boolean_reductions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/device_support_queries.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/sum_reductions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/repeat.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reduction_over_axis.cpp
)
set(_clang_prefix "")
if (WIN32)
Expand All @@ -60,6 +60,7 @@ set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/full_ctor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reduction_over_axis.cpp
PROPERTIES COMPILE_OPTIONS "${_clang_prefix}-fno-fast-math")
if (UNIX)
set_source_files_properties(
Expand Down
7 changes: 6 additions & 1 deletion dpctl/tensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
tanh,
trunc,
)
from ._reduction import sum
from ._reduction import argmax, argmin, max, min, prod, sum
from ._testing import allclose

__all__ = [
Expand Down Expand Up @@ -309,4 +309,9 @@
"allclose",
"repeat",
"tile",
"max",
"min",
"argmax",
"argmin",
"prod",
]
Loading