Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -154,6 +154,7 @@ EXPORTS
umfGetMemoryPropertySize
umfJemallocPoolParamsSetName
umfLevelZeroMemoryProviderParamsSetName
umfLevelZeroMemoryProviderResidentDeviceChange
umfOsMemoryProviderParamsSetName
umfPoolTrimMemory
umfScalablePoolParamsSetName
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