Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace critnib with a RAVL tree to track allocations in providers #1045

Open
lplewa opened this issue Jan 17, 2025 · 1 comment
Open

Replace critnib with a RAVL tree to track allocations in providers #1045

lplewa opened this issue Jan 17, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@lplewa
Copy link
Contributor

lplewa commented Jan 17, 2025

This is a rough idea - I'm not 100% sure that this solution will not have any disadvantages.

Currently, on every split or merge, we add and remove entries from critnib structures to track allocations at various levels. This proposal suggests replacing those structures with a RAVL tree instead.

A key advantage of using a RAVL tree is the ability to search for a key that is equal to or lower than a specified value. After a split, this feature allows reusing the original entry in the tree, eliminating the need to update it. As a result, overall performance is improved by reducing the overhead of frequent insertions and deletions. In addition, a RAVL tree will be smaller, which further enhances search times.

@lplewa lplewa added the enhancement New feature or request label Jan 17, 2025
@igchor
Copy link
Member

igchor commented Jan 17, 2025

I believe that currently, we do update + insert in the split and only update in merge (see https://github.com/oneapi-src/unified-memory-framework/blob/main/src/provider/provider_tracking.c#L318C30-L318C66). How would using RAVL improve this?

Critnib also allows you to search for key that is equal or lower: https://github.com/oneapi-src/unified-memory-framework/blob/main/src/critnib/critnib.h#L36

Also, I'm not sure if RAVL would be smaller - it's a binary tree and critnib has a branching factor of 16 (although the number of level for critnib will depend on how similar are the keys).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants