Skip to content

Commit f372568

Browse files
authored
Merge pull request #1000 from xtensor-stack/feature/emulated
Add support form emulated<N> arch
2 parents 63ea057 + 86ceb6f commit f372568

File tree

15 files changed

+1077
-79
lines changed

15 files changed

+1077
-79
lines changed

.github/workflows/emulated.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Linux emulated build
2+
on: [push, pull_request]
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
defaults:
7+
run:
8+
shell: bash -l {0}
9+
jobs:
10+
build:
11+
runs-on: ubuntu-20.04
12+
name: '${{ matrix.sys.compiler }} ${{ matrix.sys.version }} - emulated'
13+
strategy:
14+
matrix:
15+
sys:
16+
- { compiler: 'gcc', version: '7'}
17+
- { compiler: 'clang', version: '8'}
18+
steps:
19+
- name: Setup compiler
20+
if: ${{ matrix.sys.compiler == 'gcc' }}
21+
run: |
22+
GCC_VERSION=${{ matrix.sys.version }}
23+
sudo apt-get update
24+
sudo apt-get --no-install-suggests --no-install-recommends install g++-$GCC_VERSION
25+
CC=gcc-$GCC_VERSION
26+
echo "CC=$CC" >> $GITHUB_ENV
27+
CXX=g++-$GCC_VERSION
28+
echo "CXX=$CXX" >> $GITHUB_ENV
29+
CXXFLAGS="-Wno-noexcept-type -Wno-stringop-overflow -Wno-maybe-uninitialized"
30+
echo "CXXFLAGS=$CXXFLAGS" >> $GITHUB_ENV
31+
- name: Setup compiler
32+
if: ${{ matrix.sys.compiler == 'clang' }}
33+
run: |
34+
LLVM_VERSION=${{ matrix.sys.version }}
35+
#sudo add-apt-repository ppa:ubuntu-toolchain-r/test || exit 1
36+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1
37+
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main" || exit 1
38+
sudo apt-get update || exit 1
39+
sudo apt-get --no-install-suggests --no-install-recommends install clang-$LLVM_VERSION || exit 1
40+
sudo apt-get --no-install-suggests --no-install-recommends install g++-9 g++-9-multilib || exit 1
41+
sudo ln -s /usr/include/asm-generic /usr/include/asm
42+
CC=clang-$LLVM_VERSION
43+
echo "CC=$CC" >> $GITHUB_ENV
44+
CXX=clang++-$LLVM_VERSION
45+
echo "CXX=$CXX" >> $GITHUB_ENV
46+
- name: Checkout xsimd
47+
uses: actions/checkout@v3
48+
- name: Install mamba
49+
uses: mamba-org/provision-with-micromamba@main
50+
with:
51+
environment-file: environment.yml
52+
- name: Configure build
53+
env:
54+
CC: ${{ env.CC }}
55+
CXX: ${{ env.CXX }}
56+
run: |
57+
58+
mkdir _build
59+
cd _build
60+
cmake .. -DBUILD_TESTS=ON \
61+
-DBUILD_BENCHMARK=ON \
62+
-DBUILD_EXAMPLES=ON \
63+
-DCMAKE_BUILD_TYPE=Release \
64+
-DCMAKE_C_COMPILER=$CC \
65+
-DCMAKE_CXX_COMPILER=$CXX \
66+
-DXSIMD_ENABLE_WERROR=ON \
67+
-DCMAKE_CXX_FLAGS="-DXSIMD_DEFAULT_ARCH=emulated\<128\> -DXSIMD_WITH_EMULATED=1 ${CXXFLAGS}" \
68+
-G Ninja
69+
- name: Build
70+
run: ninja -C _build
71+
- name: Test
72+
run: |
73+
cd _build/test
74+
./test_xsimd

docs/source/api/arch.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@ The best available architecture is available at compile time through
1717
.. doxygengroup:: architectures
1818
:project: xsimd
1919
:members:
20+
21+
22+
Emulated mode
23+
-------------
24+
25+
When compiled with the macro ``XSIMD_WITH_EMULATED`` set to ``1``, xsimd also
26+
exhibits a specific architecture ``xsimd::emulated<N>``, which consists of a
27+
vector of ``N`` bits emulated using scalar mode.
28+
It is mostly available for testing and debugging.

include/xsimd/arch/generic/xsimd_generic_memory.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,12 @@ namespace xsimd
412412
return true;
413413
}
414414

415+
template <typename ITy>
416+
constexpr bool is_zip_lo(size_t, ITy)
417+
{
418+
return false;
419+
}
420+
415421
template <typename ITy0, typename ITy1, typename... ITys>
416422
constexpr bool is_zip_lo(size_t bsize, ITy0 index0, ITy1 index1, ITys... indices)
417423
{
@@ -423,6 +429,12 @@ namespace xsimd
423429
return true;
424430
}
425431

432+
template <typename ITy>
433+
constexpr bool is_zip_hi(size_t, ITy)
434+
{
435+
return false;
436+
}
437+
426438
template <typename ITy0, typename ITy1, typename... ITys>
427439
constexpr bool is_zip_hi(size_t bsize, ITy0 index0, ITy1 index1, ITys... indices)
428440
{

0 commit comments

Comments
 (0)