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

[VL] Fix std::min params type mismatch in Apple clang 15 #6593

Merged
merged 2 commits into from
Jul 27, 2024

Conversation

zml1206
Copy link
Contributor

@zml1206 zml1206 commented Jul 25, 2024

What changes were proposed in this pull request?

Bug fix

/Users/zml/Desktop/git_hub/incubator-gluten/cpp/velox/shuffle/VeloxSortShuffleWriter.cc:281:24: error: no matching function for call to 'min'
  auto size = std::max(std::min((uint64_t)memLimit >> 2, 64UL * 1024 * 1024), minSizeRequired);

How was this patch tested?

Local test.

Copy link

Thanks for opening a pull request!

Could you open an issue for this pull request on Github Issues?

https://github.com/apache/incubator-gluten/issues

Then could you also rename commit message and pull request title in the following format?

[GLUTEN-${ISSUES_ID}][COMPONENT]feat/fix: ${detailed message}

See also:

@zml1206 zml1206 changed the title [VL] Fix std::min params type mismatch in macOS [VL] Fix std::min params type mismatch in Apple clang 15 Jul 25, 2024
Yohahaha
Yohahaha previously approved these changes Jul 25, 2024
@@ -278,7 +278,7 @@ uint32_t VeloxSortShuffleWriter::maxRowsToInsert(uint32_t offset, uint32_t rows)
}

void VeloxSortShuffleWriter::acquireNewBuffer(int64_t memLimit, uint64_t minSizeRequired) {
auto size = std::max(std::min((uint64_t)memLimit >> 2, 64UL * 1024 * 1024), minSizeRequired);
auto size = std::max(std::min<uint64_t>(memLimit >> 2, 64UL * 1024 * 1024), minSizeRequired);
Copy link
Contributor

Choose a reason for hiding this comment

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

we still need to cast memLimit to uint64_t from int64_t for >>.

Can you check if we can change the memLimit type to uint64_t?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIUC, memLimit should always be a positive number.

Copy link
Contributor

Choose a reason for hiding this comment

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

can you change the data type to uint64_t in the call chains.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

auto size = std::max(std::min<uint64_t>((uint64_t)memLimit >> 2, 64UL * 1024 * 1024), minSizeRequired);
Is this so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or
auto size = std::max(std::min((uint64_t)memLimit >> 2, (uint64_t)64UL * 1024 * 1024), minSizeRequired);

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I mean VeloxSortShuffleWriter::acquireNewBuffer(uint64_t memLimit, uint64_t minSizeRequired)

Also change the data type where acquireNewBuffer is called.

@@ -161,7 +161,7 @@ arrow::Status VeloxSortShuffleWriter::insert(const facebook::velox::RowVectorPtr
auto rows = maxRowsToInsert(rowOffset, remainingRows);
if (rows == 0) {
auto minSizeRequired = fixedRowSize_ ? fixedRowSize_.value() : rowSizes_[rowOffset + 1] - rowSizes_[rowOffset];
acquireNewBuffer(memLimit, minSizeRequired);
acquireNewBuffer((uint64_t)memLimit, minSizeRequired);
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks the callstack is large. Let's merge this one and clean the code later.

@zml1206
Copy link
Contributor Author

zml1206 commented Jul 26, 2024

CI failure seems unrelated. Can you help to re-trigger it individually? Thank you. @FelixYBW

@Yohahaha Yohahaha merged commit bbb2e2f into apache:main Jul 27, 2024
41 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