-
Notifications
You must be signed in to change notification settings - Fork 79
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
Supporting "where" for unary operations #1061
Conversation
This PR also implements |
struct ScalarUnaryRed { | ||
ScalarUnaryRed(ScalarUnaryRedArgs& args) { assert(false); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this trying to do? Bar the use of the general template? Or bar a non-const copy? If the point is to deny the use of the general template, prefer doing something like
template <typename T>
struct Foo {
// Note tautological expression still dependent on template parameter
static_assert(!std::is_same_v<T, T>);
};
If you'd like to instead bar the use of copy ctor, prefer the usual = delete
:
template <typename T>
struct Foo {
Foo(const Foo&) = delete;
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @Jacobfaib . This is not necessary anymore. the purpose for this was to "prevent the use of general template"
src/cunumeric/unary/unary_red_omp.cc
Outdated
for (size_t o_idx = 0; o_idx < split.outer; ++o_idx) | ||
for (size_t i_idx = 0; i_idx < split.inner; ++i_idx) { | ||
auto point = splitter.combine(o_idx, i_idx, rect.lo); | ||
auto identity = LG_OP::identity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can put this in the if
src/cunumeric/unary/unary_red_omp.cc
Outdated
auto split = splitter.split(rect, collapsed_dim); | ||
|
||
#pragma omp parallel for schedule(static) | ||
for (size_t o_idx = 0; o_idx < split.outer; ++o_idx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit, but consider adding the {}
around the for
's body. The code is correct as written, just makes it slightly easier to read.
Co-authored-by: Jacob Faibussowitsch <[email protected]>
Co-authored-by: Jacob Faibussowitsch <[email protected]>
Co-authored-by: Jacob Faibussowitsch <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Co-authored-by: Manolis Papadakis <[email protected]>
Makes sense, I will add back |
/ok to test |
716e0d6
to
bdb49e9
Compare
for more information, see https://pre-commit.ci
/ok to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor comment, otherwise looks good
divisor = np.array(divisor, dtype=sum_array.dtype) # type: ignore [assignment] # noqa | ||
|
||
if dtype.kind == "f" or dtype.kind == "c": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just get rid of the dtype
parameter at this point, and just use sum_array.dtype
everywhere in this function.
/ok to test |
No description provided.