Skip to content

Commit b9f9340

Browse files
authored
Merge pull request #70 from r-devulap/fix-moree-warnings
Fix more compiler warnings
2 parents ed6c409 + 441eb5a commit b9f9340

File tree

4 files changed

+48
-21
lines changed

4 files changed

+48
-21
lines changed

.github/workflows/c-cpp.yml

+38-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests and benchmarks
1+
name: Build and run tests
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77
branches: [ "main" ]
88

99
jobs:
10-
BasicBuildAndTest:
10+
ICX:
1111

1212
runs-on: ubuntu-latest
1313

@@ -17,7 +17,7 @@ jobs:
1717
- name: Install dependencies
1818
run: |
1919
sudo apt update
20-
sudo apt -y install g++-12 g++-10 libgtest-dev meson curl git cmake
20+
sudo apt -y install g++-10 libgtest-dev meson curl git cmake
2121
2222
- name: Install google benchmarks
2323
run: |
@@ -33,31 +33,58 @@ jobs:
3333
mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
3434
sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde
3535
36-
- name: Build with gcc-10
36+
- name: Build
3737
env:
3838
CXX: g++-10
3939
run: |
4040
make clean
41-
meson setup --warnlevel 0 --buildtype plain builddir
41+
meson setup --warnlevel 2 --werror --buildtype plain builddir
4242
cd builddir
4343
ninja
4444
45-
- name: Run test suite on SKX
46-
run: sde -skx -- ./builddir/testexe
45+
- name: Run test suite on ICX
46+
run: sde -icx -- ./builddir/testexe
4747

48-
- name: Build with gcc-12
48+
SPR:
49+
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- uses: actions/checkout@v3
54+
55+
- name: Install dependencies
56+
run: |
57+
sudo apt update
58+
sudo apt -y install g++-12 libgtest-dev meson curl git cmake
59+
60+
- name: Install google benchmarks
61+
run: |
62+
git clone https://github.com/google/benchmark.git
63+
cd benchmark
64+
cmake -E make_directory "build"
65+
cmake -E chdir "build" cmake -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ../
66+
sudo cmake --build "build" --config Release --target install
67+
68+
- name: Install Intel SDE
69+
run: |
70+
curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/732268/sde-external-9.7.0-2022-05-09-lin.tar.xz
71+
mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
72+
sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde
73+
74+
- name: Build
4975
env:
5076
CXX: g++-12
5177
run: |
5278
make clean
53-
meson setup --warnlevel 0 --buildtype plain builddir
79+
meson setup --warnlevel 2 --werror --buildtype plain builddir
5480
cd builddir
5581
ninja
5682
57-
- name: Run test suite on SPR
58-
run: sde -spr -- ./builddir/testexe
83+
- name: Run _Float16 test suite on SPR
84+
run: sde -spr -- ./builddir/testexe --gtest_filter="*float16*"
5985

6086
compare-benchmarks-with-main:
87+
if: ${{ false }} # disable for now
6188

6289
runs-on: ubuntu-latest
6390

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ benchexe: $(BENCHOBJS) $(UTILOBJS)
7575

7676
.PHONY: meson
7777
meson:
78-
meson setup --warnlevel 2 --buildtype plain builddir
78+
meson setup --warnlevel 2 --werror --buildtype plain builddir
7979
cd builddir && ninja
8080

8181
.PHONY: clean

src/avx512-common-qsort.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
#ifdef _MSC_VER
7474
#define X86_SIMD_SORT_INLINE static inline
7575
#define X86_SIMD_SORT_FINLINE static __forceinline
76-
#define LIKELY(x)
77-
#define UNLIKELY(x)
76+
#define LIKELY(x) (x)
77+
#define UNLIKELY(x) (x)
7878
#elif defined(__CYGWIN__)
7979
/*
8080
* Force inline in cygwin to work around a compiler bug. See
@@ -90,8 +90,8 @@
9090
#else
9191
#define X86_SIMD_SORT_INLINE static
9292
#define X86_SIMD_SORT_FINLINE static
93-
#define LIKELY(x)
94-
#define UNLIKELY(x)
93+
#define LIKELY(x) (x)
94+
#define UNLIKELY(x) (x)
9595
#endif
9696

9797
#if __GNUC__ >= 8

tests/test-qsortfp16.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ TEST(avx512_qsort_float16, test_arrsizes)
2121

2222
for (size_t ii = 0; ii < arrsizes.size(); ++ii) {
2323
/* Random array */
24-
for (size_t jj = 0; jj < arrsizes[ii]; ++jj) {
24+
for (auto jj = 0; jj < arrsizes[ii]; ++jj) {
2525
_Float16 temp = (float)rand() / (float)(RAND_MAX);
2626
arr.push_back(temp);
2727
sortedarr.push_back(temp);
@@ -86,7 +86,7 @@ TEST(avx512_qselect_float16, test_arrsizes)
8686

8787
for (size_t ii = 0; ii < arrsizes.size(); ++ii) {
8888
/* Random array */
89-
for (size_t jj = 0; jj < arrsizes[ii]; ++jj) {
89+
for (auto jj = 0; jj < arrsizes[ii]; ++jj) {
9090
_Float16 temp = (float)rand() / (float)(RAND_MAX);
9191
arr.push_back(temp);
9292
sortedarr.push_back(temp);
@@ -129,23 +129,23 @@ TEST(avx512_partial_qsort_float16, test_ranges)
129129
std::vector<_Float16> psortedarr;
130130

131131
/* Random array */
132-
for (size_t ii = 0; ii < arrsize; ++ii) {
132+
for (auto ii = 0; ii < arrsize; ++ii) {
133133
_Float16 temp = (float)rand() / (float)(RAND_MAX);
134134
arr.push_back(temp);
135135
sortedarr.push_back(temp);
136136
}
137137
/* Sort with std::sort for comparison */
138138
std::sort(sortedarr.begin(), sortedarr.end());
139139

140-
for (size_t ii = 0; ii < nranges; ++ii) {
140+
for (auto ii = 0; ii < nranges; ++ii) {
141141
psortedarr = arr;
142142

143143
int k = get_uniform_rand_array<int64_t>(1, arrsize, 1).front();
144144

145145
/* Sort the range and verify all the required elements match the presorted set */
146146
avx512_partial_qsort<_Float16>(
147147
psortedarr.data(), k, psortedarr.size());
148-
for (size_t jj = 0; jj < k; jj++) {
148+
for (auto jj = 0; jj < k; jj++) {
149149
ASSERT_EQ(sortedarr[jj], psortedarr[jj]);
150150
}
151151

0 commit comments

Comments
 (0)