Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Reuse temporary memory allocations #478

Merged

Conversation

pgorlani
Copy link
Contributor

@pgorlani pgorlani commented Nov 7, 2023

This patch introduces a pool of temporary memory allocations within the sb_handler, which allows reusing them in order to save re-allocation time.

Copy link
Collaborator

@muhammad-tanvir-1211 muhammad-tanvir-1211 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@pgorlani pgorlani force-pushed the sb_handle-temp-mem-pr branch from d76c669 to 2f5fe4d Compare January 17, 2024 17:13
Copy link
Collaborator

@s-Nick s-Nick left a comment

Choose a reason for hiding this comment

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

Thank you for you work @pgorlani it looks very good to me!
I have some minor comments on it.

include/sb_handle/portblas_handle.h Outdated Show resolved Hide resolved
include/sb_handle/temp_memory_pool.h Show resolved Hide resolved
src/sb_handle/temp_memory_pool.hpp Show resolved Hide resolved
@pgorlani pgorlani force-pushed the sb_handle-temp-mem-pr branch from 2f5fe4d to 9b4ca54 Compare January 25, 2024 14:36
@muhammad-tanvir-1211 muhammad-tanvir-1211 merged commit 9d515e3 into codeplaysoftware:master Jan 25, 2024
3 checks passed
temp_usm_size_map_t temp_usm_size_map_;

template <typename container_t>
void release_buff_mem_(const container_t& mem);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry for the late comment. I think this one should be swapped with the release_usm_mem_ above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in aa1fdf1.

Temp_Mem_Pool(queue_t q)
: q_(q),
temp_buffer_map_tot_byte_size_(0),
temp_usm_map_tot_byte_size_(0) {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

the temp_usm_map_tot_byte_size_ is undefined if SB_ENABLE_USM is not defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in aa1fdf1.

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

Successfully merging this pull request may close these issues.

4 participants