Skip to content

Add TBB pool manager with tests #56

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

Merged
merged 1 commit into from
Dec 28, 2023

Conversation

ldorau
Copy link
Contributor

@ldorau ldorau commented Dec 5, 2023

No description provided.

@ldorau ldorau force-pushed the Add_TBB_pool_manager branch 2 times, most recently from 01edfa5 to 4e29509 Compare December 5, 2023 08:44
struct tbb_memory_pool *pool = (struct tbb_memory_pool *)pool_id;
enum umf_result_t ret =
umfMemoryProviderFree(pool->mem_provider, ptr, bytes);
if (ret != UMF_RESULT_SUCCESS) {
Copy link
Member

Choose a reason for hiding this comment

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

Not really related to this PR, but wouldn't it be better to just implement a 'logging' memory provider (and perhaps a pool as well) that we could wrap around the actual provider (similarly to how we use tracking memory provider)? This way we wouldn't have to add those logs everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there already is a task for that in our Jira, isn't there @bratpiorka ?


void tbb_raw_free_wrapper(intptr_t pool_id, void *ptr, size_t bytes) {
struct tbb_memory_pool *pool = (struct tbb_memory_pool *)pool_id;
enum umf_result_t ret =
Copy link
Member

@igchor igchor Dec 5, 2023

Choose a reason for hiding this comment

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

Probably we should store the error in TLS and return it from tbb_free if necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get_last_allocation_error() retrieves umf_result_t representing the error of the last failed allocation operation in this thread (malloc, calloc, realloc, aligned_malloc) - not free.

Copy link
Member

Choose a reason for hiding this comment

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

That's true, but we can return the result directly from umfPoolFree (tbb_free). Right now we always return SUCCESS from what I see.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In tbb_free() yes, we can, but a return value of pool_free() is never used or checked in the TBB repo ... Done anyway.

@ldorau ldorau force-pushed the Add_TBB_pool_manager branch 4 times, most recently from 21b7e9e to 0359feb Compare December 22, 2023 11:25
@ldorau ldorau changed the title [DRAFT] Add TBB pool manager [DRAFT] Add TBB pool manager with tests Dec 22, 2023
@ldorau
Copy link
Contributor Author

ldorau commented Dec 22, 2023

Tests added

@ldorau ldorau force-pushed the Add_TBB_pool_manager branch 7 times, most recently from b6bb1f1 to dbaccbb Compare December 22, 2023 11:54
@ldorau ldorau changed the title [DRAFT] Add TBB pool manager with tests Add TBB pool manager with tests Dec 22, 2023
@ldorau ldorau marked this pull request as ready for review December 22, 2023 11:54
@ldorau ldorau requested a review from a team as a code owner December 22, 2023 11:54
@ldorau
Copy link
Contributor Author

ldorau commented Dec 22, 2023

Ready for review

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@ldorau ldorau force-pushed the Add_TBB_pool_manager branch from dbaccbb to f698c69 Compare December 22, 2023 14:37
@ldorau ldorau mentioned this pull request Dec 22, 2023
1 task
@ldorau ldorau force-pushed the Add_TBB_pool_manager branch 2 times, most recently from ff53b9a to 3899571 Compare December 27, 2023 15:31
@ldorau ldorau force-pushed the Add_TBB_pool_manager branch 3 times, most recently from 1b78fed to 647b388 Compare December 28, 2023 10:45
}

pool_data->mem_provider = provider;
g_tbb_ops.pool_create_v1((intptr_t)pool_data, &policy,
Copy link
Member

Choose a reason for hiding this comment

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

this functions returns a status, shouldn't we check it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@ldorau ldorau force-pushed the Add_TBB_pool_manager branch 3 times, most recently from fabc8bb to ea0c8f3 Compare December 28, 2023 16:19
@ldorau ldorau force-pushed the Add_TBB_pool_manager branch from ea0c8f3 to 656e509 Compare December 28, 2023 16:22
@igchor igchor merged commit f0c40f3 into oneapi-src:main Dec 28, 2023
@ldorau ldorau deleted the Add_TBB_pool_manager branch December 28, 2023 16:55
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.

4 participants