Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
cpu_features.h
Go to the documentation of this file.
1#ifndef HALIDE_CPU_FEATURES_H
2#define HALIDE_CPU_FEATURES_H
3
4#include "HalideRuntime.h"
5#include "runtime_internal.h"
6
7namespace Halide {
8namespace Runtime {
9namespace Internal {
10
11// Return two masks:
12// One with all the CPU-specific features that might possible be available on this architecture ('known'),
13// and one with the subset that are actually present ('available').
15 static const int kWordCount = (halide_target_feature_end + 63) / (sizeof(uint64_t) * 8);
16
18 known[i >> 6] |= ((uint64_t)1) << (i & 63);
19 }
20
22 available[i >> 6] |= ((uint64_t)1) << (i & 63);
23 }
24
25 ALWAYS_INLINE bool test_known(int i) const {
26 return (known[i >> 6] & ((uint64_t)1) << (i & 63)) != 0;
27 }
28
29 ALWAYS_INLINE bool test_available(int i) const {
30 return (available[i >> 6] & ((uint64_t)1) << (i & 63)) != 0;
31 }
32
35 for (int i = 0; i < kWordCount; ++i) {
36 known[i] = 0;
37 available[i] = 0;
38 }
39 }
40
41 uint64_t known[kWordCount]; // mask of the CPU features we know how to detect
42 uint64_t available[kWordCount]; // mask of the CPU features that are available
43 // (always a subset of 'known')
44};
45
47
48} // namespace Internal
49} // namespace Runtime
50} // namespace Halide
51
52#endif // HALIDE_CPU_FEATURES_H
This file declares the routines used by Halide internally in its runtime.
@ halide_target_feature_end
A sentinel. Every target is considered to have this feature, and setting this feature does nothing.
WEAK CpuFeatures halide_get_cpu_features()
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
unsigned __INT64_TYPE__ uint64_t
#define ALWAYS_INLINE
#define WEAK
ALWAYS_INLINE bool test_available(int i) const
ALWAYS_INLINE bool test_known(int i) const
ALWAYS_INLINE void set_available(int i)
ALWAYS_INLINE void set_known(int i)