Skip to content

Commit 9850943

Browse files
Jialiang Tanfacebook-github-bot
Jialiang Tan
authored andcommitted
added non-avx path
Summary: This diff creates a different transposeIndex path if XSIMD_WITH_AVX2 is not present. Previously it was simply not supported. Differential Revision: D67659247
1 parent 5c770df commit 9850943

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

velox/exec/tests/OperatorUtilsTest.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,6 @@ TEST_F(OperatorUtilsTest, outputBatchRows) {
533533
}
534534

535535
TEST_F(OperatorUtilsTest, wrapMany) {
536-
#if !XSIMD_WITH_AVX2
537-
GTEST_SKIP();
538-
#endif
539-
540536
// Creates a RowVector with nullable and non-null vectors sharing
541537
// different dictionary wraps. Rewraps these with a new wrap with
542538
// and without nulls. Checks that the outcome has a single level of

velox/vector/BaseVector.cpp

+19-4
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,6 @@ void BaseVector::transposeIndices(
10041004
const vector_size_t* wrapIndices,
10051005
vector_size_t* resultIndices) {
10061006
#if XSIMD_WITH_AVX2
1007-
10081007
constexpr int32_t kBatch = xsimd::batch<int32_t>::size;
10091008
static_assert(kBatch == 8);
10101009
static_assert(sizeof(vector_size_t) == sizeof(int32_t));
@@ -1021,7 +1020,9 @@ void BaseVector::transposeIndices(
10211020
.store_unaligned(resultIndices + i);
10221021
}
10231022
#else
1024-
VELOX_NYI();
1023+
for (auto i = 0; i < wrapSize; ++i) {
1024+
resultIndices[i] = baseIndices[wrapIndices[i]];
1025+
}
10251026
#endif
10261027
}
10271028

@@ -1035,7 +1036,6 @@ void BaseVector::transposeIndicesWithNulls(
10351036
vector_size_t* resultIndices,
10361037
uint64_t* resultNulls) {
10371038
#if XSIMD_WITH_AVX2
1038-
10391039
constexpr int32_t kBatch = xsimd::batch<int32_t>::size;
10401040
static_assert(kBatch == 8);
10411041
static_assert(sizeof(vector_size_t) == sizeof(int32_t));
@@ -1061,7 +1061,22 @@ void BaseVector::transposeIndicesWithNulls(
10611061
.store_unaligned(resultIndices + i);
10621062
}
10631063
#else
1064-
VELOX_NYI();
1064+
for (auto i = 0; i < wrapSize; ++i) {
1065+
auto index = wrapIndices[i];
1066+
bool wrapIsNull = wrapNulls && bits::isBitNull(wrapNulls, i);
1067+
if (wrapIsNull) {
1068+
bits::setNull(resultNulls, i, true);
1069+
continue;
1070+
}
1071+
if (baseNulls) {
1072+
if (bits::isBitNull(baseNulls, index)) {
1073+
bits::setNull(resultNulls, i, true);
1074+
continue;
1075+
}
1076+
bits::clearNull(resultNulls, i);
1077+
resultIndices[i] = baseIndices[index];
1078+
}
1079+
}
10651080
#endif
10661081
}
10671082

0 commit comments

Comments
 (0)