-
Notifications
You must be signed in to change notification settings - Fork 787
[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.
GeorgeWeb c486984
Add back the HIP version guard for hipMemAdvise.
GeorgeWeb f714d74
Address review simplifying impl and add comments.
GeorgeWeb 7408583
Add HIP device attribute check for managed memory support before call…
GeorgeWeb 5699baf
Feedback - Add _pi_mem_advice aliases for HIP
GeorgeWeb 4e3a44b
Feedback - Rename the memadvise test filename as it applies to more b…
GeorgeWeb dc5695e
Feedback - Update the memadvise flags test to include both the CUDA a…
GeorgeWeb 499fc4d
Make mem_advise warn instead of throw for unsupported advice arguments.
GeorgeWeb f289357
Merge commit
GeorgeWeb b41ed80
Apply missed clang-format.
GeorgeWeb cec7b9d
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
GeorgeWeb 0d75163
Update the PI minor to 39 from 38
GeorgeWeb 21bbdf1
Merge commit.
GeorgeWeb a651d66
Bump minor again after merge commit changes to PI header
GeorgeWeb cb6f7b2
Update test head-comment description.
GeorgeWeb d6e55c9
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
GeorgeWeb fa7e8cf
Temporary update CMakeLists to test the UR-HIP adapter changes
GeorgeWeb 9f08cec
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
GeorgeWeb fda8f52
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
GeorgeWeb 5845503
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
GeorgeWeb e89d822
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
GeorgeWeb 870a7af
Use updated version of the corresponding UR repo changes
GeorgeWeb 87365cd
Merge remote-tracking branch 'upstream/sycl' into georgi/hip_memadvis…
GeorgeWeb 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
GeorgeWeb 56abbdb
Unset the UR tag override cmake variable
GeorgeWeb 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 |
---|---|---|
|
@@ -57,13 +57,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT) | |
include(FetchContent) | ||
|
||
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") | ||
# commit 2d42d77d5b931b4558842bad32cf9dad80e17b3c | ||
# Merge: 9f14fedb 2a960baf | ||
# commit 12a67f56c3c5d08cfac0852d552b4e5fe0452d04 | ||
# Merge: 2b7b827c c10968f5 | ||
# Author: Kenneth Benzie (Benie) <[email protected]> | ||
# Date: Mon Jan 8 13:40:40 2024 +0000 | ||
# Merge pull request #1229 from oneapi-src/revert-1228-revert-984-ext_oneapi_queue_priority-hip | ||
# Revert "Revert "[HIP] Implement ext_oneapi_queue_priority"" | ||
set(UNIFIED_RUNTIME_TAG 2d42d77d5b931b4558842bad32cf9dad80e17b3c) | ||
# Date: Tue Jan 9 10:53:32 2024 +0000 | ||
# Merge pull request #1027 from GeorgeWeb/georgi/hip_memadvise | ||
# [SYCL][HIP] Implement mem_advise for HIP | ||
set(UNIFIED_RUNTIME_TAG 12a67f56c3c5d08cfac0852d552b4e5fe0452d04) | ||
|
||
if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO) | ||
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}") | ||
|
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.