Skip to content

Conversation

@westonpace
Copy link
Member

@westonpace westonpace commented May 31, 2023

Rationale for this change

There is a bug in the version of mimalloc that we currently vendor (2.0.6) which is microsoft/mimalloc#700

This bug causes aligned allocations to be improperly aligned if the requested alignment is greater than 128 and less than 1024. The allocations are always given 128 byte alignment. This also only seems to affect release mode.

In practice, we never actually request alignment greater than 128 bytes. However, there was a test case that was requesting alignment of 256 bytes. Since this bug only affects a test case I'm not sure it warrants upgrading the mimalloc version (though we might want to do so at some point for other reasons).

One could argue that memory pool is a part of our public interface and so this is a bug in a public method (the ability to allocate an aligned buffer) though users are welcome to use a newer version of mimalloc on their own.

What changes are included in this PR?

The test is modified to request 128 byte alignment instead of 256 byte alignment

Are these changes tested?

I was able to reproduce the issue on my Linux system by compiling in release mode and using mimalloc. I verified that upgrading mimalloc to 2.1.0 prevented the bug. The fix itself is a test case and so the change is tested.

Are there any user-facing changes?

No.

@github-actions
Copy link

⚠️ GitHub issue #35820 has been automatically assigned in GitHub to PR creator.

@github-actions
Copy link

⚠️ GitHub issue #35820 has no components, please add labels for components.

…ned allocations greater than 128 bytes and less than 1024 bytes. Our test was doing this but we never actually need this in our library code itself. So, instead, I changed the test to align to 128 bytes which still achieves the purpose of the test.
@westonpace westonpace force-pushed the bugfix/GH-35820--mimalloc-alignment-bug branch from ab4c9ec to 3774325 Compare May 31, 2023 06:56
@westonpace
Copy link
Member Author

Apologies for the over-zealous labeling. I was originally rebased off the maint branch. I've adjusted to the main branch.

@westonpace
Copy link
Member Author

@github-actions crossbow submit test-build-vcpkg-win

@github-actions
Copy link

Revision: 3774325

Submitted crossbow builds: ursacomputing/crossbow @ actions-f7be1360b7

Task Status
test-build-vcpkg-win Github Actions

@westonpace westonpace requested review from bkietz and raulcd May 31, 2023 07:03
@westonpace westonpace added this to the 12.0.1 milestone May 31, 2023
Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

This certainly looks good enough to me.

@pitrou pitrou merged commit 95df6cc into apache:main May 31, 2023
raulcd pushed a commit that referenced this pull request May 31, 2023
…win (#35834)

### Rationale for this change

There is a bug in the version of mimalloc that we currently vendor (2.0.6) which is microsoft/mimalloc#700

This bug causes aligned allocations to be improperly aligned if the requested alignment is greater than 128 and less than 1024.  The allocations are always given 128 byte alignment.  This also only seems to affect release mode.

In practice, we never actually request alignment greater than 128 bytes.  However, there was a test case that was requesting alignment of 256 bytes.  Since this bug only affects a test case I'm not sure it warrants upgrading the mimalloc version (though we might want to do so at some point for other reasons).

One could argue that memory pool is a part of our public interface and so this is a bug in a public method (the ability to allocate an aligned buffer) though users are welcome to use a newer version of mimalloc on their own.

### What changes are included in this PR?

The test is modified to request 128 byte alignment instead of 256 byte alignment

### Are these changes tested?

I was able to reproduce the issue on my Linux system by compiling in release mode and using mimalloc.  I verified that upgrading mimalloc to 2.1.0 prevented the bug.  The fix itself is a test case and so the change is tested.

### Are there any user-facing changes?

No.
* Closes: #35820

Authored-by: Weston Pace <weston.pace@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
@ursabot
Copy link

ursabot commented Jun 1, 2023

Benchmark runs are scheduled for baseline = 89b1ebe and contender = 95df6cc. 95df6cc is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Finished ⬇️0.47% ⬆️0.03%] test-mac-arm
[Finished ⬇️1.95% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.51% ⬆️0.06%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] 95df6cc0 ec2-t3-xlarge-us-east-2
[Finished] 95df6cc0 test-mac-arm
[Finished] 95df6cc0 ursa-i9-9960x
[Finished] 95df6cc0 ursa-thinkcentre-m75q
[Finished] 89b1ebe2 ec2-t3-xlarge-us-east-2
[Finished] 89b1ebe2 test-mac-arm
[Finished] 89b1ebe2 ursa-i9-9960x
[Finished] 89b1ebe2 ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++][CI] EnsureAlignment.Buffer fails on test-build-vcpkg-win

3 participants