-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: support explicit memory locking
Added lockMemory in context to explicitly locking memory, Added a boolean flag in graphics_allocation to indicate the allocation is locked, and modified memory_operations_handler to add lock(). Related-To: NEO-8277 Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
- Loading branch information
1 parent
15420aa
commit d6a14d4
Showing
49 changed files
with
615 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (C) 2024 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
*/ | ||
|
||
#include "level_zero/core/source/context/context_imp.h" | ||
#include "level_zero/core/source/device/device.h" | ||
#include "level_zero/core/source/driver/driver_handle_imp.h" | ||
|
||
namespace L0 { | ||
|
||
ze_result_t ContextImp::lockMemory(ze_device_handle_t device, void *ptr, size_t size) { | ||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; | ||
} | ||
|
||
} // namespace L0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
level_zero/core/test/unit_tests/sources/context/test_context_helper.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (C) 2023-2024 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
*/ | ||
|
||
#include "shared/source/execution_environment/root_device_environment.h" | ||
#include "shared/source/os_interface/os_interface.h" | ||
#include "shared/test/common/mocks/mock_builtins.h" | ||
#include "shared/test/common/mocks/mock_device.h" | ||
#include "shared/test/common/mocks/mock_driver_model.h" | ||
#include "shared/test/common/mocks/mock_memory_operations_handler.h" | ||
#include "shared/test/common/test_macros/test.h" | ||
|
||
#include "level_zero/core/source/context/context_imp.h" | ||
#include "level_zero/core/source/driver/driver_handle_imp.h" | ||
#include "level_zero/core/source/driver/driver_imp.h" | ||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" | ||
#include "level_zero/core/test/unit_tests/fixtures/host_pointer_manager_fixture.h" | ||
#include "level_zero/core/test/unit_tests/mocks/mock_driver_handle.h" | ||
|
||
#include "gtest/gtest.h" | ||
namespace L0 { | ||
namespace ult { | ||
|
||
using ContextLockMemoryTests = Test<HostPointerManagerFixure>; | ||
|
||
TEST_F(ContextLockMemoryTests, givenValidPointerWhenCallingLockMemoryThenUnsupportedErrorIsReturned) { | ||
const size_t size = 4096; | ||
void *ptr = nullptr; | ||
ze_device_mem_alloc_desc_t deviceDesc = {}; | ||
ze_result_t res = context->allocDeviceMem(device->toHandle(), | ||
&deviceDesc, | ||
size, | ||
0, | ||
&ptr); | ||
EXPECT_EQ(ZE_RESULT_SUCCESS, res); | ||
|
||
mockMemoryInterface->lockResult = NEO::MemoryOperationsStatus::success; | ||
res = context->lockMemory(device, ptr, size); | ||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, res); | ||
|
||
context->freeMem(ptr); | ||
} | ||
|
||
} // namespace ult | ||
} // namespace L0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.