-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1369 from JackAKirk/usm-p2p-add-test-and-macro
[EXP][usm p2p] Add test for ur_exp_usm_p2p and impl for hip
- Loading branch information
Showing
13 changed files
with
152 additions
and
25 deletions.
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
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])); | ||
} |