SWDEV-479807 - Skip if peer access is not supported.
Change-Id: I2a40976e7e1a4c86c41ea86e87359c7d4b85c6d8
Dieser Commit ist enthalten in:
committet von
Rakesh Roy
Ursprung
d1d8b1e08e
Commit
2f067487d2
@@ -49,6 +49,7 @@ static void RunBenchmark(LinearAllocs dst_allocation_type, LinearAllocs src_allo
|
||||
} else {
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard<int> src_allocation(src_allocation_type, size);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
|
||||
@@ -64,6 +64,7 @@ static void RunBenchmark(size_t width, size_t height, hipMemcpyKind kind, bool e
|
||||
// hipMemcpyDeviceToDevice
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard2D<int> src_allocation(width, height);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
|
||||
@@ -68,6 +68,7 @@ static void RunBenchmark(size_t width, size_t height, hipMemcpyKind kind, bool e
|
||||
// hipMemcpyDeviceToDevice
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard2D<int> src_allocation(width, height);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
|
||||
@@ -49,6 +49,7 @@ static void RunBenchmark(size_t width, size_t height, hipMemcpyKind kind,
|
||||
// hipMemcpyDeviceToDevice
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard2D<int> device_allocation(width, height);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
|
||||
@@ -55,7 +55,8 @@ static void RunBenchmark(size_t width, size_t height, hipMemcpyKind kind,
|
||||
// hipMemcpyDeviceToDevice
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard2D<int> device_allocation(width, height);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
ArrayAllocGuard<int> array_allocation(make_hipExtent(width, height, 0), hipArrayDefault);
|
||||
|
||||
@@ -50,6 +50,7 @@ static void RunBenchmark(size_t width, size_t height, hipMemcpyKind kind,
|
||||
// hipMemcpyDeviceToDevice
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard2D<int> device_allocation(width, height);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
|
||||
@@ -55,7 +55,8 @@ static void RunBenchmark(size_t width, size_t height, hipMemcpyKind kind,
|
||||
// hipMemcpyDeviceToDevice
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard2D<int> device_allocation(width, height);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
ArrayAllocGuard<int> array_allocation(make_hipExtent(width, height, 0), hipArrayDefault);
|
||||
|
||||
@@ -71,7 +71,8 @@ static void RunBenchmark(const hipExtent extent, hipMemcpyKind kind, bool enable
|
||||
// hipMemcpyDeviceToDevice
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard3D<int> src_allocation(extent);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
LinearAllocGuard3D<int> dst_allocation(extent);
|
||||
|
||||
@@ -77,7 +77,8 @@ static void RunBenchmark(const hipExtent extent, hipMemcpyKind kind, bool enable
|
||||
// hipMemcpyDeviceToDevice
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard3D<int> src_allocation(extent);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
LinearAllocGuard3D<int> dst_allocation(extent);
|
||||
|
||||
@@ -51,7 +51,8 @@ static void RunBenchmark(LinearAllocs dst_allocation_type, LinearAllocs src_allo
|
||||
} else {
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard<int> src_allocation(src_allocation_type, size);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
LinearAllocGuard<int> dst_allocation(dst_allocation_type, size);
|
||||
|
||||
@@ -40,6 +40,7 @@ static void RunBenchmark(size_t size, bool enable_peer_access=false) {
|
||||
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard<int> src_allocation(LinearAllocs::hipMalloc, size);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
|
||||
@@ -43,6 +43,7 @@ static void RunBenchmark(size_t size, bool enable_peer_access=false) {
|
||||
const hipStream_t stream = stream_guard.stream();
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard<int> src_allocation(LinearAllocs::hipMalloc, size);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
|
||||
@@ -64,7 +64,8 @@ static void RunBenchmark(size_t width, size_t height, hipMemcpyKind kind,
|
||||
// hipMemcpyDeviceToDevice
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard2D<int> src_allocation(width, height);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
LinearAllocGuard2D<int> dst_allocation(width, height);
|
||||
|
||||
@@ -70,7 +70,8 @@ static void RunBenchmark(size_t width, size_t height, hipMemcpyKind kind,
|
||||
// hipMemcpyDeviceToDevice
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard2D<int> src_allocation(width, height);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
LinearAllocGuard2D<int> dst_allocation(width, height);
|
||||
|
||||
@@ -51,7 +51,8 @@ static void RunBenchmark(LinearAllocs dst_allocation_type, LinearAllocs src_allo
|
||||
} else {
|
||||
int src_device = std::get<0>(GetDeviceIds(enable_peer_access));
|
||||
int dst_device = std::get<1>(GetDeviceIds(enable_peer_access));
|
||||
|
||||
if (src_device == -1 && dst_device == -1) { return; }
|
||||
|
||||
LinearAllocGuard<int> src_allocation(LinearAllocs::hipMalloc, size);
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
LinearAllocGuard<int> dst_allocation(LinearAllocs::hipMalloc, size);
|
||||
|
||||
@@ -93,8 +93,10 @@ static std::tuple<int, int> GetDeviceIds(bool enable_peer_access) {
|
||||
int can_access_peer = 0;
|
||||
HIP_CHECK(hipDeviceCanAccessPeer(&can_access_peer, src_device, dst_device));
|
||||
if (!can_access_peer) {
|
||||
INFO("Peer access cannot be enabled between devices " << src_device << " and " << dst_device);
|
||||
REQUIRE(can_access_peer);
|
||||
std::string msg = "Skipped as peer access cannot be enabled between devices " +
|
||||
std::to_string(src_device) + " " + std::to_string(dst_device);
|
||||
HipTest::HIP_SKIP_TEST(msg.c_str());
|
||||
return {-1, -1};
|
||||
}
|
||||
HIP_CHECK(hipDeviceEnablePeerAccess(dst_device, 0));
|
||||
} else {
|
||||
|
||||
@@ -53,6 +53,15 @@ TEST_CASE("Unit_hipExtGetLinkTypeAndHopCount_Positive_Basic") {
|
||||
return;
|
||||
}
|
||||
|
||||
int can_access_peer = 0;
|
||||
HIP_CHECK(hipDeviceCanAccessPeer(&can_access_peer, device1, device2));
|
||||
if (!can_access_peer) {
|
||||
std::string msg = "Skipped as peer access is not supported between devices : " +
|
||||
std::to_string(device1) + " " + std::to_string(device2);
|
||||
HipTest::HIP_SKIP_TEST(msg.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t link_type1 = -1, hop_count1 = -1;
|
||||
uint32_t link_type2 = -1, hop_count2 = -1;
|
||||
|
||||
|
||||
@@ -252,6 +252,11 @@ bool testhipLinkTypeHopcountDevice(int numDevices) {
|
||||
}
|
||||
for (auto pos=devicePairList.begin();
|
||||
pos != devicePairList.end(); pos++) {
|
||||
int can_access_peer = 0;
|
||||
HIP_CHECK(hipDeviceCanAccessPeer(&can_access_peer, (*pos).device1, (*pos).device2));
|
||||
if (!can_access_peer) {
|
||||
continue;
|
||||
}
|
||||
uint32_t linktype1 = 0;
|
||||
uint32_t hopcount1 = 0;
|
||||
RSMI_IO_LINK_TYPE linktype2 = RSMI_IOLINK_TYPE_UNDEFINED;
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren