-
Notifications
You must be signed in to change notification settings - Fork 808
[SYCL][HIP] Initial HIP mem_advise implementation. #10697
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
aelovikov-intel
merged 28 commits into
intel:sycl
from
GeorgeWeb:georgi/hip_memadvise_prefetch
Jan 9, 2024
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
aa4b752
[SYCL][HIP] Initial HIP mem_advise implementation.
c486984
Add back the HIP version guard for hipMemAdvise.
f714d74
Address review simplifying impl and add comments.
7408583
Add HIP device attribute check for managed memory support before call…
5699baf
Feedback - Add _pi_mem_advice aliases for HIP
4e3a44b
Feedback - Rename the memadvise test filename as it applies to more b…
dc5695e
Feedback - Update the memadvise flags test to include both the CUDA a…
499fc4d
Make mem_advise warn instead of throw for unsupported advice arguments.
f289357
Merge commit
b41ed80
Apply missed clang-format.
cec7b9d
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
0d75163
Update the PI minor to 39 from 38
21bbdf1
Merge commit.
a651d66
Bump minor again after merge commit changes to PI header
cb6f7b2
Update test head-comment description.
d6e55c9
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
fa7e8cf
Temporary update CMakeLists to test the UR-HIP adapter changes
9f08cec
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
fda8f52
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
5845503
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
e89d822
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
870a7af
Use updated version of the corresponding UR repo changes
87365cd
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
b350724
Merge remote-tracking branch 'origin/sycl' into georgi/hip_memadvise_…
kbenzie 575d583
[UR] Bump tag to 12a67f56
kbenzie 7c37bf6
Merge remote-tracking branch 'origin/sycl' into georgi/hip_memadvise_…
kbenzie 6d2027b
Fix hip memadvise discard events regression
56abbdb
Unset the UR tag override cmake variable
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
This file was deleted.
Oops, something went wrong.
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,74 @@ | ||
| // RUN: %{build} -o %t1.out | ||
| // REQUIRES: cuda || hip_amd | ||
| // RUN: %{run} %t1.out | ||
|
|
||
| //==---------------- memadvise_flags.cpp -----------------------------------==// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include <iostream> | ||
| #include <sycl/sycl.hpp> | ||
| #include <vector> | ||
|
|
||
| using namespace sycl; | ||
|
|
||
| int main() { | ||
| const size_t size = 100; | ||
| queue q; | ||
| auto dev = q.get_device(); | ||
| auto ctx = q.get_context(); | ||
| if (!dev.get_info<info::device::usm_shared_allocations>()) { | ||
| std::cout << "Shared USM is not supported. Skipping test." << std::endl; | ||
| return 0; | ||
| } | ||
|
|
||
| void *ptr = malloc_shared(size, dev, ctx); | ||
| if (ptr == nullptr) { | ||
| std::cout << "Allocation failed!" << std::endl; | ||
| return -1; | ||
| } | ||
|
|
||
| bool isCuda = dev.get_backend() == sycl::backend::ext_oneapi_cuda; | ||
| bool isHip = dev.get_backend() == sycl::backend::ext_oneapi_hip; | ||
|
|
||
| std::vector<int> valid_advices; | ||
| if (isCuda) { | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_CUDA_SET_READ_MOSTLY); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_CUDA_UNSET_READ_MOSTLY); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_CUDA_SET_PREFERRED_LOCATION); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_CUDA_UNSET_PREFERRED_LOCATION); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_CUDA_SET_ACCESSED_BY); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_CUDA_UNSET_ACCESSED_BY); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_CUDA_SET_PREFERRED_LOCATION_HOST); | ||
| valid_advices.emplace_back( | ||
| PI_MEM_ADVICE_CUDA_UNSET_PREFERRED_LOCATION_HOST); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_CUDA_SET_ACCESSED_BY_HOST); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_CUDA_UNSET_ACCESSED_BY_HOST); | ||
| } else if (isHip) { | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_HIP_SET_READ_MOSTLY); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_HIP_UNSET_READ_MOSTLY); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_HIP_SET_PREFERRED_LOCATION); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_HIP_UNSET_PREFERRED_LOCATION); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_HIP_SET_ACCESSED_BY); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_HIP_UNSET_ACCESSED_BY); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_HIP_SET_PREFERRED_LOCATION_HOST); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_HIP_UNSET_PREFERRED_LOCATION_HOST); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_HIP_SET_ACCESSED_BY_HOST); | ||
| valid_advices.emplace_back(PI_MEM_ADVICE_HIP_UNSET_ACCESSED_BY_HOST); | ||
| } else { | ||
| // Skip | ||
| return 0; | ||
| } | ||
|
|
||
| for (int advice : valid_advices) { | ||
| q.mem_advise(ptr, size, advice); | ||
| } | ||
|
|
||
| q.wait_and_throw(); | ||
| std::cout << "Test passed." << std::endl; | ||
| return 0; | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.