-
Notifications
You must be signed in to change notification settings - Fork 407
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
Omptarget Updates #3169
Omptarget Updates #3169
Conversation
@@ -63,6 +63,16 @@ IF(KOKKOS_CXX_COMPILER_ID STREQUAL Clang) | |||
IF (INTERNAL_HAVE_CRAY_COMPILER) #not actually Clang | |||
SET(KOKKOS_CLANG_IS_CRAY TRUE) | |||
ENDIF() | |||
# The clang based Intel compiler reports as Clang to most versions of CMake |
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.
We are going towards all vendor compiler being identified by CMake as Clang...
@@ -75,6 +78,7 @@ SET(ClangOpenMPFlag -fopenmp=libomp) | |||
|
|||
COMPILER_SPECIFIC_FLAGS( | |||
Clang ${ClangOpenMPFlag} -Wno-openmp-mapping | |||
IntelClang -fiopenmp -Wno-openmp-mapping |
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.
Why are you not using ClangOpenMPFlag
if you bother setting it earlier?
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.
its not fopenmp=libomp, its fiopenmp with an "i", because its not really clang ….
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.
Right but you define a variable line 48 and never use it
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.
probably because it wasn't used there before some recent update, which came into this branch via a rebase
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.
mostly looks fine
Kokkos::Experimental::ScatterNonAtomic> | ||
: Sum<ValueType, DeviceType> { | ||
Kokkos::Experimental::ScatterNonAtomic> { | ||
ValueType& value; |
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.
Did you mean for this to be public? If so, putting public:
two lines below makes it look like you didn't intend to do that.
Kokkos::Experimental::ScatterAtomic> | ||
: Sum<ValueType, DeviceType> { | ||
Kokkos::Experimental::ScatterAtomic> { | ||
ValueType& value; |
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.
Same here
} | ||
KOKKOS_FORCEINLINE_FUNCTION void operator--() { update(ValueType(-1)); } |
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 probably should have a reason for not using {}
initialization with numeric literals to avoid accidental narrowing.
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.
Wait, what if ValueType
is unsigned? It should still be OK, right?
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.
Wait, what if
ValueType
is unsigned? It should still be OK, right?
It will do the right thing
KOKKOS_FORCEINLINE_FUNCTION void operator+=(ValueType const& rhs) { | ||
this->join(this->reference(), rhs); | ||
} | ||
KOKKOS_FORCEINLINE_FUNCTION void operator++() { | ||
this->join(this->reference(), 1); | ||
} | ||
KOKKOS_FORCEINLINE_FUNCTION void operator++(int) { | ||
this->join(this->reference(), 1); | ||
update(rhs); | ||
} | ||
KOKKOS_FORCEINLINE_FUNCTION void operator++() { update(1); } | ||
KOKKOS_FORCEINLINE_FUNCTION void operator++(int) { update(1); } | ||
KOKKOS_FORCEINLINE_FUNCTION void operator-=(ValueType const& rhs) { | ||
this->join(this->reference(), ValueType(-rhs)); | ||
} | ||
KOKKOS_FORCEINLINE_FUNCTION void operator--() { | ||
this->join(this->reference(), ValueType(-1)); | ||
} | ||
KOKKOS_FORCEINLINE_FUNCTION void operator--(int) { | ||
this->join(this->reference(), ValueType(-1)); | ||
update(ValueType(-rhs)); | ||
} | ||
KOKKOS_FORCEINLINE_FUNCTION void operator--() { update(ValueType(-1)); } | ||
KOKKOS_FORCEINLINE_FUNCTION void operator--(int) { update(ValueType(-1)); } |
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.
Why do these return void
?
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.
they did before. And yeah we probably should fix that as general ScatterView overhaul. Also #3162
template <typename T> | ||
KOKKOS_INLINE_FUNCTION void atomic_mul(volatile T* const dest, const T val) { | ||
(void)atomic_fetch_mul(dest, val); | ||
} | ||
|
||
template <typename T> | ||
KOKKOS_INLINE_FUNCTION void atomic_div(volatile T* const dest, const T val) { | ||
(void)atomic_fetch_div(dest, val); | ||
} | ||
|
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 does this have to do with OMPTarget?
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.
nothing which is why its also in this PR: #3162
#if defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(KOKKOS_ENABLE_CXX17) | ||
#define KOKKOS_IMPL_IF_ON_HOST if constexpr (omp_is_initial_device() == true) | ||
#else | ||
#define KOKKOS_IMPL_IF_ON_HOST if (true) |
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.
Comment explaining why this is sufficient on pre-C++17, maybe?
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.
it is not, but OpenMPTarget now requires C++17, I can remove the KOKKOS_ENABLE_CXX17 here.
Kokkos::parallel_reduce(nw, functor_type(nw), result1_v, result2, | ||
Kokkos::parallel_reduce("int_combined-reduce_mixed", | ||
Kokkos::RangePolicy<TEST_EXECSPACE>(0, nw), | ||
functor_type(nw), result1_v, result2, | ||
Kokkos::Sum<int64_t, Kokkos::HostSpace>{result3_v}); |
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.
Is this a driveby change on combined reducers? If so, should it be in a separate pull request?
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.
its not necessarily a drive-by change. It is a change specifically necessary for OpenMPTarget since OpenMPTarget doesn't have something like UVM or HostPinned memory which was used previously for these tests.
The formatting is off and the
|
This checks via a constexpr if condition whether you are on the device and if so doesn't use the allocation tracking.
Needed declare target pragmas on some static functions
Same as HIP some stuff is not implemented. Now make in the root build directory works.
…ompile Also applied clang-format
Also fix cmake formatting??
I ignored the ScatterView comments since that came in via a different PR, and we agreed to do another overhaul on that. |
@@ -49,11 +49,19 @@ SET(SOURCES | |||
) | |||
|
|||
IF(Kokkos_ENABLE_HIP) | |||
# FIXME requires TeamPolicy | |||
# FIXME HIP requires TeamPolicy |
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.
We use the FIXME_HIP token
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.
Apparently you don't because it only said FIXME before ;-)
ENDIF() | ||
|
||
IF(Kokkos_ENABLE_OPENMPTARGET) | ||
# FIXME OPENMPTARGET requires TeamPolicy Reductions and Custom Reduction |
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 are mixing FIXME OPENMPTARGET
with WORKAROUND OPENMPTARGET
. The point was to have unique token that can be searched for.
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 never used WORKAROUND in a cmake file, so I followed what was in the file.
Significant Update to OpenMPTarget