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

fix: Added non-avx path for index transposing #12087

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions velox/exec/tests/OperatorUtilsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,6 @@ TEST_F(OperatorUtilsTest, outputBatchRows) {
}

TEST_F(OperatorUtilsTest, wrapMany) {
#if !XSIMD_WITH_AVX2
GTEST_SKIP();
#endif

// Creates a RowVector with nullable and non-null vectors sharing
// different dictionary wraps. Rewraps these with a new wrap with
// and without nulls. Checks that the outcome has a single level of
Expand Down
23 changes: 19 additions & 4 deletions velox/vector/BaseVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,6 @@ void BaseVector::transposeIndices(
const vector_size_t* wrapIndices,
vector_size_t* resultIndices) {
#if XSIMD_WITH_AVX2

constexpr int32_t kBatch = xsimd::batch<int32_t>::size;
static_assert(kBatch == 8);
static_assert(sizeof(vector_size_t) == sizeof(int32_t));
Expand All @@ -1021,7 +1020,9 @@ void BaseVector::transposeIndices(
.store_unaligned(resultIndices + i);
}
#else
VELOX_NYI();
for (auto i = 0; i < wrapSize; ++i) {
resultIndices[i] = baseIndices[wrapIndices[i]];
}
#endif
}

Expand All @@ -1035,7 +1036,6 @@ void BaseVector::transposeIndicesWithNulls(
vector_size_t* resultIndices,
uint64_t* resultNulls) {
#if XSIMD_WITH_AVX2

constexpr int32_t kBatch = xsimd::batch<int32_t>::size;
static_assert(kBatch == 8);
static_assert(sizeof(vector_size_t) == sizeof(int32_t));
Expand All @@ -1061,7 +1061,22 @@ void BaseVector::transposeIndicesWithNulls(
.store_unaligned(resultIndices + i);
}
#else
VELOX_NYI();
for (auto i = 0; i < wrapSize; ++i) {
auto index = wrapIndices[i];
bool wrapIsNull = wrapNulls && bits::isBitNull(wrapNulls, i);
if (wrapIsNull) {
bits::setNull(resultNulls, i, true);
continue;
}
if (baseNulls) {
if (bits::isBitNull(baseNulls, index)) {
bits::setNull(resultNulls, i, true);
continue;
}
bits::clearNull(resultNulls, i);
resultIndices[i] = baseIndices[index];
Comment on lines +1076 to +1077
Copy link
Contributor

Choose a reason for hiding this comment

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

should this also be done when baseNulls does not exist?

}
}
#endif
}

Expand Down
Loading