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

TEST/UCP: Meet aligned_alloc requirements for requested size #9534

Merged
merged 2 commits into from
Dec 17, 2023

Conversation

ivankochin
Copy link
Contributor

What

Make message size divisible to page size.

Why ?

aligned_alloc requires that allocated size should be divisible to alignment

cppreference:

Allocate size bytes of uninitialized storage whose alignment is specified by alignment. The size parameter must be an integral multiple of alignment.

Found by ASAN.


EXPECT_TRUE(ucs_is_pow2(chunk_size) && ucs_is_pow2(page_size)) <<
"message size should be aligned to both page and chunk sizes";
size_t alignment = ucs_max(chunk_size, page_size);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think chunk_size may be not a power of 2 - if num_lanes is not a power of 2
maybe alignment = ucs_max(page_size, UCS_SYS_PCI_MAX_PAYLOAD) * num_lanes()

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.

@ivankochin ivankochin requested a review from yosefe December 7, 2023 08:14
@ivankochin ivankochin requested a review from brminich December 12, 2023 07:09
yosefe
yosefe previously approved these changes Dec 12, 2023
brminich
brminich previously approved these changes Dec 12, 2023
@ivankochin ivankochin force-pushed the test/ucp/align-msg-size-to-page branch from 02d3219 to c110286 Compare December 13, 2023 05:12
@ivankochin ivankochin enabled auto-merge December 13, 2023 05:12
@ivankochin ivankochin dismissed stale reviews from brminich and yosefe via a341195 December 14, 2023 09:46
Copy link
Contributor

@yosefe yosefe left a comment

Choose a reason for hiding this comment

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

pls squash

@ivankochin ivankochin merged commit 9dbff62 into openucx:master Dec 17, 2023
117 checks passed
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.

3 participants