Skip to content

Commit 3c21c7f

Browse files
author
Raghuveer Devulapalli
committed
Fix formatting
1 parent a6e75e2 commit 3c21c7f

File tree

6 files changed

+28
-33
lines changed

6 files changed

+28
-33
lines changed

src/avx512-common-qsort.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
#include <algorithm>
3737
#include <cmath>
3838
#include <cstdint>
39+
#include <cstring>
3940
#include <immintrin.h>
4041
#include <limits>
41-
#include <cstring>
4242

4343
#define X86_SIMD_SORT_INFINITY std::numeric_limits<double>::infinity()
4444
#define X86_SIMD_SORT_INFINITYF std::numeric_limits<float>::infinity()

src/avx512fp16-16bit-qsort.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
#include "avx512-16bit-common.h"
1111

12-
typedef union
13-
{
12+
typedef union {
1413
_Float16 f_;
1514
uint16_t i_;
1615
} Fp16Bits;
@@ -74,8 +73,8 @@ struct zmm_vector<_Float16> {
7473
}
7574
static zmm_t mask_mov(zmm_t x, opmask_t mask, zmm_t y)
7675
{
77-
return _mm512_castsi512_ph(
78-
_mm512_mask_mov_epi16(_mm512_castph_si512(x), mask, _mm512_castph_si512(y)));
76+
return _mm512_castsi512_ph(_mm512_mask_mov_epi16(
77+
_mm512_castph_si512(x), mask, _mm512_castph_si512(y)));
7978
}
8079
static void mask_storeu(void *mem, opmask_t mask, zmm_t x)
8180
{
@@ -104,8 +103,10 @@ struct zmm_vector<_Float16> {
104103
template <uint8_t mask>
105104
static zmm_t shuffle(zmm_t zmm)
106105
{
107-
__m512i temp = _mm512_shufflehi_epi16(_mm512_castph_si512(zmm), (_MM_PERM_ENUM)mask);
108-
return _mm512_castsi512_ph(_mm512_shufflelo_epi16(temp, (_MM_PERM_ENUM)mask));
106+
__m512i temp = _mm512_shufflehi_epi16(_mm512_castph_si512(zmm),
107+
(_MM_PERM_ENUM)mask);
108+
return _mm512_castsi512_ph(
109+
_mm512_shufflelo_epi16(temp, (_MM_PERM_ENUM)mask));
109110
}
110111
static void storeu(void *mem, zmm_t x)
111112
{
@@ -123,7 +124,7 @@ X86_SIMD_SORT_INLINE int64_t replace_nan_with_inf(_Float16 *arr,
123124
if (arrsize < 32) {
124125
loadmask = (0x00000001 << arrsize) - 0x00000001;
125126
in_zmm = _mm512_castsi512_ph(
126-
_mm512_maskz_loadu_epi16(loadmask, arr));
127+
_mm512_maskz_loadu_epi16(loadmask, arr));
127128
}
128129
else {
129130
in_zmm = _mm512_loadu_ph(arr);
@@ -140,7 +141,7 @@ X86_SIMD_SORT_INLINE int64_t replace_nan_with_inf(_Float16 *arr,
140141
X86_SIMD_SORT_INLINE void
141142
replace_inf_with_nan(_Float16 *arr, int64_t arrsize, int64_t nan_count)
142143
{
143-
memset(arr + arrsize - nan_count, 0xFF, nan_count*2);
144+
memset(arr + arrsize - nan_count, 0xFF, nan_count * 2);
144145
}
145146

146147
template <>

tests/test_keyvalue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ TYPED_TEST_P(TestKeyValueSort, KeyValueSort)
3838

3939
for (size_t ii = 0; ii < keysizes.size(); ++ii) {
4040
/* Random array */
41-
keys =
42-
get_uniform_rand_array_with_uniquevalues<TypeParam>(keysizes[ii]);
41+
keys = get_uniform_rand_array_with_uniquevalues<TypeParam>(
42+
keysizes[ii]);
4343
values = get_uniform_rand_array<uint64_t>(keysizes[ii]);
4444
for (size_t i = 0; i < keys.size(); i++) {
4545
sorted_t<TypeParam, uint64_t> tmp_s;

tests/test_qsortfp16.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* * SPDX-License-Identifier: BSD-3-Clause
44
* *******************************************/
55

6-
#include <gtest/gtest.h>
7-
#include <vector>
86
#include "avx512fp16-16bit-qsort.hpp"
97
#include "cpuinfo.h"
108
#include "rand_array.h"
9+
#include <gtest/gtest.h>
10+
#include <vector>
1111

1212
TEST(avx512_qsort_float16, test_arrsizes)
1313
{
@@ -49,26 +49,20 @@ TEST(avx512_qsort_float16, test_special_floats)
4949
for (size_t jj = 0; jj < arrsize; ++jj) {
5050
temp.f_ = (float)rand() / (float)(RAND_MAX);
5151
switch (rand() % 10) {
52-
case 0:
53-
temp.i_ = 0xFFFF;
54-
break;
55-
case 1:
56-
temp.i_ = X86_SIMD_SORT_INFINITYH;
57-
break;
58-
case 2:
59-
temp.i_ = X86_SIMD_SORT_NEGINFINITYH;
60-
break;
61-
default:
62-
break;
52+
case 0: temp.i_ = 0xFFFF; break;
53+
case 1: temp.i_ = X86_SIMD_SORT_INFINITYH; break;
54+
case 2: temp.i_ = X86_SIMD_SORT_NEGINFINITYH; break;
55+
default: break;
6356
}
6457
arr.push_back(temp.f_);
6558
sortedarr.push_back(temp.f_);
6659
}
6760
/* Cannot use std::sort because it treats NAN differently */
68-
avx512_qsort_fp16(reinterpret_cast<uint16_t*>(sortedarr.data()), sortedarr.size());
61+
avx512_qsort_fp16(reinterpret_cast<uint16_t *>(sortedarr.data()),
62+
sortedarr.size());
6963
avx512_qsort<_Float16>(arr.data(), arr.size());
7064
// Cannot rely on ASSERT_EQ since it returns false if there are NAN's
71-
if (memcmp(arr.data(), sortedarr.data(), arrsize*2) != 0) {
65+
if (memcmp(arr.data(), sortedarr.data(), arrsize * 2) != 0) {
7266
ASSERT_EQ(sortedarr, arr);
7367
}
7468
arr.clear();

utils/cpuinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* * SPDX-License-Identifier: BSD-3-Clause
44
* *******************************************/
55

6-
#include <stdint.h>
76
#include <cpuid.h>
7+
#include <stdint.h>
88

99
int cpu_has_avx512_vbmi2();
1010

utils/rand_array.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ static std::vector<T> get_uniform_rand_array(
4343
}
4444

4545
template <typename T>
46-
static std::vector<T> get_uniform_rand_array_with_uniquevalues(
47-
int64_t arrsize,
48-
T max = std::numeric_limits<T>::max(),
49-
T min = std::numeric_limits<T>::min())
46+
static std::vector<T>
47+
get_uniform_rand_array_with_uniquevalues(int64_t arrsize,
48+
T max = std::numeric_limits<T>::max(),
49+
T min = std::numeric_limits<T>::min())
5050
{
5151
std::vector<T> arr = get_uniform_rand_array<T>(arrsize, max, min);
52-
typename std::vector<T>::iterator ip =
53-
std::unique(arr.begin(), arr.begin() + arrsize);
52+
typename std::vector<T>::iterator ip
53+
= std::unique(arr.begin(), arr.begin() + arrsize);
5454
arr.resize(std::distance(arr.begin(), ip));
5555
return arr;
5656
}

0 commit comments

Comments
 (0)