diff --git a/level_zero/core/source/context/context.h b/level_zero/core/source/context/context.h index bb28c65df9..68cb56433d 100644 --- a/level_zero/core/source/context/context.h +++ b/level_zero/core/source/context/context.h @@ -36,8 +36,10 @@ struct Context : _ze_context_handle_t { case InternalMemoryType::sharedUnifiedMemory: return ZE_MEMORY_TYPE_SHARED; case InternalMemoryType::deviceUnifiedMemory: + case InternalMemoryType::reservedDeviceMemory: return ZE_MEMORY_TYPE_DEVICE; case InternalMemoryType::hostUnifiedMemory: + case InternalMemoryType::reservedHostMemory: return ZE_MEMORY_TYPE_HOST; default: return ZE_MEMORY_TYPE_UNKNOWN; diff --git a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp index 85c8082b7b..fa15fbc5fd 100644 --- a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp +++ b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp @@ -3414,6 +3414,30 @@ TEST_F(MemoryExportImportFailTest, EXPECT_EQ(ZE_RESULT_SUCCESS, result); } +TEST_F(MemoryExportImportFailTest, + whenParsingMemoryTypeWithValidSpecifidTypeThenCorrectTypeIsReturned) { + + InternalMemoryType memoryType = InternalMemoryType::sharedUnifiedMemory; + ze_memory_type_t usmType = L0::Context::parseUSMType(memoryType); + EXPECT_EQ(usmType, ZE_MEMORY_TYPE_SHARED); + + memoryType = InternalMemoryType::deviceUnifiedMemory; + usmType = L0::Context::parseUSMType(memoryType); + EXPECT_EQ(usmType, ZE_MEMORY_TYPE_DEVICE); + + memoryType = InternalMemoryType::reservedDeviceMemory; + usmType = L0::Context::parseUSMType(memoryType); + EXPECT_EQ(usmType, ZE_MEMORY_TYPE_DEVICE); + + memoryType = InternalMemoryType::reservedHostMemory; + usmType = L0::Context::parseUSMType(memoryType); + EXPECT_EQ(usmType, ZE_MEMORY_TYPE_HOST); + + memoryType = InternalMemoryType::hostUnifiedMemory; + usmType = L0::Context::parseUSMType(memoryType); + EXPECT_EQ(usmType, ZE_MEMORY_TYPE_HOST); +} + TEST_F(MemoryExportImportFailTest, whenParsingMemoryTypeWithNotSpecifidTypeThenUnknownTypeIsReturned) {