From 6b461d274f8a17fdfc24d231edca8d9078523620 Mon Sep 17 00:00:00 2001 From: "Zhang, Jerry" Date: Mon, 28 Sep 2026 16:47:10 -0700 Subject: [PATCH 1/3] feat(ze_peer): add --remote_wait for a remote event wait on each copy In a unidirectional test only the local device submits work, so the remote device can stay in a low power state for the whole run. On Intel Arc Pro B70 the transfer rate into or out of that device follows its GT frequency: ze_peer reports about 32 GB/s for a 256 MB write between two GPUs on the same socket, while a PyTorch copy between the same GPUs, which makes the destination device wait on an event, reaches about 57 GB/s. --remote_wait adds that dependency. Each copy signals an event, and a command list on engine 0 of the remote device waits on it and then resets it. The host synchronizes both devices before the next iteration, so the timed region includes the extra submission, wait, reset and synchronization. Immediate and regular command lists are both supported. How the wait affects the remote device's power state is platform specific. The option is off by default, so existing results are unchanged. IPC, bidirectional and parallel tests do not implement it and reject it with an error. Verified on 8x Arc Pro B70 with a BUILD_ZE_PERF_TESTS_ONLY=1 CMake build, 256 MB, -i 10: write 0->2 goes from 32.1 to 53.2 GB/s with immediate lists and from 33.6 to 53.5 GB/s with regular lists, and from 32.2 to 53.2 and 34.4 to 55.1 GB/s with -u 1; read 4<-0 goes from 8.2 to 17.9 GB/s. Runs with -v, including a sweep from device 0 to all 7 other devices, report no mismatches. 64 B latency rises by 3 to 8 us from the extra wait. --ipc, -b and all three parallel modes are rejected with exit status 255. Signed-off-by: Zhang, Jerry --- perf_tests/ze_peer/README.md | 18 +++ perf_tests/ze_peer/include/ze_peer.h | 25 ++++- perf_tests/ze_peer/src/ze_peer.cpp | 38 ++++++- .../ze_peer/src/ze_peer_unidirectional.cpp | 105 +++++++++++++----- 4 files changed, 150 insertions(+), 36 deletions(-) diff --git a/perf_tests/ze_peer/README.md b/perf_tests/ze_peer/README.md index b3df0d584..a994167cf 100644 --- a/perf_tests/ze_peer/README.md +++ b/perf_tests/ze_peer/README.md @@ -63,6 +63,13 @@ first compute engine in the device. --ipc perform a copy between two devices, specified by options -s and -d, with each device being managed by a separate process. + --remote_wait for unidirectional tests, append a wait on each copy's + completion event, and an event reset, to engine 0 of the + remote device. On some platforms this keeps the remote device + out of a low power state that limits the transfer. Timing + includes the extra submission, wait, reset and synchronization. + Not supported with --ipc, -b or parallel tests. Default: Not set. + --version display version -h, --help display help message ``` @@ -124,6 +131,17 @@ Run latency tests, for 64B, between devices 1 and 3 (assuming the system has suc ./ze_peer -t latency -z 64 -s 1 -d 3 ``` +Run BW test for 256 MB with the remote device waiting on each copy's completion event. +In a unidirectional test only the local device submits work, so the remote device can stay +in a low power state for the whole run. On some platforms the transfer rate depends on that +state, so results can vary with the remote device's recent activity. With `--remote_wait` the +remote device has a wait pending on each copy, similar to a framework that orders cross-device +work with events. Results include that extra work, so compare them with other `--remote_wait` +runs rather than with the default mode. +``` +./ze_peer -t transfer_bw -z 268435456 -s 0 -d 1 --remote_wait +``` + Run parallel_single_target test, between devices 0 and 1, using engines 2 and 3, for a size of 256 MB. In this case, the buffer is divided into the number of engines (2), for a resulting chunk size of 128MB. Then, two copies are submitted in parallel, per chunk, and per engine. diff --git a/perf_tests/ze_peer/include/ze_peer.h b/perf_tests/ze_peer/include/ze_peer.h index 95a118bbf..f18301915 100644 --- a/perf_tests/ze_peer/include/ze_peer.h +++ b/perf_tests/ze_peer/include/ze_peer.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2019-2026 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -116,6 +116,13 @@ first compute engine in the device. --regular_cmdlist use regular command list instead of immediate + --remote_wait for unidirectional tests, append a wait on each copy's + completion event, and an event reset, to engine 0 of the + remote device. On some platforms this keeps the remote device + out of a low power state that limits the transfer. Timing + includes the extra submission, wait, reset and synchronization. + Not supported with --ipc, -b or parallel tests. Default: Not set. + --version display version -h, --help display help message )HELP"; @@ -223,12 +230,14 @@ class ZePeer { void perform_copy(peer_test_t test_type, ze_command_list_handle_t command_list, ze_command_queue_handle_t command_queue, void *dst_buffer, - void *src_buffer, size_t buffer_size); + void *src_buffer, size_t buffer_size, + ze_command_list_handle_t remote_command_list = nullptr, + ze_command_queue_handle_t remote_command_queue = nullptr); - void perform_copy_immediate(peer_test_t test_type, - ze_command_list_handle_t command_list, - void *dst_buffer, void *src_buffer, - size_t buffer_size); + void perform_copy_immediate( + peer_test_t test_type, ze_command_list_handle_t command_list, + void *dst_buffer, void *src_buffer, size_t buffer_size, + ze_command_list_handle_t remote_command_list = nullptr); void bidirectional_perform_copy(uint32_t dst_device_id, uint32_t src_device_id, uint32_t queue_index, @@ -321,6 +330,9 @@ class ZePeer { ze_event_pool_handle_t event_pool = {}; ze_event_handle_t event = {}; + ze_event_pool_handle_t remote_wait_event_pool = {}; + ze_event_handle_t remote_wait_event = {}; + static bool use_queue_in_destination; static bool run_continuously; static bool bidirectional; @@ -330,6 +342,7 @@ class ZePeer { static bool parallel_copy_to_pair_targets; static bool parallel_divide_buffers; static bool use_immediate_cmdlist; + static bool remote_wait; static uint32_t number_iterations; uint32_t warm_up_iterations = number_iterations / 5; diff --git a/perf_tests/ze_peer/src/ze_peer.cpp b/perf_tests/ze_peer/src/ze_peer.cpp index 982eb7cbc..16ea6e384 100644 --- a/perf_tests/ze_peer/src/ze_peer.cpp +++ b/perf_tests/ze_peer/src/ze_peer.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2019-2026 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,6 +19,7 @@ bool ZePeer::parallel_copy_to_multiple_targets = false; bool ZePeer::parallel_copy_to_pair_targets = false; bool ZePeer::parallel_divide_buffers = false; bool ZePeer::use_immediate_cmdlist = true; +bool ZePeer::remote_wait = false; uint32_t ZePeer::number_iterations = 50; const size_t max_elems = 268435456; /* 256 MB */ @@ -467,12 +468,24 @@ int main(int argc, char **argv) { ZePeer::validate_results = true; } else if (strcmp(argv[i], "--regular_cmdlist") == 0) { ZePeer::use_immediate_cmdlist = false; + } else if (strcmp(argv[i], "--remote_wait") == 0) { + ZePeer::remote_wait = true; } else { std::cout << usage_str; exit(-1); } } + // Only bandwidth_latency() implements the remote wait. + if (ZePeer::remote_wait && (run_ipc || ZePeer::bidirectional || + ZePeer::parallel_copy_to_single_target || + ZePeer::parallel_copy_to_multiple_targets || + ZePeer::parallel_copy_to_pair_targets)) { + std::cerr << "[ERROR] --remote_wait is not supported with --ipc, -b or " + "parallel tests\n"; + exit(-1); + } + if (run_ipc == false) { // Detect number of devices ZePeer peerQueryDevices(&num_devices); @@ -494,6 +507,9 @@ int main(int argc, char **argv) { << "tests\n" << "=============================================================" "===================\n"; + if (ZePeer::remote_wait) { + std::cout << "Remote device waits on each copy (--remote_wait)\n"; + } if (ZePeer::parallel_copy_to_multiple_targets || ZePeer::parallel_copy_to_pair_targets || @@ -764,6 +780,22 @@ ZePeer::ZePeer(std::vector &remote_device_ids, ze_event_desc_t event_desc = {ZE_STRUCTURE_TYPE_EVENT_DESC}; event_desc.signal = ZE_EVENT_SCOPE_FLAG_HOST; SUCCESS_OR_TERMINATE(zeEventCreate(event_pool, &event_desc, &event)); + + if (ZePeer::remote_wait) { + ze_event_pool_desc_t remote_wait_pool_desc = { + ZE_STRUCTURE_TYPE_EVENT_POOL_DESC}; + remote_wait_pool_desc.count = 1; + remote_wait_pool_desc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; + SUCCESS_OR_TERMINATE(zeEventPoolCreate(benchmark->context, + &remote_wait_pool_desc, 0, nullptr, + &remote_wait_event_pool)); + + ze_event_desc_t remote_wait_desc = {ZE_STRUCTURE_TYPE_EVENT_DESC}; + remote_wait_desc.signal = ZE_EVENT_SCOPE_FLAG_HOST; + remote_wait_desc.wait = ZE_EVENT_SCOPE_FLAG_HOST; + SUCCESS_OR_TERMINATE(zeEventCreate(remote_wait_event_pool, + &remote_wait_desc, &remote_wait_event)); + } } ZePeer::~ZePeer() { @@ -779,6 +811,10 @@ ZePeer::~ZePeer() { SUCCESS_OR_TERMINATE(zeEventDestroy(event)); SUCCESS_OR_TERMINATE(zeEventPoolDestroy(event_pool)); } + if (remote_wait_event) { + SUCCESS_OR_TERMINATE(zeEventDestroy(remote_wait_event)); + SUCCESS_OR_TERMINATE(zeEventPoolDestroy(remote_wait_event_pool)); + } benchmark->allDevicesCleanup(); delete benchmark; } diff --git a/perf_tests/ze_peer/src/ze_peer_unidirectional.cpp b/perf_tests/ze_peer/src/ze_peer_unidirectional.cpp index 6bdae7f7d..58ca53319 100644 --- a/perf_tests/ze_peer/src/ze_peer_unidirectional.cpp +++ b/perf_tests/ze_peer/src/ze_peer_unidirectional.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2026 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,29 +11,51 @@ void ZePeer::perform_copy(peer_test_t test_type, ze_command_list_handle_t command_list, ze_command_queue_handle_t command_queue, void *dst_buffer, void *src_buffer, - size_t buffer_size) { - - SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryCopy( - command_list, dst_buffer, src_buffer, buffer_size, nullptr, 0, nullptr)); + size_t buffer_size, + ze_command_list_handle_t remote_command_list, + ze_command_queue_handle_t remote_command_queue) { + const bool use_remote_wait = remote_command_list != nullptr; + const ze_event_handle_t signal_event = + use_remote_wait ? remote_wait_event : nullptr; + + SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryCopy(command_list, dst_buffer, + src_buffer, buffer_size, + signal_event, 0, nullptr)); SUCCESS_OR_TERMINATE(zeCommandListClose(command_list)); + if (use_remote_wait) { + SUCCESS_OR_TERMINATE(zeCommandListAppendWaitOnEvents(remote_command_list, 1, + &remote_wait_event)); + SUCCESS_OR_TERMINATE( + zeCommandListAppendEventReset(remote_command_list, remote_wait_event)); + SUCCESS_OR_TERMINATE(zeCommandListClose(remote_command_list)); + } - Timer timer; - - /* Warm up */ - for (uint32_t i = 0U; i < warm_up_iterations; i++) { + const auto execute_and_synchronize = [&]() { SUCCESS_OR_TERMINATE(zeCommandQueueExecuteCommandLists( command_queue, 1, &command_list, nullptr)); + if (use_remote_wait) { + SUCCESS_OR_TERMINATE(zeCommandQueueExecuteCommandLists( + remote_command_queue, 1, &remote_command_list, nullptr)); + } SUCCESS_OR_TERMINATE(zeCommandQueueSynchronize( command_queue, std::numeric_limits::max())); + if (use_remote_wait) { + SUCCESS_OR_TERMINATE(zeCommandQueueSynchronize( + remote_command_queue, std::numeric_limits::max())); + } + }; + + Timer timer; + + /* Warm up */ + for (uint32_t i = 0U; i < warm_up_iterations; i++) { + execute_and_synchronize(); } do { timer.start(); for (uint32_t i = 0U; i < number_iterations; i++) { - SUCCESS_OR_TERMINATE(zeCommandQueueExecuteCommandLists( - command_queue, 1, &command_list, nullptr)); - SUCCESS_OR_TERMINATE(zeCommandQueueSynchronize( - command_queue, std::numeric_limits::max())); + execute_and_synchronize(); } timer.end(); @@ -41,31 +63,48 @@ void ZePeer::perform_copy(peer_test_t test_type, } while (run_continuously); SUCCESS_OR_TERMINATE(zeCommandListReset(command_list)); + if (use_remote_wait) { + SUCCESS_OR_TERMINATE(zeCommandListReset(remote_command_list)); + } } -void ZePeer::perform_copy_immediate(peer_test_t test_type, - ze_command_list_handle_t command_list, - void *dst_buffer, void *src_buffer, - size_t buffer_size) { +void ZePeer::perform_copy_immediate( + peer_test_t test_type, ze_command_list_handle_t command_list, + void *dst_buffer, void *src_buffer, size_t buffer_size, + ze_command_list_handle_t remote_command_list) { + const bool use_remote_wait = remote_command_list != nullptr; + const ze_event_handle_t signal_event = + use_remote_wait ? remote_wait_event : nullptr; + + const auto copy_and_synchronize = [&]() { + SUCCESS_OR_TERMINATE( + zeCommandListAppendMemoryCopy(command_list, dst_buffer, src_buffer, + buffer_size, signal_event, 0, nullptr)); + if (use_remote_wait) { + SUCCESS_OR_TERMINATE(zeCommandListAppendWaitOnEvents( + remote_command_list, 1, &remote_wait_event)); + SUCCESS_OR_TERMINATE(zeCommandListAppendEventReset(remote_command_list, + remote_wait_event)); + } + SUCCESS_OR_TERMINATE(zeCommandListHostSynchronize( + command_list, std::numeric_limits::max())); + if (use_remote_wait) { + SUCCESS_OR_TERMINATE(zeCommandListHostSynchronize( + remote_command_list, std::numeric_limits::max())); + } + }; + Timer timer; /* Warm up */ for (uint32_t i = 0U; i < warm_up_iterations; i++) { - SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryCopy(command_list, dst_buffer, - src_buffer, buffer_size, - nullptr, 0, nullptr)); - SUCCESS_OR_TERMINATE(zeCommandListHostSynchronize( - command_list, std::numeric_limits::max())); + copy_and_synchronize(); } do { timer.start(); for (uint32_t i = 0U; i < number_iterations; i++) { - SUCCESS_OR_TERMINATE( - zeCommandListAppendMemoryCopy(command_list, dst_buffer, src_buffer, - buffer_size, nullptr, 0, nullptr)); - SUCCESS_OR_TERMINATE(zeCommandListHostSynchronize( - command_list, std::numeric_limits::max())); + copy_and_synchronize(); } timer.end(); @@ -103,12 +142,20 @@ void ZePeer::bandwidth_latency(peer_test_t test_type, initialize_buffers(remote_device_ids, local_device_ids, ze_host_buffer, buffer_size); + ze_command_queue_handle_t remote_command_queue = nullptr; + ze_command_list_handle_t remote_command_list = nullptr; + if (ZePeer::remote_wait) { + // Engine 0 always exists; the power effect of a wait is device specific. + remote_command_queue = ze_peer_devices[remote_device_id].engines[0].first; + remote_command_list = ze_peer_devices[remote_device_id].engines[0].second; + } + if (ZePeer::use_immediate_cmdlist) { perform_copy_immediate(test_type, command_list, dst_buffer, src_buffer, - buffer_size); + buffer_size, remote_command_list); } else { perform_copy(test_type, command_list, command_queue, dst_buffer, src_buffer, - buffer_size); + buffer_size, remote_command_list, remote_command_queue); } if (validate_results) { From 02f4cd7e29d23e771828fb79ae50971a44b466ce Mon Sep 17 00:00:00 2001 From: "Zhang, Jerry" Date: Mon, 28 Sep 2026 17:07:51 -0700 Subject: [PATCH 2/3] refactor(ze_peer): pass the remote wait engine as one optional argument perform_copy() and perform_copy_immediate() took the remote command list and queue as two separate defaulted handles, with a null list meaning no remote wait. That allowed a list without a queue, which the regular command list path cannot execute. Both now take one std::optional, a new alias for the queue and list pair that ze_peer_device_t::engines stores, so the remote wait is either fully specified or absent. Callers that do not use --remote_wait, including the IPC path, are unchanged. Verified on 8x Arc Pro B70 with a BUILD_ZE_PERF_TESTS_ONLY=1 CMake build: no new warnings, results match the previous commit (256 MB write 0->2 32.2 to 53.2 GB/s, read 4<-0 8.0 to 17.9 GB/s, -u 1 and --regular_cmdlist variants, -v runs with no mismatches), and --ipc, -b and all three parallel modes are still rejected. Signed-off-by: Zhang, Jerry --- perf_tests/ze_peer/include/ze_peer.h | 19 +++--- .../ze_peer/src/ze_peer_unidirectional.cpp | 61 +++++++++---------- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/perf_tests/ze_peer/include/ze_peer.h b/perf_tests/ze_peer/include/ze_peer.h index f18301915..50c0e80bb 100644 --- a/perf_tests/ze_peer/include/ze_peer.h +++ b/perf_tests/ze_peer/include/ze_peer.h @@ -20,6 +20,7 @@ #include #include #include +#include #include "common.hpp" #include "ze_app.hpp" #include @@ -39,9 +40,11 @@ typedef enum _peer_test_t { PEER_TEST_MAX } peer_test_t; +using ze_peer_engine_t = + std::pair; + typedef struct _ze_peer_device_t { - std::vector> - engines; + std::vector engines; } ze_peer_device_t; // clang-format off @@ -231,13 +234,13 @@ class ZePeer { ze_command_list_handle_t command_list, ze_command_queue_handle_t command_queue, void *dst_buffer, void *src_buffer, size_t buffer_size, - ze_command_list_handle_t remote_command_list = nullptr, - ze_command_queue_handle_t remote_command_queue = nullptr); + std::optional remote_engine = {}); - void perform_copy_immediate( - peer_test_t test_type, ze_command_list_handle_t command_list, - void *dst_buffer, void *src_buffer, size_t buffer_size, - ze_command_list_handle_t remote_command_list = nullptr); + void + perform_copy_immediate(peer_test_t test_type, + ze_command_list_handle_t command_list, + void *dst_buffer, void *src_buffer, size_t buffer_size, + std::optional remote_engine = {}); void bidirectional_perform_copy(uint32_t dst_device_id, uint32_t src_device_id, uint32_t queue_index, diff --git a/perf_tests/ze_peer/src/ze_peer_unidirectional.cpp b/perf_tests/ze_peer/src/ze_peer_unidirectional.cpp index 58ca53319..8b9bdafe1 100644 --- a/perf_tests/ze_peer/src/ze_peer_unidirectional.cpp +++ b/perf_tests/ze_peer/src/ze_peer_unidirectional.cpp @@ -12,36 +12,34 @@ void ZePeer::perform_copy(peer_test_t test_type, ze_command_queue_handle_t command_queue, void *dst_buffer, void *src_buffer, size_t buffer_size, - ze_command_list_handle_t remote_command_list, - ze_command_queue_handle_t remote_command_queue) { - const bool use_remote_wait = remote_command_list != nullptr; + std::optional remote_engine) { const ze_event_handle_t signal_event = - use_remote_wait ? remote_wait_event : nullptr; + remote_engine ? remote_wait_event : nullptr; SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryCopy(command_list, dst_buffer, src_buffer, buffer_size, signal_event, 0, nullptr)); SUCCESS_OR_TERMINATE(zeCommandListClose(command_list)); - if (use_remote_wait) { - SUCCESS_OR_TERMINATE(zeCommandListAppendWaitOnEvents(remote_command_list, 1, - &remote_wait_event)); - SUCCESS_OR_TERMINATE( - zeCommandListAppendEventReset(remote_command_list, remote_wait_event)); - SUCCESS_OR_TERMINATE(zeCommandListClose(remote_command_list)); + if (remote_engine) { + SUCCESS_OR_TERMINATE(zeCommandListAppendWaitOnEvents( + remote_engine->second, 1, &remote_wait_event)); + SUCCESS_OR_TERMINATE(zeCommandListAppendEventReset(remote_engine->second, + remote_wait_event)); + SUCCESS_OR_TERMINATE(zeCommandListClose(remote_engine->second)); } const auto execute_and_synchronize = [&]() { SUCCESS_OR_TERMINATE(zeCommandQueueExecuteCommandLists( command_queue, 1, &command_list, nullptr)); - if (use_remote_wait) { + if (remote_engine) { SUCCESS_OR_TERMINATE(zeCommandQueueExecuteCommandLists( - remote_command_queue, 1, &remote_command_list, nullptr)); + remote_engine->first, 1, &remote_engine->second, nullptr)); } SUCCESS_OR_TERMINATE(zeCommandQueueSynchronize( command_queue, std::numeric_limits::max())); - if (use_remote_wait) { + if (remote_engine) { SUCCESS_OR_TERMINATE(zeCommandQueueSynchronize( - remote_command_queue, std::numeric_limits::max())); + remote_engine->first, std::numeric_limits::max())); } }; @@ -63,34 +61,33 @@ void ZePeer::perform_copy(peer_test_t test_type, } while (run_continuously); SUCCESS_OR_TERMINATE(zeCommandListReset(command_list)); - if (use_remote_wait) { - SUCCESS_OR_TERMINATE(zeCommandListReset(remote_command_list)); + if (remote_engine) { + SUCCESS_OR_TERMINATE(zeCommandListReset(remote_engine->second)); } } void ZePeer::perform_copy_immediate( peer_test_t test_type, ze_command_list_handle_t command_list, void *dst_buffer, void *src_buffer, size_t buffer_size, - ze_command_list_handle_t remote_command_list) { - const bool use_remote_wait = remote_command_list != nullptr; + std::optional remote_engine) { const ze_event_handle_t signal_event = - use_remote_wait ? remote_wait_event : nullptr; + remote_engine ? remote_wait_event : nullptr; const auto copy_and_synchronize = [&]() { SUCCESS_OR_TERMINATE( zeCommandListAppendMemoryCopy(command_list, dst_buffer, src_buffer, buffer_size, signal_event, 0, nullptr)); - if (use_remote_wait) { + if (remote_engine) { SUCCESS_OR_TERMINATE(zeCommandListAppendWaitOnEvents( - remote_command_list, 1, &remote_wait_event)); - SUCCESS_OR_TERMINATE(zeCommandListAppendEventReset(remote_command_list, + remote_engine->second, 1, &remote_wait_event)); + SUCCESS_OR_TERMINATE(zeCommandListAppendEventReset(remote_engine->second, remote_wait_event)); } SUCCESS_OR_TERMINATE(zeCommandListHostSynchronize( command_list, std::numeric_limits::max())); - if (use_remote_wait) { + if (remote_engine) { SUCCESS_OR_TERMINATE(zeCommandListHostSynchronize( - remote_command_list, std::numeric_limits::max())); + remote_engine->second, std::numeric_limits::max())); } }; @@ -142,20 +139,18 @@ void ZePeer::bandwidth_latency(peer_test_t test_type, initialize_buffers(remote_device_ids, local_device_ids, ze_host_buffer, buffer_size); - ze_command_queue_handle_t remote_command_queue = nullptr; - ze_command_list_handle_t remote_command_list = nullptr; - if (ZePeer::remote_wait) { - // Engine 0 always exists; the power effect of a wait is device specific. - remote_command_queue = ze_peer_devices[remote_device_id].engines[0].first; - remote_command_list = ze_peer_devices[remote_device_id].engines[0].second; - } + // Engine 0 always exists; the power effect of a wait is device specific. + const std::optional remote_engine = + ZePeer::remote_wait + ? std::make_optional(ze_peer_devices[remote_device_id].engines[0]) + : std::nullopt; if (ZePeer::use_immediate_cmdlist) { perform_copy_immediate(test_type, command_list, dst_buffer, src_buffer, - buffer_size, remote_command_list); + buffer_size, remote_engine); } else { perform_copy(test_type, command_list, command_queue, dst_buffer, src_buffer, - buffer_size, remote_command_list, remote_command_queue); + buffer_size, remote_engine); } if (validate_results) { From 3a156e7b14516ad2293c86928213445e932de30c Mon Sep 17 00:00:00 2001 From: "Zhang, Jerry" Date: Mon, 28 Sep 2026 17:07:51 -0700 Subject: [PATCH 3/3] test(ze_peer): add CTest cases for --remote_wait option handling ze_peer parses all options before it opens a device, so the help text and the rejection of --remote_wait in unsupported modes can be tested without a GPU. Add CTest cases that check --help lists --remote_wait and that --remote_wait is rejected with -b, --ipc, --parallel_single_target, --parallel_multiple_targets and --parallel_pair_targets. Each rejection case has a 30 s timeout so a regression that starts a real run fails instead of hanging. Verified with ctest -R ze_peer in a BUILD_ZE_PERF_TESTS_ONLY=1 build: all 6 cases pass, and with the rejection check disabled the 5 rejection cases fail. Signed-off-by: Zhang, Jerry --- perf_tests/ze_peer/CMakeLists.txt | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/perf_tests/ze_peer/CMakeLists.txt b/perf_tests/ze_peer/CMakeLists.txt index 6b62d768d..7bd5faa0b 100644 --- a/perf_tests/ze_peer/CMakeLists.txt +++ b/perf_tests/ze_peer/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2023 Intel Corporation +# Copyright (C) 2019-2026 Intel Corporation # SPDX-License-Identifier: MIT if(UNIX) @@ -23,3 +23,27 @@ add_lzt_test( LINK_LIBRARIES ${OS_SPECIFIC_LIBS} KERNELS ze_peer_benchmarks ) + +# These run without a GPU: options are parsed before any device is opened. +if(TARGET ze_peer) + add_test(NAME ze_peer_help_lists_remote_wait COMMAND ze_peer --help) + set_tests_properties(ze_peer_help_lists_remote_wait + PROPERTIES PASS_REGULAR_EXPRESSION "--remote_wait") + + function(add_ze_peer_remote_wait_reject_test name) + add_test(NAME ze_peer_remote_wait_rejects_${name} + COMMAND ze_peer ${ARGN} --remote_wait) + set_tests_properties(ze_peer_remote_wait_rejects_${name} + PROPERTIES PASS_REGULAR_EXPRESSION "--remote_wait is not supported" + TIMEOUT 30) + endfunction() + + add_ze_peer_remote_wait_reject_test(bidirectional -b) + add_ze_peer_remote_wait_reject_test(ipc --ipc) + add_ze_peer_remote_wait_reject_test(parallel_single_target + --parallel_single_target) + add_ze_peer_remote_wait_reject_test(parallel_multiple_targets + --parallel_multiple_targets) + add_ze_peer_remote_wait_reject_test(parallel_pair_targets + --parallel_pair_targets 0:1) +endif()