-
Notifications
You must be signed in to change notification settings - Fork 61
Adding asan sanitizer support for hip #795
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
Open
kab163
wants to merge
36
commits into
develop
Choose a base branch
from
task/UM-1020-asan-poisoning-for-hip
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
a7e72b3
adding asan sanitizer support for hip
kab163 f90a7af
Apply style updates
00e3f43
WIP adding a hip kernel sanitizer test
kab163 ac5cd62
Apply style updates
522a4a9
adding usage checkers to sanitizer test
kab163 3ac6a7c
Apply style updates
a4f007a
more updates to sanitizer test for error checking
kab163 a1c0180
merging...
kab163 8b9e194
Apply style updates
6617aba
adding hip define macros
kab163 4c17280
Apply style updates
5379807
getting rid of double pointer
kab163 4e4804f
updating sanitizer test
kab163 4b92502
Apply style updates
276f15b
Merge branch 'develop' of github.com:LLNL/Umpire into task/UM-1020-as…
kab163 986c5a1
Merge branch 'develop' of github.com:LLNL/Umpire into task/UM-1020-as…
kab163 3858c0f
Merge branch 'develop' of https://github.com/LLNL/Umpire into task/UM…
kab163 e9bf9f6
adding flag for hip asan
kab163 0232f2c
updates for rocm test
kab163 f154c08
had to update the test runner to handle new paramter
kab163 2019270
Merge branch 'develop' into task/UM-1020-asan-poisoning-for-hip
davidbeckingsale 417b66d
Remove umpire namespace from fmt call
davidbeckingsale 43f0875
Allow +tools+rocm in Umpire package
davidbeckingsale f76f5be
Add amdgpu_target for new memleak job
davidbeckingsale f2eb907
remove extra linker flags
davidbeckingsale 1332301
Add xnack+ to target for memleak job
davidbeckingsale 9022631
Increase allocation on tioga due to memleak job
adrienbernede c458f02
Merge branch 'develop' into task/UM-1020-asan-poisoning-for-hip
adrienbernede 8a5057e
Merge branch 'develop' of github.com:LLNL/Umpire into task/UM-1020-as…
kab163 9898cb5
Merge branch 'develop' of github.com:LLNL/Umpire into task/UM-1020-as…
kab163 749cd46
Merge branch 'develop' of github.com:LLNL/Umpire into task/UM-1020-as…
kab163 9b95a36
Merge branch 'develop' of github.com:LLNL/Umpire into task/UM-1020-as…
kab163 3aeb7f2
Resolve merge conflicts
adayton1 c0cc484
Update to 6.4.1 for hip asan job
adayton1 1e42362
Move back to rocm 6.3.1
adayton1 3073c9a
merge with develop
kab163 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,3 +42,9 @@ rocmcc_6_4_1_hip_deviceconst: | |
| variables: | ||
| SPEC: "~shared +fortran +deviceconst +rocm tests=basic amdgpu_target=gfx90a %llvm-amdgpu@=6.4.1 ^[email protected]" | ||
| extends: .job_on_tioga | ||
|
|
||
| rocmcc_6_3_1_hip_memleak: | ||
| variables: | ||
| SPEC: "~shared +asan +sanitizer_tests +tools +rocm tests=basic amdgpu_target=gfx90a:xnack+ cxxflags==\"-fsanitize=address\" %[email protected] ^[email protected]" | ||
| ASAN_OPTIONS: "detect_leaks=1" | ||
| extends: .job_on_tioga | ||
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 |
|---|---|---|
|
|
@@ -9,24 +9,27 @@ | |
| #include "umpire/ResourceManager.hpp" | ||
| #include "umpire/strategy/DynamicPoolList.hpp" | ||
| #include "umpire/strategy/QuickPool.hpp" | ||
| #include "umpire/util/Macros.hpp" | ||
| #include "umpire/util/error.hpp" | ||
|
|
||
| void test_read_after_free() | ||
| #if defined(UMPIRE_ENABLE_HIP) | ||
| __global__ void test_read_for_hip(double* data_ptr, std::size_t INDEX) | ||
| { | ||
| auto& rm = umpire::ResourceManager::getInstance(); | ||
| auto allocator = rm.getAllocator("test_allocator"); | ||
|
|
||
| const std::size_t SIZE = 1356; | ||
| const std::size_t INDEX = SIZE / 2; | ||
| double* data = static_cast<double*>(allocator.allocate(SIZE * sizeof(double))); | ||
|
|
||
| data[INDEX] = 100; | ||
| std::cout << "data[INDEX] = " << data[INDEX] << std::endl; | ||
|
|
||
| allocator.deallocate(data); | ||
| std::cout << "data[256] = " << data[256] << std::endl; | ||
| if (threadIdx.x == 0) { | ||
| double dummy = data_ptr[INDEX]; | ||
| dummy = dummy + 42; | ||
| } | ||
| } | ||
| __global__ void test_write_for_hip(double* data_ptr, std::size_t INDEX) | ||
| { | ||
| if (threadIdx.x == 0) { | ||
| data_ptr[INDEX] = 256; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are two writes needed? |
||
| data_ptr[INDEX] = INDEX + 42; | ||
| } | ||
| } | ||
| #endif | ||
|
|
||
| void test_write_after_free() | ||
| void sanitizer_test(const std::string test_type) | ||
| { | ||
| auto& rm = umpire::ResourceManager::getInstance(); | ||
| auto allocator = rm.getAllocator("test_allocator"); | ||
|
|
@@ -37,36 +40,72 @@ void test_write_after_free() | |
|
|
||
| data[INDEX] = 100; | ||
| std::cout << "data[INDEX] = " << data[INDEX] << std::endl; | ||
|
|
||
| allocator.deallocate(data); | ||
| data[INDEX] = -1; | ||
| std::cout << "data[INDEX] = " << data[INDEX] << std::endl; | ||
|
|
||
| if (test_type.find("read") != std::string::npos) { | ||
| #if defined(UMPIRE_ENABLE_HIP) | ||
| hipLaunchKernelGGL(test_read_for_hip, dim3(1), dim3(16), 0, 0, data, INDEX); | ||
| hipDeviceSynchronize(); | ||
| #endif | ||
| std::cout << "data[256] = " << data[256] << std::endl; | ||
| } else { | ||
| if (test_type.find("write") == std::string::npos) { | ||
| std::cout << "Test type did not match either option - using write" << std::endl; | ||
| } | ||
| #if defined(UMPIRE_ENABLE_HIP) | ||
| hipLaunchKernelGGL(test_write_for_hip, dim3(1), dim3(16), 0, 0, data, INDEX); | ||
| hipDeviceSynchronize(); | ||
| #endif | ||
| data[INDEX] = -1; | ||
| std::cout << "data[INDEX] = " << data[INDEX] << std::endl; | ||
| } | ||
| } | ||
|
|
||
| int main(int argc, char* argv[]) | ||
| { | ||
| if (argc < 3) { | ||
| std::cout << argv[0] << " requires 2 arguments, test type and allocation strategy" << std::endl; | ||
| if (argc < 4) { | ||
| std::cout << "Usage: requires 3 arguments." << std::endl; | ||
| std::cout << "First, an allocation strategy (QuickPool or DynamicPoolList)." << std::endl; | ||
| std::cout << "Second, a test type (read or write)." << std::endl; | ||
| std::cout << "Third, a resource type (DEVICE, HOST, or UM)." << std::endl; | ||
| return 0; | ||
| } | ||
|
|
||
| const std::string strategy{argv[1]}; | ||
| const std::string test_type{argv[2]}; | ||
| std::string strategy{argv[1]}; | ||
| std::string test_type{argv[2]}; | ||
| std::string resource_type{argv[3]}; | ||
|
|
||
| auto& rm = umpire::ResourceManager::getInstance(); | ||
|
|
||
| if (strategy.find("QuickPool") != std::string::npos) { | ||
| auto pool = rm.makeAllocator<umpire::strategy::QuickPool>("test_allocator", rm.getAllocator("HOST")); | ||
| if ((resource_type.find("DEVICE") != std::string::npos) || (resource_type.find("UM") != std::string::npos)) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we might actually want |
||
| #if !defined(UMPIRE_ENABLE_HIP) | ||
| UMPIRE_ERROR(umpire::runtime_error, | ||
| fmt::format("The resource, \"{}\", can't be used if HIP is not enabled.", resource_type)); | ||
| #endif | ||
| } else { | ||
| if (resource_type.find("HOST") == std::string::npos) { | ||
| std::cout << "Resource type did not match any available options - using HOST." << std::endl; | ||
| resource_type = "HOST"; | ||
| } | ||
| } | ||
|
|
||
| if (strategy.find("DynamicPoolList") != std::string::npos) { | ||
| auto pool = rm.makeAllocator<umpire::strategy::DynamicPoolList>("test_allocator", rm.getAllocator(resource_type)); | ||
| UMPIRE_USE_VAR(pool); | ||
| } else if (strategy.find("DynamicPoolList") != std::string::npos) { | ||
| auto pool = rm.makeAllocator<umpire::strategy::DynamicPoolList>("test_allocator", rm.getAllocator("HOST")); | ||
| } else { | ||
| if (strategy.find("QuickPool") == std::string::npos) { | ||
| std::cout << "Allocation strategy did not match either option - using QuickPool." << std::endl; | ||
| strategy = "QuickPool"; | ||
| } | ||
| auto pool = rm.makeAllocator<umpire::strategy::QuickPool>("test_allocator", rm.getAllocator(resource_type)); | ||
| UMPIRE_USE_VAR(pool); | ||
| } | ||
|
|
||
| if (test_type.find("read") != std::string::npos) { | ||
| test_read_after_free(); | ||
| } else if (test_type.find("write") != std::string::npos) { | ||
| test_write_after_free(); | ||
| } | ||
| std::cout << " Conducting sanitizer test with " << strategy << " strategy, " << test_type << " test type, and the " | ||
| << resource_type << " resource." << std::endl; | ||
|
|
||
| // Conduct the test | ||
| sanitizer_test(test_type); | ||
|
|
||
| return 0; | ||
| } | ||
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.
Any device tests?