Skip to content

Commit

Permalink
Merge pull request #70 from r-devulap/fix-moree-warnings
Browse files Browse the repository at this point in the history
Fix more compiler warnings
  • Loading branch information
r-devulap committed Sep 6, 2023
2 parents ed6c409 + 441eb5a commit b9f9340
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 21 deletions.
49 changes: 38 additions & 11 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests and benchmarks
name: Build and run tests

on:
push:
Expand All @@ -7,7 +7,7 @@ on:
branches: [ "main" ]

jobs:
BasicBuildAndTest:
ICX:

runs-on: ubuntu-latest

Expand All @@ -17,7 +17,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt -y install g++-12 g++-10 libgtest-dev meson curl git cmake
sudo apt -y install g++-10 libgtest-dev meson curl git cmake
- name: Install google benchmarks
run: |
Expand All @@ -33,31 +33,58 @@ jobs:
mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde
- name: Build with gcc-10
- name: Build
env:
CXX: g++-10
run: |
make clean
meson setup --warnlevel 0 --buildtype plain builddir
meson setup --warnlevel 2 --werror --buildtype plain builddir
cd builddir
ninja
- name: Run test suite on SKX
run: sde -skx -- ./builddir/testexe
- name: Run test suite on ICX
run: sde -icx -- ./builddir/testexe

- name: Build with gcc-12
SPR:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt update
sudo apt -y install g++-12 libgtest-dev meson curl git cmake
- name: Install google benchmarks
run: |
git clone https://github.com/google/benchmark.git
cd benchmark
cmake -E make_directory "build"
cmake -E chdir "build" cmake -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ../
sudo cmake --build "build" --config Release --target install
- name: Install Intel SDE
run: |
curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/732268/sde-external-9.7.0-2022-05-09-lin.tar.xz
mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde
- name: Build
env:
CXX: g++-12
run: |
make clean
meson setup --warnlevel 0 --buildtype plain builddir
meson setup --warnlevel 2 --werror --buildtype plain builddir
cd builddir
ninja
- name: Run test suite on SPR
run: sde -spr -- ./builddir/testexe
- name: Run _Float16 test suite on SPR
run: sde -spr -- ./builddir/testexe --gtest_filter="*float16*"

compare-benchmarks-with-main:
if: ${{ false }} # disable for now

runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ benchexe: $(BENCHOBJS) $(UTILOBJS)

.PHONY: meson
meson:
meson setup --warnlevel 2 --buildtype plain builddir
meson setup --warnlevel 2 --werror --buildtype plain builddir
cd builddir && ninja

.PHONY: clean
Expand Down
8 changes: 4 additions & 4 deletions src/avx512-common-qsort.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
#ifdef _MSC_VER
#define X86_SIMD_SORT_INLINE static inline
#define X86_SIMD_SORT_FINLINE static __forceinline
#define LIKELY(x)
#define UNLIKELY(x)
#define LIKELY(x) (x)
#define UNLIKELY(x) (x)
#elif defined(__CYGWIN__)
/*
* Force inline in cygwin to work around a compiler bug. See
Expand All @@ -90,8 +90,8 @@
#else
#define X86_SIMD_SORT_INLINE static
#define X86_SIMD_SORT_FINLINE static
#define LIKELY(x)
#define UNLIKELY(x)
#define LIKELY(x) (x)
#define UNLIKELY(x) (x)
#endif

#if __GNUC__ >= 8
Expand Down
10 changes: 5 additions & 5 deletions tests/test-qsortfp16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TEST(avx512_qsort_float16, test_arrsizes)

for (size_t ii = 0; ii < arrsizes.size(); ++ii) {
/* Random array */
for (size_t jj = 0; jj < arrsizes[ii]; ++jj) {
for (auto jj = 0; jj < arrsizes[ii]; ++jj) {
_Float16 temp = (float)rand() / (float)(RAND_MAX);
arr.push_back(temp);
sortedarr.push_back(temp);
Expand Down Expand Up @@ -86,7 +86,7 @@ TEST(avx512_qselect_float16, test_arrsizes)

for (size_t ii = 0; ii < arrsizes.size(); ++ii) {
/* Random array */
for (size_t jj = 0; jj < arrsizes[ii]; ++jj) {
for (auto jj = 0; jj < arrsizes[ii]; ++jj) {
_Float16 temp = (float)rand() / (float)(RAND_MAX);
arr.push_back(temp);
sortedarr.push_back(temp);
Expand Down Expand Up @@ -129,23 +129,23 @@ TEST(avx512_partial_qsort_float16, test_ranges)
std::vector<_Float16> psortedarr;

/* Random array */
for (size_t ii = 0; ii < arrsize; ++ii) {
for (auto ii = 0; ii < arrsize; ++ii) {
_Float16 temp = (float)rand() / (float)(RAND_MAX);
arr.push_back(temp);
sortedarr.push_back(temp);
}
/* Sort with std::sort for comparison */
std::sort(sortedarr.begin(), sortedarr.end());

for (size_t ii = 0; ii < nranges; ++ii) {
for (auto ii = 0; ii < nranges; ++ii) {
psortedarr = arr;

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

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

Expand Down

0 comments on commit b9f9340

Please sign in to comment.