Skip to content

Commit c71dce2

Browse files
committed
removed findDriverExtension().
Signed-off-by: rbegam <[email protected]>
1 parent d339e4c commit c71dce2

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ static sycl::detail::SpinLock *PiPlatformsCacheMutex =
278278
new sycl::detail::SpinLock;
279279
static bool PiPlatformCachePopulated = false;
280280

281+
// Keeps track if the global offset extension is found
282+
static bool PiDriverGlobalOffsetExtensionFound = false;
283+
281284
// TODO:: In the following 4 methods we may want to distinguish read access vs.
282285
// write (as it is OK for multiple threads to read the map without locking it).
283286

@@ -1129,17 +1132,19 @@ pi_result _pi_platform::initialize() {
11291132
uint32_t Count = 0;
11301133
ZE_CALL(zeDriverGetExtensionProperties, (ZeDriver, &Count, nullptr));
11311134

1132-
if (Count == 0) {
1133-
zePrint("No extensions supported on this driver\n");
1134-
return PI_INVALID_VALUE;
1135-
}
1136-
11371135
std::vector<ze_driver_extension_properties_t> zeExtensions(Count);
11381136

11391137
ZE_CALL(zeDriverGetExtensionProperties,
11401138
(ZeDriver, &Count, zeExtensions.data()));
11411139

11421140
for (auto extension : zeExtensions) {
1141+
// Check if global offset extension is available
1142+
if (strncmp(extension.name, ZE_GLOBAL_OFFSET_EXP_NAME,
1143+
strlen(ZE_GLOBAL_OFFSET_EXP_NAME)) == 0) {
1144+
if (extension.version == ZE_GLOBAL_OFFSET_EXP_VERSION_1_0) {
1145+
PiDriverGlobalOffsetExtensionFound = true;
1146+
}
1147+
}
11431148
zeDriverExtensionMap[extension.name] = extension.version;
11441149
}
11451150

@@ -1347,16 +1352,6 @@ pi_result piextPlatformCreateWithNativeHandle(pi_native_handle NativeHandle,
13471352
return PI_INVALID_VALUE;
13481353
}
13491354

1350-
bool _pi_platform::findDriverExtension(
1351-
const ze_driver_extension_properties_t zeExtension) {
1352-
if (zeDriverExtensionMap.find(zeExtension.name) !=
1353-
zeDriverExtensionMap.end()) {
1354-
return (zeDriverExtensionMap[zeExtension.name] == zeExtension.version);
1355-
}
1356-
1357-
return false;
1358-
}
1359-
13601355
// Get the cahched PI device created for the L0 device handle.
13611356
// Return NULL if no such PI device found.
13621357
pi_device _pi_platform::getDeviceFromNativeHandle(ze_device_handle_t ZeDevice) {
@@ -3776,11 +3771,7 @@ piEnqueueKernelLaunch(pi_queue Queue, pi_kernel Kernel, pi_uint32 WorkDim,
37763771
PI_ASSERT((WorkDim > 0) && (WorkDim < 4), PI_INVALID_WORK_DIMENSION);
37773772

37783773
if (GlobalWorkOffset != NULL) {
3779-
ze_driver_extension_properties_t GlobalOffsetExtension{
3780-
ZE_GLOBAL_OFFSET_EXP_NAME, ZE_GLOBAL_OFFSET_EXP_VERSION_1_0};
3781-
3782-
auto Platform = Queue->Device->Platform;
3783-
if (!(Platform->findDriverExtension(GlobalOffsetExtension))) {
3774+
if (!PiDriverGlobalOffsetExtensionFound) {
37843775
zePrint("No global offset extension found on this driver\n");
37853776
return PI_INVALID_VALUE;
37863777
}

sycl/plugins/level_zero/pi_level_zero.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ struct _pi_platform {
8181

8282
// Cache driver extensions
8383
std::unordered_map<std::string, uint32_t> zeDriverExtensionMap;
84-
bool findDriverExtension(const ze_driver_extension_properties_t zeExtension);
8584

8685
// Cache pi_devices for reuse
8786
std::vector<std::unique_ptr<_pi_device>> PiDevicesCache;

0 commit comments

Comments
 (0)