File tree Expand file tree Collapse file tree 4 files changed +28
-9
lines changed
tools/source/sysman/memory Expand file tree Collapse file tree 4 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -377,21 +377,21 @@ __zedllexport ze_result_t __zecall
377377zetSysmanMemoryGetProperties (
378378 zet_sysman_mem_handle_t hMemory,
379379 zet_mem_properties_t *pProperties) {
380- return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE ;
380+ return L0::Memory::fromHandle (hMemory)-> memoryGetProperties (pProperties) ;
381381}
382382
383383__zedllexport ze_result_t __zecall
384384zetSysmanMemoryGetState (
385385 zet_sysman_mem_handle_t hMemory,
386386 zet_mem_state_t *pState) {
387- return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE ;
387+ return L0::Memory::fromHandle (hMemory)-> memoryGetState (pState) ;
388388}
389389
390390__zedllexport ze_result_t __zecall
391391zetSysmanMemoryGetBandwidth (
392392 zet_sysman_mem_handle_t hMemory,
393393 zet_mem_bandwidth_t *pBandwidth) {
394- return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE ;
394+ return L0::Memory::fromHandle (hMemory)-> memoryGetBandwidth (pBandwidth) ;
395395}
396396
397397__zedllexport ze_result_t __zecall
Original file line number Diff line number Diff line change 55#
66
77set (L0_SRCS_TOOLS_SYSMAN_MEMORY
8- ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX} /memory.cpp
8+ ${CMAKE_CURRENT_SOURCE_DIR} /memory.cpp
99 ${CMAKE_CURRENT_SOURCE_DIR} /memory.h
1010 ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX} /memory_imp.cpp
11- ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX} /memory_imp.h
11+ ${CMAKE_CURRENT_SOURCE_DIR} /memory_imp.h
1212 ${CMAKE_CURRENT_SOURCE_DIR} /os_memory.h
1313)
1414
Original file line number Diff line number Diff line change 55 *
66 */
77
8- #include " level_zero/tools/ source/sysman/memory/memory .h"
8+ #include " shared/ source/memory_manager/memory_manager .h"
99
10+ #include " level_zero/core/source/device/device.h"
1011#include " level_zero/tools/source/sysman/memory/memory_imp.h"
1112
1213namespace L0 {
@@ -18,13 +19,30 @@ MemoryHandleContext::~MemoryHandleContext() {
1819}
1920
2021ze_result_t MemoryHandleContext::init () {
21- Memory *pMemory = new MemoryImp (pOsSysman, hCoreDevice);
22- handleList.push_back (pMemory);
22+ Device *device = L0::Device::fromHandle (hCoreDevice);
23+
24+ isLmemSupported = device->getDriverHandle ()->getMemoryManager ()->isLocalMemorySupported (device->getRootDeviceIndex ());
25+
26+ if (isLmemSupported) {
27+ Memory *pMemory = new MemoryImp (pOsSysman, hCoreDevice);
28+ handleList.push_back (pMemory);
29+ }
2330 return ZE_RESULT_SUCCESS;
2431}
2532
2633ze_result_t MemoryHandleContext::memoryGet (uint32_t *pCount, zet_sysman_mem_handle_t *phMemory) {
27- *pCount = 0 ;
34+ if (nullptr == phMemory) {
35+ *pCount = static_cast <uint32_t >(handleList.size ());
36+ return ZE_RESULT_SUCCESS;
37+ }
38+ uint32_t i = 0 ;
39+ for (Memory *mem : handleList) {
40+ if (i >= *pCount) {
41+ break ;
42+ }
43+ phMemory[i++] = mem->toHandle ();
44+ }
45+ *pCount = i;
2846 return ZE_RESULT_SUCCESS;
2947}
3048
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ struct MemoryHandleContext {
3939 ze_result_t memoryGet (uint32_t *pCount, zet_sysman_mem_handle_t *phMemory);
4040
4141 OsSysman *pOsSysman;
42+ bool isLmemSupported;
4243 std::vector<Memory *> handleList;
4344 ze_device_handle_t hCoreDevice;
4445};
You can’t perform that action at this time.
0 commit comments