8000 add umfPoolTrimMemory by bratpiorka · Pull Request #1318 · oneapi-src/unified-memory-framework · GitHub
[go: up one dir, main page]

Skip to content

add umfPoolTrimMemory #1318

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bratpiorka
Copy link
Contributor
@bratpiorka bratpiorka commented May 15, 2025

implement umfPoolTrimMemory

@bratpiorka bratpiorka changed the title [POC] add umfDisjointPoolTrimMemory [POC] trim Jun 16, 2025
@bratpiorka bratpiorka force-pushed the rrudnick_dp_trim branch 3 times, most recently from 4a3b48f to 4dee8a2 Compare June 18, 2025 07:25
@bratpiorka bratpiorka force-pushed the rrudnick_dp_trim branch 2 times, most recently from a699662 to c151a5c Compare July 21, 2025 13:26
@bratpiorka bratpiorka changed the title [POC] trim add umfDisjointPoolTrimMemory Jul 21, 2025
@bratpiorka bratpiorka marked this pull request as ready for review July 21, 2025 13:28
@bratpiorka bratpiorka requested a review from a team as a code owner July 21, 2025 13:28
Comment on lines 1138 to 1140
if (hPool == NULL) {
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you introduce UMF_CHECK above, please apply it here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to assert as this is checked in the upper layer

Comment on lines 330 to 332
// TODO enable jemalloc pool tests
//poolCreateExtParams{umfJemallocPoolOps(), nullptr, nullptr,
// &BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct indentation and add information when it should be enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed + created an issue #1455

ops->ext_trim_memory(pool, pool->buckets[0]->size);
EXPECT_EQ(pool->buckets[0]->available_slabs_num, 1);
EXPECT_EQ(pool->buckets[0]->curr_slabs_in_pool, 1);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps add testing various values of minBytesToKeep

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added new case with 3 * slab_size to keep

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, but now the CI is failing...? ;)

@lukaszstolarczuk lukaszstolarczuk changed the title add umfDisjointPoolTrimMemory add umfPoolTrimMemory Jul 22, 2025
@bratpiorka bratpiorka force-pushed the rrudnick_dp_trim branch 2 times, most recently from 6d877f9 to c523215 Compare July 22, 2025 10:56
@bratpiorka bratpiorka force-pushed the rrudnick_dp_trim branch 7 times, most recently from 02c6e96 to c2a5994 Compare July 23, 2025 08:48
disjoint_pool_t *hPool = (disjoint_pool_t *)pool;

// tracking the number of bytes left to keep
int bytesLeftToKeep = (int)minBytesToKeep;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cast from 8 byte unsigned variable to 4 byte signed variable

(void)pool; // unused
(void)minBytesToKeep; // unused

return UMF_RESULT_SUCCESS;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically it is success, as this function has no promises, but for me it is ERROR NONSUPPORTED

Comment on lines +405 to +411
// use CTL to get the current memory pool size (if supported)
size_t reserved_memory1 = 0;
ret = umfCtlGet("umf.pool.by_handle.{}.stats.reserved_memory",
&reserved_memory1, sizeof(size_t), hPool);
if (ret == UMF_RESULT_SUCCESS) {
ASSERT_GE(reserved_memory1, 0ull);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It supported by all pools now

ret = umfCtlGet("umf.pool.by_handle.{}.stats.reserved_memory",
&reserved_memory2, sizeof(size_t), hPool);
if (ret == UMF_RESULT_SUCCESS) {
ASSERT_EQ(reserved_memory2, 0ull);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this test work with tbbpool - it does nothing on trim so this test should fail. Why it is not failing?

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

Successfully merging this pull request may close these issues.

6 participants
0