-
Notifications
You must be signed in to change notification settings - Fork 24
ManagedSharedPtr #298
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
ManagedSharedPtr #298
Changes from all commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
6147df2
Basic reference counting on host; host & device construction in make_…
mdavis36 f489a15
reinterpret cast record pointer on copy; adding accessors; custom del…
mdavis36 c18723a
SharedPointerRecord header; Generalizing Record w/ void* pointers; Fo…
mdavis36 75749a2
MSPtr counter takes on ownership of the pointer record creation and l…
mdavis36 067b66a
polymorphic object host->device copy testing; Working on getting Shar…
mdavis36 c4db6a1
Pushing latest changes to ManagedSharedPtr interface
mdavis36 5cabef2
Fixing Umpire copies; Using umpire allocators in makeSharedPtr.
mdavis36 7b0176e
Recursive polymorphic object copies.
mdavis36 435172a
Better copies between host + device; Register Touch considers const a…
mdavis36 acf00ad
Proper destruction on host & device; Correct deallocation w/ Umpire; …
mdavis36 c4bcb9b
CHAIPoly type tag for polymorphic types and defining their h/d copy b…
mdavis36 c5b9255
Making ManagedSharedPtr CHAICopyable (ISSUE: umpire throws error upon…
mdavis36 de62d4e
makeSharedPtrRecord takes pointers & spaces as initializer list.
mdavis36 f237611
Cleaning up unnecessary logic in SharedPointerRecord.
mdavis36 6e19aa8
Usind Def Ctor & Dtor to init and free elements of a ManagedArray tha…
mdavis36 1b4d1fa
Non GPU build compiling and passing basic tests...
mdavis36 d81d019
empty map assertions for shared_ptr tests.
mdavis36 32f81be
ManagedArray Size updates from pointer record on host call.
mdavis36 d97b556
Turn off copy ctor debug output.
mdavis36 c9d4bd0
Guarding GPU related work that throws an error when built without GPU…
mdavis36 eb72574
Guarding tests when not built w/ CUDA/HIP
mdavis36 be02184
Squash warnings when not building w/ GPU support.
mdavis36 79cb51f
Squash warnings when building Werror or pedantic.
mdavis36 2a53f53
Revert changes to managed_ptr_tests
mdavis36 eb23581
RajaExec plugin construction needs to be static.
mdavis36 68de020
HIP agnostic test macros.
mdavis36 9bb1281
HIP support for ManagedSharedPtr
mdavis36 a54519d
Merge branch 'develop' into feature/ManagedSharedPtr
mdavis36 6dcbce4
Pointing submodules to the same as develop.
mdavis36 c88613a
raja-chai-launch @ develop
mdavis36 338db55
More updates w/ develop.
mdavis36 5ab9ac3
Fixing clang + cuda build on blueos.
mdavis36 abf6011
Better comments for initInner & freeInner; Remove redudant PR inst.
mdavis36 6706d35
Pulling out common device helper functions and generalizing some devi…
mdavis36 e682c10
Squashing warnings in managed_shared_ptr_tests.
mdavis36 640f871
Seperate xnack host-config for amdclang
mdavis36 6bfafc9
Separate host-configs for amdclang w/o +xnack.
mdavis36 2d80d44
Squashing wanrings for amdclang HIP builds.
mdavis36 ccc0d75
Merge branch 'warn/amdclang' into feature/ManagedSharedPtr
mdavis36 5119b29
Squashing warnings for amdclang in ManagedSharedPtr.
mdavis36 bc7d2e3
Direct CHAI_UNUSED_VAR declaration.
mdavis36 20dcd64
Merge branch 'warn/amdclang' into feature/ManagedSharedPtr
mdavis36 3bbed6a
Merge branch 'develop' into feature/ManagedSharedPtr
mdavis36 07e804c
Squash warning from sync call not returning.
mdavis36 0c30375
Merge branch 'develop' into feature/ManagedSharedPtr
mdavis36 292a000
Cleaning up commented code moved to ChaiManager.hpp; Commenting out c…
mdavis36 ec7e084
Removing commented code blocks unnecessary for MSPtr.
mdavis36 0c181e3
Removing debug print statements from MSPtr development.
mdavis36 42b4830
Adding ChaiManager.hpp to chai_headers.
mdavis36 8aa65e0
Merge branch 'develop' into feature/ManagedSharedPtr
mdavis36 b39f553
Merge branch 'develop' into feature/ManagedSharedPtr
mdavis36 5dbf974
Silence unused var warning.
mdavis36 3409590
Move DeviceHelpers out of util dir.
mdavis36 f57baca
Add DeviceHelpers.hpp to chai_headers.
mdavis36 ac891ec
Adding sharedptr headers to chai_headers.
mdavis36 364636b
Silencing hip warnings from forall utility.
mdavis36 6226191
Moving ManageSharedPtr interface into expt namespace.
mdavis36 fd041bc
Spelling
mdavis36 9d2ec28
rm duplicate macros.
mdavis36 b9009f1
Cleaning comments; Remove development debug output.
mdavis36 3133c86
rm ChaiManager header.
mdavis36 e0da9c7
m_pi -> m_counter_base
mdavis36 ff72934
rm duplicate msp_dispose_on_device.
mdavis36 b7b542e
Add poly flag for deepCopy with ManagedSharedPtr.
mdavis36 b7d1cf0
Ensure all execution spaces free memory on destruction for non delete…
mdavis36 8e916c9
Remove realloc/size changes and test.
mdavis36 b54a20a
Scope only shared ptr tests.
mdavis36 825e043
SIMULATION_MODE guard.
mdavis36 230588d
SharedPointerRecord in chai_headers.
mdavis36 a521389
CHAI_ENABLE_EXPERIMENTAL for ManagedSharedPtr.
mdavis36 0f044db
Remove ReallocCopy test.
mdavis36 54cf3b7
Default CHAI_ENABLE_EXPERIMENTAL On.
mdavis36 9bf29a8
Non-deleter constructor for msp_record_count.
mdavis36 fdd85e5
Comments on SharedPtrCounter class behavior and ManagedSharedPtr tests.
mdavis36 2d0e9a4
Comment cleanup SharedPtrManager.cpp.
mdavis36 df410ff
Merge branch 'develop' into feature/ManagedSharedPtr
adayton1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#ifndef CHAI_DEVICE_HELPERS_HPP | ||
#define CHAI_DEVICE_HELPERS_HPP | ||
|
||
#include "chai/config.hpp" | ||
#include "chai/ChaiMacros.hpp" | ||
|
||
namespace chai | ||
{ | ||
// CHAI_GPU_ERROR_CHECK macro | ||
#ifdef CHAI_ENABLE_DEVICE | ||
|
||
#ifdef CHAI_ENABLE_GPU_ERROR_CHECKING | ||
|
||
inline void gpuErrorCheck(gpuError_t code, const char *file, int line, bool abort=true) | ||
{ | ||
if (code != gpuSuccess) { | ||
fprintf(stderr, "[CHAI] GPU Error: %s %s %d\n", gpuGetErrorString(code), file, line); | ||
if (abort) { | ||
exit(code); | ||
} | ||
} | ||
} | ||
|
||
#define CHAI_GPU_ERROR_CHECK(code) { ::chai::gpuErrorCheck((code), __FILE__, __LINE__); } | ||
#else // CHAI_ENABLE_GPU_ERROR_CHECKING | ||
#define CHAI_GPU_ERROR_CHECK(code) code | ||
#endif // CHAI_ENABLE_GPU_ERROR_CHECKING | ||
|
||
#endif | ||
|
||
// wrapper for hip/cuda synchronize | ||
inline void synchronize() { | ||
#if defined(CHAI_ENABLE_DEVICE) && !defined(CHAI_DEVICE_COMPILE) | ||
CHAI_GPU_ERROR_CHECK(gpuDeviceSynchronize()); | ||
#endif | ||
} | ||
|
||
#if defined(CHAI_GPUCC) || defined(CHAI_ENABLE_GPU_SIMULATION_MODE) | ||
|
||
// wrapper for hip/cuda free | ||
CHAI_HOST inline void gpuFree(void* buffer) { | ||
#if defined(CHAI_ENABLE_GPU_SIMULATION_MODE) | ||
free(buffer); | ||
#elif defined (CHAI_ENABLE_HIP) | ||
CHAI_GPU_ERROR_CHECK(hipFree(buffer)); | ||
#elif defined (CHAI_ENABLE_CUDA) | ||
CHAI_GPU_ERROR_CHECK(cudaFree(buffer)); | ||
#endif | ||
} | ||
|
||
// wrapper for hip/cuda malloc | ||
CHAI_HOST inline void gpuMalloc(void** devPtr, size_t size) { | ||
#if defined(CHAI_ENABLE_GPU_SIMULATION_MODE) | ||
*devPtr = (void*)malloc(size); | ||
#elif defined (CHAI_ENABLE_HIP) | ||
CHAI_GPU_ERROR_CHECK(hipMalloc(devPtr, size)); | ||
#elif defined (CHAI_ENABLE_CUDA) | ||
CHAI_GPU_ERROR_CHECK(cudaMalloc(devPtr, size)); | ||
#endif | ||
} | ||
|
||
// wrapper for hip/cuda managed malloc | ||
CHAI_HOST inline void gpuMallocManaged(void** devPtr, size_t size) { | ||
#if defined(CHAI_ENABLE_GPU_SIMULATION_MODE) | ||
*devPtr = (void*)malloc(size); | ||
#elif defined (CHAI_ENABLE_HIP) | ||
CHAI_GPU_ERROR_CHECK(hipMallocManaged(devPtr, size)); | ||
#elif defined (CHAI_ENABLE_CUDA) | ||
CHAI_GPU_ERROR_CHECK(cudaMallocManaged(devPtr, size)); | ||
#endif | ||
} | ||
|
||
// wrapper for hip/cuda mem copy | ||
CHAI_HOST inline void gpuMemcpy(void* dst, const void* src, size_t count, gpuMemcpyKind kind) { | ||
#if defined(CHAI_ENABLE_GPU_SIMULATION_MODE) | ||
memcpy(dst, src, count); | ||
#elif defined (CHAI_ENABLE_HIP) | ||
CHAI_GPU_ERROR_CHECK(hipMemcpy(dst, src, count, kind)); | ||
#elif defined (CHAI_ENABLE_CUDA) | ||
CHAI_GPU_ERROR_CHECK(cudaMemcpy(dst, src, count, kind)); | ||
#endif | ||
} | ||
|
||
#endif //#if defined(CHAI_GPUCC) | ||
|
||
} // namespace chai | ||
|
||
#endif // CHAI_DEVICE_HELPERS_HPP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do these changes fix other behaviors?
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.
Yes, it allows default construction of more complex nested chai managed types that would be elements of a managed array.