Skip to content

Commit 9be245c

Browse files
authored
[SYCL][UR][L0 v2] Add env variable to control copy offload (#17721)
Copy offload is not very stable on BMG. Enabling copy offload results in ~40 failing tests. Add option to force disable the feature for easier debugging.
1 parent fae8cc2 commit 9be245c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,29 @@ command_list_cache_t::command_list_cache_t(ze_context_handle_t ZeContext,
5151
: ZeContext{ZeContext},
5252
ZeCopyOffloadExtensionSupported{ZeCopyOffloadExtensionSupported} {}
5353

54+
static bool ForceDisableCopyOffload = [] {
55+
return getenv_tobool("UR_L0_V2_FORCE_DISABLE_COPY_OFFLOAD");
56+
}();
57+
5458
raii::ze_command_list_handle_t
5559
command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) {
5660
ZeStruct<zex_intel_queue_copy_operations_offload_hint_exp_desc_t> offloadDesc;
5761
auto requestedCopyOffload =
5862
std::visit([](auto &&arg) { return arg.CopyOffloadEnabled; }, desc);
5963

64+
if (ForceDisableCopyOffload && requestedCopyOffload) {
65+
logger::info("Copy offload is disabled by the environment variable.");
66+
requestedCopyOffload = false;
67+
}
68+
6069
if (!ZeCopyOffloadExtensionSupported && requestedCopyOffload) {
6170
logger::info(
6271
"Copy offload is requested but is not supported by the driver.");
63-
offloadDesc.copyOffloadEnabled = false;
64-
} else {
65-
offloadDesc.copyOffloadEnabled = requestedCopyOffload;
72+
requestedCopyOffload = false;
6673
}
6774

75+
offloadDesc.copyOffloadEnabled = requestedCopyOffload;
76+
6877
if (auto ImmCmdDesc =
6978
std::get_if<immediate_command_list_descriptor_t>(&desc)) {
7079
ze_command_list_handle_t ZeCommandList;

0 commit comments

Comments
 (0)