Skip to content

Commit 004f38e

Browse files
authored
[SYCL][UR][L0] Fix handling of UR_ADAPTERS_FORCE_LOAD (#19477)
The change making L0 v2 adapter default for BMG broke handling of UR_ADAPTERS_FORCE_LOAD. Depending on the platform, urAdapterGet could return 0 available adapter even if force loadded.
1 parent 5e16c5d commit 004f38e

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

unified-runtime/source/adapters/level_zero/adapter.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -503,19 +503,22 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
503503

504504
PlatformVec platforms;
505505

506+
bool forceLoadedAdapter = ur_getenv("UR_ADAPTERS_FORCE_LOAD").has_value();
507+
if (!forceLoadedAdapter) {
506508
#ifdef UR_ADAPTER_LEVEL_ZERO_V2
507-
auto [useV2, reason] = shouldUseV2Adapter();
508-
if (!useV2) {
509-
UR_LOG(INFO, "Skipping L0 V2 adapter: {}", reason);
510-
return;
511-
}
509+
auto [useV2, reason] = shouldUseV2Adapter();
510+
if (!useV2) {
511+
UR_LOG(INFO, "Skipping L0 V2 adapter: {}", reason);
512+
return;
513+
}
512514
#else
513-
auto [useV1, reason] = shouldUseV1Adapter();
514-
if (!useV1) {
515-
UR_LOG(INFO, "Skipping L0 V1 adapter: {}", reason);
516-
return;
517-
}
515+
auto [useV1, reason] = shouldUseV1Adapter();
516+
if (!useV1) {
517+
UR_LOG(INFO, "Skipping L0 V1 adapter: {}", reason);
518+
return;
519+
}
518520
#endif
521+
}
519522

520523
// Check if the user has enabled the default L0 SysMan initialization.
521524
const int UrSysmanZesinitEnable = [&UserForcedSysManInit] {

0 commit comments

Comments
 (0)