comparison OrthancStone/Sources/Toolbox/SimdIncludes.h @ 2068:22a83fb9dd23 deep-learning

added AlignedMatrix and TimerLogger
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 17 May 2023 17:30:52 +0200
parents
children 5956d7357098
comparison
equal deleted inserted replaced
2067:20222330cdf6 2068:22a83fb9dd23
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
7 *
8 * This program is free software: you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation, either version 3 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
21 **/
22
23
24 #pragma once
25
26 #if defined(__EMSCRIPTEN__)
27 # include <emscripten.h>
28 # include <wasm_simd128.h>
29 #else
30 # include <immintrin.h> // portable to all x86 compilers
31 #endif
32
33 #if __AVX2__ == 1
34 # define ORTHANC_HAS_AVX2 1
35 # define ORTHANC_HAS_SSE2 1
36 # define ORTHANC_HAS_WASM_SIMD 0
37 # define ORTHANC_MEMORY_ALIGNMENT 32
38 #elif __SSE2__ == 1
39 # define ORTHANC_HAS_AVX2 0
40 # define ORTHANC_HAS_SSE2 1
41 # define ORTHANC_HAS_WASM_SIMD 0
42 # define ORTHANC_MEMORY_ALIGNMENT 16
43 #elif defined(__EMSCRIPTEN__)
44 # define ORTHANC_HAS_AVX2 0
45 # define ORTHANC_HAS_SSE2 0
46 # define ORTHANC_HAS_WASM_SIMD 1
47 # define ORTHANC_MEMORY_ALIGNMENT 16
48 #elif defined(_MSC_VER)
49 # if _M_IX86_FP >= 2 // https://stackoverflow.com/a/18563988
50 # define ORTHANC_HAS_AVX2 0
51 # define ORTHANC_HAS_SSE2 0
52 # define ORTHANC_HAS_WASM_SIMD 1
53 # define ORTHANC_MEMORY_ALIGNMENT 16
54 # endif
55 #else
56 # define ORTHANC_MEMORY_ALIGNMENT 8
57 #endif