-
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
Implement KOKKOS_IF_ON_{HOST,DEVICE}
macros
#4660
Conversation
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 I would prefer KOKKOS_IF_ON_HOST/DEVICE
slightly but otherwise, this looks pretty good to me already.
… in the dimension runtime check in the View constructor
…ter on the host side
…ationRecord implementation
e0672ee
to
1b09cfb
Compare
…fetView constructors
…n and improve error message
Co-Authored-By: Christian Trott <crtrott@sandia.gov>
…> and drop macro guards
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.
Looks good: just need to discuss naming in meeting tomorrow.
Name: IF_ON_HOST/DEVICE or IF_HOST/DEVICE |
Now that I think of it - since KOKKOS_IF_{HOST,DEVICE} refers to code (sources and files) itself which reside wherever, leaving it as proposed by Damien makes it sound like KOKKOS_IF_{HOST_CODE,DEVICE_CODE} w/o stating the obvious “CODE”, which I like more now. |
KOKKOS_IF_{HOST,DEVICE}
macrosKOKKOS_IF_ON_{HOST,DEVICE}
macros
Retest this please |
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.
Can you please comment on deprecating ActiveExecutionMemorySpace
?
I left some comments but other than that, the pull request looks good to me.
Rebasing some pull requests will be fun. 🙂
KOKKOS_DEPRECATED KOKKOS_FUNCTION static void check() {} | ||
}; | ||
|
||
template <typename DstMemorySpace, typename SrcMemorySpace> | ||
struct verify_space<DstMemorySpace, SrcMemorySpace, false> { | ||
KOKKOS_FUNCTION static void check() { | ||
KOKKOS_DEPRECATED KOKKOS_FUNCTION static void check() { | ||
Kokkos::abort( | ||
"Kokkos::View ERROR: attempt to access inaccessible memory space"); | ||
}; | ||
}; | ||
#endif |
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.
Highlighting deprecations.
#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 | ||
#define KOKKOS_RESTRICT_EXECUTION_TO_DATA(DATA_SPACE, DATA_PTR) \ | ||
Kokkos::Impl::verify_space<Kokkos::Impl::ActiveExecutionMemorySpace, \ | ||
DATA_SPACE>::check(); | ||
|
||
#define KOKKOS_RESTRICT_EXECUTION_TO_(DATA_SPACE) \ | ||
Kokkos::Impl::verify_space<Kokkos::Impl::ActiveExecutionMemorySpace, \ | ||
DATA_SPACE>::check(); | ||
#endif |
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.
Highlighting deprecations.
@@ -538,7 +538,7 @@ class MemoryPool { | |||
#else | |||
const uint32_t block_id_hint = | |||
(uint32_t)(Kokkos::Impl::clock_tic() | |||
#if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA) | |||
#ifdef __CUDA_ARCH__ // FIXME_CUDA |
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.
Highlighting
// No __host__ __device__ annotation because long double treated as double in | ||
// device code. May be revisited later if that is not true any more. |
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.
// No __host__ __device__ annotation because long double treated as double in | |
// device code. May be revisited later if that is not true any more. | |
// FIXME No __host__ __device__ annotation because long double treated as double in | |
// device code. May be revisited later if that is not true any more. |
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.
This is not a FIXME
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 comments such as "Maybe revisited later" are entirely ignored if they don't have a FIXME with them.
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.
FIXME_MAYBE if one gpu backend supports this one day and we really need it
KOKKOS_IF_ON_HOST((impl_wait_until_equal_host(ptr, v, active_wait);)) | ||
|
||
KOKKOS_IF_ON_DEVICE(((void)active_wait; while (!test_equal(ptr, v)){})) | ||
} | ||
|
||
static void impl_wait_until_equal_host(int* ptr, const int v, | ||
bool active_wait = true) noexcept { |
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 specifically here defining a different function but noting other places?
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.
Because of all the #ifdef
s
@@ -314,7 +314,7 @@ class Task : public TaskBase, public FunctorType { | |||
// If team then only one thread calls destructor. | |||
|
|||
const bool only_one_thread = | |||
#if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA) | |||
#ifdef __CUDA_ARCH__ // FIXME_CUDA |
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.
Highlighting
@@ -669,7 +669,7 @@ class alignas(16) RunnableTask | |||
// If team then only one thread calls destructor. | |||
|
|||
const bool only_one_thread = | |||
#if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA) | |||
#ifdef __CUDA_ARCH__ // FIXME_CUDA |
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.
Highlighting
Co-Authored-By: Daniel Arndt <arndtd@ornl.gov>
Morning @dalg24 -- Is it ok to close this PR ? |
What do you mean close a PR? There is nothing to close it is already merged. You may remove the "Blocks Promotion" label if you like. |
OK, sounds good. Sorry for the clumsiness , just trying to figure out how to handle the flow of information, so that nothing slips through the cracks. |
Remove use of ActiveExecutionMemorySpace for compatibility with disable of kokkos deprecated code See kokkos/kokkos#4668 and kokkos/kokkos#4660
Remove use of ActiveExecutionMemorySpace for compatibility with disable of kokkos deprecated code See kokkos/kokkos#4668 and kokkos/kokkos#4660
Proposing a solution to #3404