Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e5d8739
Add resident device change call
lslusarczyk Aug 25, 2025
8c54695
added missing doxygen documentation
lslusarczyk Sep 11, 2025
064d1ac
fix documentation spelling
lslusarczyk Sep 12, 2025
c4a7499
applied Rafal's comments
lslusarczyk Sep 12, 2025
588d1af
fixed compilation error
lslusarczyk Sep 12, 2025
b24574c
applied second round of Rafal's comments
lslusarczyk Sep 12, 2025
5983cfa
applied Lukasz's comments
lslusarczyk Sep 15, 2025
5cbbad2
one more missed Lukasz comment applied
lslusarczyk Sep 15, 2025
c27407a
added some tests for resident device feature
lslusarczyk Sep 15, 2025
53ec753
add unittests and refactor to be backward compatible
lslusarczyk Sep 16, 2025
01d74ba
moved umfMemoryProviderResidentDeviceChange down
lslusarczyk Sep 19, 2025
0bc9a29
added empty line for Rafal :)
lslusarczyk Sep 19, 2025
d13a3ef
cmake format fixed
lslusarczyk Sep 19, 2025
272bd66
Lukasz and Rafal comments applied
lslusarczyk Sep 22, 2025
cabd5e7
fix log test
lslusarczyk Sep 22, 2025
7de5b15
removed usless ext_resident_device_change from memory_pool
lslusarczyk Sep 22, 2025
32ebea7
use umfLevelZeroMemoryProviderResidentDeviceChange instead of ops
lslusarczyk Sep 22, 2025
50db5c5
reverted log change as it was moved to different PR
lslusarczyk Sep 22, 2025
780794c
removed accidental changes
lslusarczyk Sep 22, 2025
4f75bca
fix doc
lslusarczyk Sep 22, 2025
9f1c588
applied Lukasz S. comments
lslusarczyk Sep 23, 2025
3f4db4f
change ze_api include due to windows compile error
lslusarczyk Sep 23, 2025
cf4254a
fix link in windows
lslusarczyk Sep 23, 2025
7bd5c24
not using utils_log in ze_loopback
lslusarczyk Sep 24, 2025
dbb8298
fix includes for level_zero_mocks.cpp
lslusarczyk Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/umf/memory_pool_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ typedef struct umf_memory_pool_ops_t {
///
/// @return umf_result_t result of the control operation.
///
umf_result_t (*ext_ctl)(void *hPool, umf_ctl_query_source_t source,
umf_result_t (*ext_ctl)(void *pool, umf_ctl_query_source_t source,
const char *name, void *arg, size_t size,
umf_ctl_query_type_t queryType, va_list args);

Expand Down
13 changes: 13 additions & 0 deletions include/umf/providers/provider_level_zero.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#ifndef UMF_LEVEL_ZERO_PROVIDER_H
#define UMF_LEVEL_ZERO_PROVIDER_H

#include <stdbool.h>

#include <umf/memory_provider_gpu.h>

#ifdef __cplusplus
Expand Down Expand Up @@ -101,6 +103,17 @@ umf_result_t umfLevelZeroMemoryProviderParamsSetDeviceOrdinal(
umf_result_t umfLevelZeroMemoryProviderParamsSetName(
umf_level_zero_memory_provider_params_handle_t hParams, const char *name);

/// @brief Adds or removes devices on which allocations should be made
/// resident.
/// @param provider handle to the memory provider
/// @param device device handle
/// @param is_adding Boolean indicating if peer is to be removed or added
/// @return UMF_RESULT_SUCCESS on success or appropriate error code on
/// failure.
umf_result_t umfLevelZeroMemoryProviderResidentDeviceChange(
umf_memory_provider_handle_t provider, ze_device_handle_t device,
bool is_adding);

const umf_memory_provider_ops_t *umfLevelZeroMemoryProviderOps(void);

#ifdef __cplusplus
Expand Down
15 changes: 14 additions & 1 deletion src/critnib/critnib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,8 @@ int critnib_find(struct critnib *c, uintptr_t key, enum find_dir_t dir,
*
* If func() returns non-zero, the search is aborted.
*/
static int iter(struct critnib_node *__restrict n, word min, word max,
static int iter(struct critnib_node *__restrict n, const word min,
const word max,
int (*func)(word key, void *value, void *privdata),
void *privdata) {
if (is_leaf(n)) {
Expand Down Expand Up @@ -1129,9 +1130,21 @@ static int iter(struct critnib_node *__restrict n, word min, word max,
void critnib_iter(critnib *c, uintptr_t min, uintptr_t max,
int (*func)(uintptr_t key, void *value, void *privdata),
void *privdata) {
bool wasIterating = false;
utils_mutex_lock(&c->mutex);
if (c->root) {
iter(c->root, min, max, func, privdata);
wasIterating = true;
}
utils_mutex_unlock(&c->mutex);
if (!wasIterating) {
LOG_DEBUG("there was no root, iterating critnib: %p was skipped",
(void *)c);
}
}

void critnib_iter_all(critnib *c,
int (*func)(uintptr_t key, void *value, void *privdata),
void *privdata) {
critnib_iter(c, 0, (uintptr_t)-1, func, privdata);
}
4 changes: 4 additions & 0 deletions src/critnib/critnib.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ int critnib_insert(critnib *c, uintptr_t key, void *value, int update);
void critnib_iter(critnib *c, uintptr_t min, uintptr_t max,
int (*func)(uintptr_t key, void *value, void *privdata),
void *privdata);
void critnib_iter_all(critnib *c,
int (*func)(uintptr_t key, void *value, void *privdata),
void *privdata);

int critnib_remove_release(critnib *c, uintptr_t key);

/*
Expand Down
1 change: 1 addition & 0 deletions src/libumf.def
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ EXPORTS
umfLevelZeroMemoryProviderParamsSetDevice
umfLevelZeroMemoryProviderParamsSetMemoryType
umfLevelZeroMemoryProviderParamsSetResidentDevices
umfLevelZeroMemoryProviderResidentDeviceChange
umfMemoryProviderAlloc
umfMemoryProviderAllocationMerge
umfMemoryProviderAllocationSplit
Expand Down
1 change: 1 addition & 0 deletions src/libumf.map
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ UMF_1.1 {
umfGetMemoryPropertySize;
umfJemallocPoolParamsSetName;
umfLevelZeroMemoryProviderParamsSetName;
umfLevelZeroMemoryProviderResidentDeviceChange;
umfOsMemoryProviderParamsSetName;
umfPoolTrimMemory;
umfScalablePoolParamsSetName;
Expand Down
Loading
Loading