-
Notifications
You must be signed in to change notification settings - Fork 116
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
[EXP][usm p2p] Add test for ur_exp_usm_p2p and impl for hip #1369
Merged
kbenzie
merged 16 commits into
oneapi-src:main
from
JackAKirk:usm-p2p-add-test-and-macro
Mar 18, 2024
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0cdd69f
USM-P2P extension implementation for hip.
JackAKirk 9bd455f
Use camelCase always. Return caught UR error directly.
JackAKirk ba74c55
Format.
JackAKirk e3a1b47
Merge branch 'main' into p2p-hip
JackAKirk 12de78a
Merge branch 'main' into p2p-hip
JackAKirk 4217a2d
Revert unrelated cuda changes.
JackAKirk cd9a5d2
Add USM_P2P_EXTENSION_STRING_EXP Macro.
JackAKirk 97846c5
Mark ur_exp_usm_p2p supported for CUDA.
JackAKirk c46745e
Add brief Support section.
JackAKirk d9434c7
Add conformance test for exp_usm_p2p.
JackAKirk 1417315
Fix license header format.
JackAKirk 6288286
Format and fix match file name.
JackAKirk bd90079
Add missing .match files for all backends.
JackAKirk bcb0215
Some stylistic improvements to documentation.
JackAKirk f39d41f
Merge branch 'p2p-hip' into usm-p2p-add-test-and-macro
JackAKirk ad198f9
Merge branch 'main' into usm-p2p-add-test-and-macro
JackAKirk 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 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 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 |
---|---|---|
|
@@ -27,16 +27,20 @@ or copying the memory located on a separate "peer" device. | |
|
||
Motivation | ||
-------------------------------------------------------------------------------- | ||
Several important projects that the SYCL programming model aims to support use | ||
fine-grained peer to peer memory access controls. | ||
Two such examples that SYCL supports are Pytorch and Gromacs. | ||
This experimental extension to UR aims to provide a portable interface that can | ||
call appropriate driver functions to query and control peer memory access | ||
across the CUDA, HIP and L0 adapters. | ||
Programming models like SYCL or OpenMP aim to support several important | ||
projects that utilise fine-grained peer-to-peer memory access controls. | ||
This experimental extension to the Unified-Runtime API aims to provide a | ||
portable interface that can call appropriate driver functions to query and | ||
control peer memory access within different adapters such as CUDA, HIP and | ||
Level Zero. | ||
|
||
API | ||
-------------------------------------------------------------------------------- | ||
|
||
Macros | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
* ${X}_USM_P2P_EXTENSION_STRING_EXP | ||
|
||
Enums | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
|
@@ -48,14 +52,23 @@ Functions | |
* ${x}UsmP2PDisablePeerAccessExp | ||
* ${x}UsmP2PPeerAccessGetInfoExp | ||
|
||
Support | ||
-------------------------------------------------------------------------------- | ||
|
||
Adapters which support this experimental feature *must* return the valid string | ||
defined in ``${X}_USM_P2P_EXTENSION_STRING_EXP`` as one of the options from | ||
${x}DeviceGetInfo when querying for ${X}_DEVICE_INFO_EXTENSIONS. | ||
|
||
Changelog | ||
-------------------------------------------------------------------------------- | ||
|
||
+-----------+------------------------+ | ||
| Revision | Changes | | ||
+===========+========================+ | ||
| 1.0 | Initial Draft | | ||
+-----------+------------------------+ | ||
+-----------+---------------------------------------------+ | ||
| Revision | Changes | | ||
+===========+=============================================+ | ||
| 1.0 | Initial Draft | | ||
+-----------+---------------------------------------------+ | ||
| 1.1 | Added USM_P2P_EXTENSION_STRING_EXP ID Macro | | ||
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. not sure if that should be revision 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'm following other extensions that iterate through 1.1,1.2 etc. This is a minor change to the spec. |
||
+-----------+---------------------------------------------+ | ||
|
||
Contributors | ||
-------------------------------------------------------------------------------- | ||
|
This file contains 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 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 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 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 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,8 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
# See LICENSE.TXT | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
add_conformance_test_with_devices_environment(exp_usm_p2p | ||
usm_p2p.cpp | ||
) |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains 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,60 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM | ||
// Exceptions. See LICENSE.TXT | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include "uur/fixtures.h" | ||
#include "uur/raii.h" | ||
|
||
using urP2PTest = uur::urAllDevicesTest; | ||
|
||
TEST_F(urP2PTest, Success) { | ||
|
||
if (devices.size() < 2) { | ||
GTEST_SKIP(); | ||
} | ||
|
||
size_t returned_size; | ||
ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_EXTENSIONS, 0, | ||
nullptr, &returned_size)); | ||
|
||
std::unique_ptr<char[]> returned_extensions(new char[returned_size]); | ||
|
||
ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_EXTENSIONS, | ||
returned_size, returned_extensions.get(), | ||
nullptr)); | ||
|
||
std::string_view extensions_string(returned_extensions.get()); | ||
const bool usm_p2p_support = | ||
extensions_string.find(UR_USM_P2P_EXTENSION_STRING_EXP) != | ||
std::string::npos; | ||
|
||
if (!usm_p2p_support) { | ||
GTEST_SKIP() << "EXP usm p2p feature is not supported."; | ||
} | ||
|
||
int value; | ||
ASSERT_SUCCESS(urUsmP2PPeerAccessGetInfoExp( | ||
devices[0], ///< [in] handle of the command device object | ||
devices[1], ///< [in] handle of the peer device object | ||
UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED, sizeof(int), &value, | ||
&returned_size)); | ||
// Note that whilst it is not currently specified to be a requirement in the | ||
// specification, currently all supported backends return value = 1 for the | ||
// UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED query when the query is true | ||
// (matching the native query return values). Generally different backends can | ||
// return different values for a given device query; however it is | ||
// advisable that for boolean queries they return the same values to indicate | ||
// true/false. When this extension is moved out of experimental status such | ||
// boolean return values should be specified by the extension. | ||
ASSERT_EQ(value, 1); | ||
|
||
// Just check that this doesn't throw since supporting peer atomics is | ||
// optional and can depend on backend/device. | ||
ASSERT_SUCCESS(urUsmP2PPeerAccessGetInfoExp( | ||
devices[0], devices[1], UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED, | ||
sizeof(int), &value, &returned_size)); | ||
|
||
ASSERT_SUCCESS(urUsmP2PEnablePeerAccessExp(devices[0], devices[1])); | ||
ASSERT_SUCCESS(urUsmP2PDisablePeerAccessExp(devices[0], devices[1])); | ||
} |
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.
Minor change to above that you may simply ignore
Programming models like SYCL or OpenMP aim to support several important projects that utilise fine-grained peer-to-peer memory access controls. This experimental extension to the Unified-Runtime API aims to offer a portable interface capable of invoking relevant driver functions to query about and control peer memory access across various adapters, including CUDA, HIP, and Level Zero.
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'll switch the first sentence, I think this is an improvement. I think the second one is not as good as the original though.