Skip to content

Commit d2c6283

Browse files
fix(ocl): add support for deprecated value of CL_MEM_DEVICE_ID_INTEL
Resolves: NEO-10184, NEO-10195, NEO-10196 Resolves: NEO-10200, NEO-10205, NEO-10207 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 58eaece commit d2c6283

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

opencl/extensions/public/cl_ext_private.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ using cl_unified_shared_memory_type_intel = cl_uint;
7272
#define CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE (1 << 25)
7373
#define CL_MEM_48BIT_RESOURCE_INTEL (1 << 26)
7474

75+
#define CL_MEM_DEVICE_ID_INTEL_DEPRECATED 0x10011
76+
7577
// Used with clEnqueueVerifyMemory
7678
#define CL_MEM_COMPARE_EQUAL 0u
7779
#define CL_MEM_COMPARE_NOT_EQUAL 1u

opencl/source/helpers/cl_memory_properties_helpers.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ bool ClMemoryPropertiesHelper::parseMemoryProperties(const cl_mem_properties_int
3737
case CL_MEM_ALLOC_FLAGS_INTEL:
3838
allocflags |= static_cast<cl_mem_alloc_flags_intel>(properties[i + 1]);
3939
break;
40+
case CL_MEM_DEVICE_ID_INTEL_DEPRECATED:
4041
case CL_MEM_DEVICE_ID_INTEL: {
4142
if (deviceSet) {
4243
return false;

opencl/test/unit_test/mem_obj/mem_obj_helper_tests.cpp

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2023 Intel Corporation
2+
* Copyright (C) 2018-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -292,6 +292,45 @@ TEST(MemObjHelperMultiTile, givenOneSubDeviceSelectedWhenParsingMemoryProperties
292292
EXPECT_FALSE(parseMemoryProperties(deviceFactory.subDevices[1], tile0Context));
293293
EXPECT_FALSE(parseMemoryProperties(deviceFactory.subDevices[1], rootContext));
294294
}
295+
TEST(MemObjHelperMultiTile, givenOneSubDeviceSelectedWithDeprecatedFlagWhenParsingMemoryPropertiesThenTrueIsReturnedForValidContexts) {
296+
UltClDeviceFactory deviceFactory{1, 4};
297+
298+
cl_device_id rootDeviceId = deviceFactory.rootDevices[0];
299+
MockContext rootContext(ClDeviceVector{&rootDeviceId, 1});
300+
301+
cl_device_id tile0Id = deviceFactory.subDevices[0];
302+
MockContext tile0Context(ClDeviceVector{&tile0Id, 1});
303+
304+
cl_device_id tile1Id = deviceFactory.subDevices[1];
305+
MockContext tile1Context(ClDeviceVector{&tile1Id, 1});
306+
307+
cl_device_id allDevices[] = {deviceFactory.rootDevices[0], deviceFactory.subDevices[0], deviceFactory.subDevices[1],
308+
deviceFactory.subDevices[2], deviceFactory.subDevices[3]};
309+
MockContext multiTileContext(ClDeviceVector{allDevices, 5});
310+
311+
EXPECT_EQ(deviceFactory.rootDevices[0]->getDeviceBitfield(), multiTileContext.getDevice(0)->getDeviceBitfield());
312+
313+
auto parseMemoryProperties = [](ClDevice *pClDevice, Context &context) -> bool {
314+
cl_mem_flags flags = 0;
315+
cl_mem_flags_intel flagsIntel = 0;
316+
cl_mem_alloc_flags_intel allocFlagsIntel = 0;
317+
MemoryProperties memoryProperties{0};
318+
auto deviceIdProperty = reinterpret_cast<cl_mem_properties_intel>(static_cast<cl_device_id>(pClDevice));
319+
cl_mem_properties_intel properties[] = {CL_MEM_DEVICE_ID_INTEL_DEPRECATED, deviceIdProperty, 0};
320+
return ClMemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocFlagsIntel,
321+
ClMemoryPropertiesHelper::ObjType::buffer, context);
322+
};
323+
324+
EXPECT_TRUE(parseMemoryProperties(deviceFactory.subDevices[0], multiTileContext));
325+
EXPECT_TRUE(parseMemoryProperties(deviceFactory.subDevices[0], tile0Context));
326+
EXPECT_FALSE(parseMemoryProperties(deviceFactory.subDevices[0], tile1Context));
327+
EXPECT_FALSE(parseMemoryProperties(deviceFactory.subDevices[0], rootContext));
328+
329+
EXPECT_TRUE(parseMemoryProperties(deviceFactory.subDevices[1], multiTileContext));
330+
EXPECT_TRUE(parseMemoryProperties(deviceFactory.subDevices[1], tile1Context));
331+
EXPECT_FALSE(parseMemoryProperties(deviceFactory.subDevices[1], tile0Context));
332+
EXPECT_FALSE(parseMemoryProperties(deviceFactory.subDevices[1], rootContext));
333+
}
295334

296335
TEST(MemObjHelper, givenInvalidFlagsWhenValidatingExtraPropertiesThenFalseIsReturned) {
297336
MemoryProperties memoryProperties;

0 commit comments

Comments
 (0)