"vscode:/vscode.git/clone" did not exist on "9b513bb6b1dad0657e81d86b0b9e1a0d13b0f071"
arithmetic.h 1.78 KB
Newer Older
Terry Koo's avatar
Terry Koo committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// =============================================================================

// Top-level organizational header for arithmetic operations.  Users should
// include this instead of directly including the sub-headers below.  See
// arithmetic_common.h for function declarations and comments.
//
// NB: If you wish to use an architecture-specific implementation, make sure to
// add the relevant copts to the cc_library whose .cc file includes this header.

#ifndef DRAGNN_RUNTIME_MATH_ARITHMETIC_H_
#define DRAGNN_RUNTIME_MATH_ARITHMETIC_H_

// Select an architecture-specific implementation, if possible, or fall back to
// the trivial generic implementations.  The order of the clauses is important:
// in cases where architectures may overlap the newer version should be checked
// first (e.g., AVX before SSE).
#if defined(__AVX2__)
#include "dragnn/runtime/math/arithmetic_avx.h"
#elif defined(__SSE4_2__)
#include "dragnn/runtime/math/arithmetic_sse.h"
#elif defined(__ARM_NEON) || defined(__ARM_NEON__)
#include "dragnn/runtime/math/arithmetic_neon.h"
#else  // no architecture-specific implementation
#include "dragnn/runtime/math/arithmetic_common.h"
#endif

#endif  // DRAGNN_RUNTIME_MATH_ARITHMETIC_H_