Halide
Target.h
Go to the documentation of this file.
1 #ifndef HALIDE_TARGET_H
2 #define HALIDE_TARGET_H
3 
4 /** \file
5  * Defines the structure that describes a Halide target.
6  */
7 
8 #include <bitset>
9 #include <stdint.h>
10 #include <string>
11 
12 #include "DeviceAPI.h"
13 #include "Type.h"
14 #include "runtime/HalideRuntime.h"
15 
16 namespace Halide {
17 
18 /** A struct representing a target machine and os to generate code for. */
19 struct Target {
20  /** The operating system used by the target. Determines which
21  * system calls to generate.
22  * Corresponds to os_name_map in Target.cpp. */
23  enum OS {
24  OSUnknown = 0,
27  OSX,
29  IOS,
34  } os;
35 
36  /** The architecture used by the target. Determines the
37  * instruction set to use.
38  * Corresponds to arch_name_map in Target.cpp. */
39  enum Arch {
41  X86,
42  ARM,
48  } arch;
49 
50  /** The bit-width of the target machine. Must be 0 for unknown, or 32 or 64. */
51  int bits;
52 
53  /** Optional features a target can have.
54  * Corresponds to feature_name_map in Target.cpp.
55  * See definitions in HalideRuntime.h for full information.
56  */
57  enum Feature {
128  };
130  : os(OSUnknown), arch(ArchUnknown), bits(0) {
131  }
132  Target(OS o, Arch a, int b, const std::vector<Feature> &initial_features = std::vector<Feature>())
133  : os(o), arch(a), bits(b) {
134  for (const auto &f : initial_features) {
135  set_feature(f);
136  }
137  }
138 
139  /** Given a string of the form used in HL_TARGET
140  * (e.g. "x86-64-avx"), construct the Target it specifies. Note
141  * that this always starts with the result of get_host_target(),
142  * replacing only the parts found in the target string, so if you
143  * omit (say) an OS specification, the host OS will be used
144  * instead. An empty string is exactly equivalent to
145  * get_host_target().
146  *
147  * Invalid target strings will fail with a user_error.
148  */
149  // @{
150  explicit Target(const std::string &s);
151  explicit Target(const char *s);
152  // @}
153 
154  /** Check if a target string is valid. */
155  static bool validate_target_string(const std::string &s);
156 
157  /** Return true if any of the arch/bits/os fields are "unknown"/0;
158  return false otherwise. */
159  bool has_unknowns() const;
160 
161  void set_feature(Feature f, bool value = true);
162 
163  void set_features(const std::vector<Feature> &features_to_set, bool value = true);
164 
165  bool has_feature(Feature f) const;
166 
167  inline bool has_feature(halide_target_feature_t f) const {
168  return has_feature((Feature)f);
169  }
170 
171  bool features_any_of(const std::vector<Feature> &test_features) const;
172 
173  bool features_all_of(const std::vector<Feature> &test_features) const;
174 
175  /** Return a copy of the target with the given feature set.
176  * This is convenient when enabling certain features (e.g. NoBoundsQuery)
177  * in an initialization list, where the target to be mutated may be
178  * a const reference. */
179  Target with_feature(Feature f) const;
180 
181  /** Return a copy of the target with the given feature cleared.
182  * This is convenient when disabling certain features (e.g. NoBoundsQuery)
183  * in an initialization list, where the target to be mutated may be
184  * a const reference. */
185  Target without_feature(Feature f) const;
186 
187  /** Is a fully feature GPU compute runtime enabled? I.e. is
188  * Func::gpu_tile and similar going to work? Currently includes
189  * CUDA, OpenCL, Metal and D3D12Compute. We do not include OpenGL,
190  * because it is not capable of gpgpu, and is not scheduled via
191  * Func::gpu_tile.
192  * TODO: Should OpenGLCompute be included here? */
193  bool has_gpu_feature() const;
194 
195  /** Does this target allow using a certain type. Generally all
196  * types except 64-bit float and int/uint should be supported by
197  * all backends.
198  *
199  * It is likely better to call the version below which takes a DeviceAPI.
200  */
201  bool supports_type(const Type &t) const;
202 
203  /** Does this target allow using a certain type on a certain device.
204  * This is the prefered version of this routine.
205  */
206  bool supports_type(const Type &t, DeviceAPI device) const;
207 
208  /** Returns whether a particular device API can be used with this
209  * Target. */
210  bool supports_device_api(DeviceAPI api) const;
211 
212  /** If this Target (including all Features) requires a specific DeviceAPI,
213  * return it. If it doesn't, return DeviceAPI::None. If the Target has
214  * features with multiple (different) DeviceAPI requirements, the result
215  * will be an arbitrary DeviceAPI. */
217 
218  bool operator==(const Target &other) const {
219  return os == other.os &&
220  arch == other.arch &&
221  bits == other.bits &&
222  features == other.features;
223  }
224 
225  bool operator!=(const Target &other) const {
226  return !(*this == other);
227  }
228 
229  /**
230  * Create a "greatest common denominator" runtime target that is compatible with
231  * both this target and \p other. Used by generators to conveniently select a suitable
232  * runtime when linking together multiple functions.
233  *
234  * @param other The other target from which we compute the gcd target.
235  * @param[out] result The gcd target if we return true, otherwise unmodified. Can be the same as *this.
236  * @return Whether it was possible to find a compatible target (true) or not.
237  */
238  bool get_runtime_compatible_target(const Target &other, Target &result);
239 
240  /** Convert the Target into a string form that can be reconstituted
241  * by merge_string(), which will always be of the form
242  *
243  * arch-bits-os-feature1-feature2...featureN.
244  *
245  * Note that is guaranteed that Target(t1.to_string()) == t1,
246  * but not that Target(s).to_string() == s (since there can be
247  * multiple strings that parse to the same Target)...
248  * *unless* t1 contains 'unknown' fields (in which case you'll get a string
249  * that can't be parsed, which is intentional).
250  */
251  std::string to_string() const;
252 
253  /** Given a data type, return an estimate of the "natural" vector size
254  * for that data type when compiling for this Target. */
255  int natural_vector_size(const Halide::Type &t) const;
256 
257  /** Given a data type, return an estimate of the "natural" vector size
258  * for that data type when compiling for this Target. */
259  template<typename data_t>
260  int natural_vector_size() const {
261  return natural_vector_size(type_of<data_t>());
262  }
263 
264  /** Return true iff 64 bits and has_feature(LargeBuffers). */
265  bool has_large_buffers() const {
266  return bits == 64 && has_feature(LargeBuffers);
267  }
268 
269  /** Return the maximum buffer size in bytes supported on this
270  * Target. This is 2^31 - 1 except on 64-bit targets when the LargeBuffers
271  * feature is enabled, which expands the maximum to 2^63 - 1. */
273  if (has_large_buffers()) {
274  return (((uint64_t)1) << 63) - 1;
275  } else {
276  return (((uint64_t)1) << 31) - 1;
277  }
278  }
279 
280  /** Get the minimum cuda capability found as an integer. Returns
281  * 20 (our minimum supported cuda compute capability) if no cuda
282  * features are set. */
284 
285  /** Was libHalide compiled with support for this target? */
286  bool supported() const;
287 
288  /** Return a bitset of the Featuress set in this Target (set = 1).
289  * Note that while this happens to be the current internal representation,
290  * that might not always be the case. */
291  const std::bitset<FeatureEnd> &get_features_bitset() const {
292  return features;
293  }
294 
295  /** Return the name corresponding to a given Feature, in the form
296  * used to construct Target strings (e.g., Feature::Debug is "debug" and not "Debug"). */
297  static std::string feature_to_name(Target::Feature feature);
298 
299  /** Return the feature corresponding to a given name, in the form
300  * used to construct Target strings (e.g., Feature::Debug is "debug" and not "Debug").
301  * If the string is not a known feature name, return FeatureEnd. */
302  static Target::Feature feature_from_name(const std::string &name);
303 
304 private:
305  /** A bitmask that stores the active features. */
306  std::bitset<FeatureEnd> features;
307 };
308 
309 /** Return the target corresponding to the host machine. */
310 Target get_host_target();
311 
312 /** Return the target that Halide will use. If HL_TARGET is set it
313  * uses that. Otherwise calls \ref get_host_target */
315 
316 /** Return the target that Halide will use for jit-compilation. If
317  * HL_JIT_TARGET is set it uses that. Otherwise calls \ref
318  * get_host_target. Throws an error if the architecture, bit width,
319  * and OS of the target do not match the host target, so this is only
320  * useful for controlling the feature set. */
322 
323 /** Get the Target feature corresponding to a DeviceAPI. For device
324  * apis that do not correspond to any single target feature, returns
325  * Target::FeatureEnd */
327 
328 namespace Internal {
329 
330 void target_test();
331 }
332 
333 } // namespace Halide
334 
335 #endif
halide_target_feature_no_bounds_query
@ halide_target_feature_no_bounds_query
Disable the bounds querying functionality.
Definition: HalideRuntime.h:1243
Halide::Target::has_unknowns
bool has_unknowns() const
Return true if any of the arch/bits/os fields are "unknown"/0; return false otherwise.
Halide::Target::Android
@ Android
Definition: Target.h:28
Halide::Target::CLDoubles
@ CLDoubles
Definition: Target.h:82
halide_target_feature_cl_half
@ halide_target_feature_cl_half
Enable half support on OpenCL targets.
Definition: HalideRuntime.h:1305
halide_target_feature_t
halide_target_feature_t
Optional features a compilation Target can have.
Definition: HalideRuntime.h:1239
Halide::Target::has_feature
bool has_feature(Feature f) const
Halide::Target::CUDACapability30
@ CUDACapability30
Definition: Target.h:73
Halide::Target::WasmSatFloatToInt
@ WasmSatFloatToInt
Definition: Target.h:123
Halide::Target::features_all_of
bool features_all_of(const std::vector< Feature > &test_features) const
halide_target_feature_sve
@ halide_target_feature_sve
Enable ARM Scalable Vector Extensions.
Definition: HalideRuntime.h:1318
Halide::Target::HexagonDma
@ HexagonDma
Definition: Target.h:95
Halide::Target::Target
Target()
Definition: Target.h:129
Halide::Target::NoNEON
@ NoNEON
Definition: Target.h:69
Halide::Target::MSAN
@ MSAN
Definition: Target.h:104
Halide::Target::AVX
@ AVX
Definition: Target.h:63
Halide::Target::operator!=
bool operator!=(const Target &other) const
Definition: Target.h:225
Halide::Target::HVX_shared_object
@ HVX_shared_object
Definition: Target.h:101
Halide::get_host_target
Target get_host_target()
Return the target corresponding to the host machine.
halide_target_feature_asan
@ halide_target_feature_asan
Enable hooks for ASAN support.
Definition: HalideRuntime.h:1308
Halide::Target::DisableLLVMLoopOpt
@ DisableLLVMLoopOpt
Definition: Target.h:120
Halide::Target::FuzzFloatStores
@ FuzzFloatStores
Definition: Target.h:102
Halide::Target::SVE2
@ SVE2
Definition: Target.h:125
Halide::target_feature_for_device_api
Target::Feature target_feature_for_device_api(DeviceAPI api)
Get the Target feature corresponding to a DeviceAPI.
Halide::Target::Linux
@ Linux
Definition: Target.h:25
Halide::Target::WebAssembly
@ WebAssembly
Definition: Target.h:46
Halide::Target::Profile
@ Profile
Definition: Target.h:90
halide_target_feature_sse41
@ halide_target_feature_sse41
Use SSE 4.1 and earlier instructions. Only relevant on x86.
Definition: HalideRuntime.h:1245
Halide::Target::get_features_bitset
const std::bitset< FeatureEnd > & get_features_bitset() const
Return a bitset of the Featuress set in this Target (set = 1).
Definition: Target.h:291
Halide::Target::feature_from_name
static Target::Feature feature_from_name(const std::string &name)
Return the feature corresponding to a given name, in the form used to construct Target strings (e....
Halide::Target::JIT
@ JIT
Definition: Target.h:58
halide_target_feature_d3d12compute
@ halide_target_feature_d3d12compute
Enable Direct3D 12 Compute runtime.
Definition: HalideRuntime.h:1309
Halide::Target::supports_type
bool supports_type(const Type &t) const
Does this target allow using a certain type.
Halide::Target::Feature
Feature
Optional features a target can have.
Definition: Target.h:57
halide_target_feature_no_runtime
@ halide_target_feature_no_runtime
Do not include a copy of the Halide runtime in any generated object file or assembly.
Definition: HalideRuntime.h:1280
halide_target_feature_cuda_capability32
@ halide_target_feature_cuda_capability32
Enable CUDA compute capability 3.2 (Tegra K1)
Definition: HalideRuntime.h:1260
Halide::Target::set_feature
void set_feature(Feature f, bool value=true)
Halide::Target::to_string
std::string to_string() const
Convert the Target into a string form that can be reconstituted by merge_string(),...
halide_target_feature_embed_bitcode
@ halide_target_feature_embed_bitcode
Emulate clang -fembed-bitcode flag.
Definition: HalideRuntime.h:1312
Halide::Target::TraceStores
@ TraceStores
Definition: Target.h:110
Halide::Target::AVX512_KNL
@ AVX512_KNL
Definition: Target.h:106
halide_target_feature_trace_stores
@ halide_target_feature_trace_stores
Trace all stores done by the pipeline. Equivalent to calling Func::trace_stores on every non-inlined ...
Definition: HalideRuntime.h:1300
Halide::Target::UserContext
@ UserContext
Definition: Target.h:88
Halide::get_target_from_environment
Target get_target_from_environment()
Return the target that Halide will use.
halide_target_feature_armv7s
@ halide_target_feature_armv7s
Generate code for ARMv7s. Only relevant for 32-bit ARM.
Definition: HalideRuntime.h:1252
halide_target_feature_msan
@ halide_target_feature_msan
Enable hooks for MSAN support.
Definition: HalideRuntime.h:1293
Halide::Target::has_gpu_feature
bool has_gpu_feature() const
Is a fully feature GPU compute runtime enabled? I.e.
Halide::Target::MIPS
@ MIPS
Definition: Target.h:43
Halide::Target::NoAsserts
@ NoAsserts
Definition: Target.h:60
halide_target_feature_tsan
@ halide_target_feature_tsan
Enable hooks for TSAN support.
Definition: HalideRuntime.h:1307
Halide::Target::HVX_128
@ HVX_128
Definition: Target.h:97
Halide::Target::bits
int bits
The bit-width of the target machine.
Definition: Target.h:51
halide_target_feature_fma
@ halide_target_feature_fma
Enable x86 FMA instruction.
Definition: HalideRuntime.h:1248
halide_target_feature_hvx_v65
@ halide_target_feature_hvx_v65
Enable Hexagon v65 architecture.
Definition: HalideRuntime.h:1303
Halide::Target::SSE41
@ SSE41
Definition: Target.h:62
halide_target_feature_cl_doubles
@ halide_target_feature_cl_doubles
Enable double support on OpenCL targets.
Definition: HalideRuntime.h:1269
uint64_t
unsigned __INT64_TYPE__ uint64_t
Definition: runtime_internal.h:19
Halide::Target::TraceLoads
@ TraceLoads
Definition: Target.h:109
Halide::Type
Types in the halide type system.
Definition: Type.h:269
Halide::Target::OSX
@ OSX
Definition: Target.h:27
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AddAtomicMutex.h:21
Halide::Target::FMA
@ FMA
Definition: Target.h:65
Halide::Target::Metal
@ Metal
Definition: Target.h:92
halide_target_feature_openglcompute
@ halide_target_feature_openglcompute
Enable OpenGL Compute runtime.
Definition: HalideRuntime.h:1273
Halide::Target::CUDACapability32
@ CUDACapability32
Definition: Target.h:74
Halide::Target::get_required_device_api
DeviceAPI get_required_device_api() const
If this Target (including all Features) requires a specific DeviceAPI, return it.
Halide::Target::OS
OS
The operating system used by the target.
Definition: Target.h:23
Halide::Target::supports_device_api
bool supports_device_api(DeviceAPI api) const
Returns whether a particular device API can be used with this Target.
Halide::Target::WasmSignExt
@ WasmSignExt
Definition: Target.h:122
halide_target_feature_profile
@ halide_target_feature_profile
Launch a sampling profiler alongside the Halide pipeline that monitors and reports the runtime used b...
Definition: HalideRuntime.h:1279
Halide::Target::OpenCL
@ OpenCL
Definition: Target.h:81
Halide::Target::Debug
@ Debug
Definition: Target.h:59
halide_target_feature_avx2
@ halide_target_feature_avx2
Use AVX 2 instructions. Only relevant on x86.
Definition: HalideRuntime.h:1247
halide_target_feature_avx512
@ halide_target_feature_avx512
Enable the base AVX512 subset supported by all AVX512 architectures. The specific feature sets are AV...
Definition: HalideRuntime.h:1294
Halide::Target::EnableLLVMLoopOpt
@ EnableLLVMLoopOpt
Definition: Target.h:119
Halide::Target::natural_vector_size
int natural_vector_size() const
Given a data type, return an estimate of the "natural" vector size for that data type when compiling ...
Definition: Target.h:260
halide_target_feature_end
@ halide_target_feature_end
A sentinel. Every target is considered to have this feature, and setting this feature does nothing.
Definition: HalideRuntime.h:1323
Halide::Target::FeatureEnd
@ FeatureEnd
Definition: Target.h:127
Halide::Target::F16C
@ F16C
Definition: Target.h:67
Halide::Target::RISCV
@ RISCV
Definition: Target.h:47
Halide::Target::maximum_buffer_size
int64_t maximum_buffer_size() const
Return the maximum buffer size in bytes supported on this Target.
Definition: Target.h:272
halide_target_feature_avx512_skylake
@ halide_target_feature_avx512_skylake
Enable the AVX512 features supported by Skylake Xeon server processors. This adds AVX512-VL,...
Definition: HalideRuntime.h:1296
Halide::Target::Windows
@ Windows
Definition: Target.h:26
Halide::Target::FMA4
@ FMA4
Definition: Target.h:66
Halide::Target::D3D12Compute
@ D3D12Compute
Definition: Target.h:113
halide_target_feature_opengl
@ halide_target_feature_opengl
Enable the OpenGL runtime.
Definition: HalideRuntime.h:1272
Halide::Target::AVX512_Skylake
@ AVX512_Skylake
Definition: Target.h:107
halide_target_feature_strict_float
@ halide_target_feature_strict_float
Turn off all non-IEEE floating-point optimization. Currently applies only to LLVM targets.
Definition: HalideRuntime.h:1306
Halide::Target::WebAssemblyRuntime
@ WebAssemblyRuntime
Definition: Target.h:33
halide_target_feature_wasm_simd128
@ halide_target_feature_wasm_simd128
Enable +simd128 instructions for WebAssembly codegen.
Definition: HalideRuntime.h:1315
halide_target_feature_user_context
@ halide_target_feature_user_context
Generated code takes a user_context pointer as first argument.
Definition: HalideRuntime.h:1275
Halide::Target::operator==
bool operator==(const Target &other) const
Definition: Target.h:218
Halide::Target::TraceRealizations
@ TraceRealizations
Definition: Target.h:111
Halide::Target::CLHalf
@ CLHalf
Definition: Target.h:83
Halide::Target::os
enum Halide::Target::OS os
Halide::Target::X86
@ X86
Definition: Target.h:41
halide_target_feature_jit
@ halide_target_feature_jit
Generate code that will run immediately inside the calling process.
Definition: HalideRuntime.h:1240
Halide::Target::CUDACapability35
@ CUDACapability35
Definition: Target.h:75
Halide::Target::VSX
@ VSX
Definition: Target.h:70
Halide::Target::feature_to_name
static std::string feature_to_name(Target::Feature feature)
Return the name corresponding to a given Feature, in the form used to construct Target strings (e....
halide_target_feature_no_asserts
@ halide_target_feature_no_asserts
Disable all runtime checks, for slightly tighter code.
Definition: HalideRuntime.h:1242
int64_t
signed __INT64_TYPE__ int64_t
Definition: runtime_internal.h:18
Halide::Target::NoRuntime
@ NoRuntime
Definition: Target.h:91
halide_target_feature_wasm_signext
@ halide_target_feature_wasm_signext
Enable +sign-ext instructions for WebAssembly codegen.
Definition: HalideRuntime.h:1316
halide_target_feature_no_neon
@ halide_target_feature_no_neon
Avoid using NEON instructions. Only relevant for 32-bit ARM.
Definition: HalideRuntime.h:1253
Halide::Target::CPlusPlusMangling
@ CPlusPlusMangling
Definition: Target.h:93
halide_target_feature_matlab
@ halide_target_feature_matlab
Generate a mexFunction compatible with Matlab mex libraries. See tools/mex_halide....
Definition: HalideRuntime.h:1277
halide_target_feature_hvx_v66
@ halide_target_feature_hvx_v66
Enable Hexagon v66 architecture.
Definition: HalideRuntime.h:1304
Halide::Target::CLAtomics64
@ CLAtomics64
Definition: Target.h:84
halide_target_feature_power_arch_2_07
@ halide_target_feature_power_arch_2_07
Use POWER ISA 2.07 new instructions. Only relevant on POWERPC.
Definition: HalideRuntime.h:1256
halide_target_feature_hvx_use_shared_object
@ halide_target_feature_hvx_use_shared_object
Deprecated.
Definition: HalideRuntime.h:1298
Halide::Target::Matlab
@ Matlab
Definition: Target.h:89
Type.h
halide_target_feature_large_buffers
@ halide_target_feature_large_buffers
Enable 64-bit buffer indexing to support buffers > 2GB. Ignored if bits != 64.
Definition: HalideRuntime.h:1286
halide_target_feature_opencl
@ halide_target_feature_opencl
Enable the OpenCL runtime.
Definition: HalideRuntime.h:1268
halide_target_feature_enable_llvm_loop_opt
@ halide_target_feature_enable_llvm_loop_opt
Enable loop vectorization + unrolling in LLVM. Overrides halide_target_feature_disable_llvm_loop_opt....
Definition: HalideRuntime.h:1313
Halide::Target::validate_target_string
static bool validate_target_string(const std::string &s)
Check if a target string is valid.
halide_target_feature_cuda_capability61
@ halide_target_feature_cuda_capability61
Enable CUDA compute capability 6.1 (Pascal)
Definition: HalideRuntime.h:1263
halide_target_feature_disable_llvm_loop_opt
@ halide_target_feature_disable_llvm_loop_opt
Disable loop vectorization + unrolling in LLVM. (Ignored for non-LLVM targets.)
Definition: HalideRuntime.h:1314
halide_target_feature_trace_pipeline
@ halide_target_feature_trace_pipeline
Trace the pipeline.
Definition: HalideRuntime.h:1302
Halide::Target::HVX_64
@ HVX_64
Definition: Target.h:96
halide_target_feature_cuda_capability75
@ halide_target_feature_cuda_capability75
Enable CUDA compute capability 7.5 (Turing)
Definition: HalideRuntime.h:1265
DeviceAPI.h
Halide::Target::POWERPC
@ POWERPC
Definition: Target.h:45
Halide::Target::CUDACapability50
@ CUDACapability50
Definition: Target.h:76
halide_target_feature_cuda_capability50
@ halide_target_feature_cuda_capability50
Enable CUDA compute capability 5.0 (Maxwell)
Definition: HalideRuntime.h:1262
halide_target_feature_trace_realizations
@ halide_target_feature_trace_realizations
Trace all realizations done by the pipeline. Equivalent to calling Func::trace_realizations on every ...
Definition: HalideRuntime.h:1301
Halide::Target::CUDACapability75
@ CUDACapability75
Definition: Target.h:79
Halide::Target::HVX_v65
@ HVX_v65
Definition: Target.h:99
halide_target_feature_hvx_128
@ halide_target_feature_hvx_128
Enable HVX 128 byte mode.
Definition: HalideRuntime.h:1289
Halide::Target::Fuchsia
@ Fuchsia
Definition: Target.h:32
Halide::Target::AVX512_Cannonlake
@ AVX512_Cannonlake
Definition: Target.h:108
Halide::Target::QuRT
@ QuRT
Definition: Target.h:30
Halide::Target::TracePipeline
@ TracePipeline
Definition: Target.h:112
Halide::Target::set_features
void set_features(const std::vector< Feature > &features_to_set, bool value=true)
Halide::Target::WasmSimd128
@ WasmSimd128
Definition: Target.h:121
Halide::Target::POWER_ARCH_2_07
@ POWER_ARCH_2_07
Definition: Target.h:71
Halide::Internal::target_test
void target_test()
Halide::Target::IOS
@ IOS
Definition: Target.h:29
Halide::Target::NoOS
@ NoOS
Definition: Target.h:31
halide_target_feature_cuda_capability70
@ halide_target_feature_cuda_capability70
Enable CUDA compute capability 7.0 (Volta)
Definition: HalideRuntime.h:1264
halide_target_feature_cuda_capability35
@ halide_target_feature_cuda_capability35
Enable CUDA compute capability 3.5 (Kepler)
Definition: HalideRuntime.h:1261
Halide::Target::supported
bool supported() const
Was libHalide compiled with support for this target?
Halide::Target::TSAN
@ TSAN
Definition: Target.h:115
halide_target_feature_cuda_capability30
@ halide_target_feature_cuda_capability30
Enable CUDA compute capability 3.0 (Kepler)
Definition: HalideRuntime.h:1259
halide_target_feature_cl_atomic64
@ halide_target_feature_cl_atomic64
Enable 64-bit atomics operations on OpenCL targets.
Definition: HalideRuntime.h:1270
halide_target_feature_debug
@ halide_target_feature_debug
Turn on debug info and output for runtime code.
Definition: HalideRuntime.h:1241
Halide::Target::CUDACapability70
@ CUDACapability70
Definition: Target.h:78
Halide::Target::CheckUnsafePromises
@ CheckUnsafePromises
Definition: Target.h:117
halide_target_feature_avx
@ halide_target_feature_avx
Use AVX 1 instructions. Only relevant on x86.
Definition: HalideRuntime.h:1246
HalideRuntime.h
Halide::Target::Arch
Arch
The architecture used by the target.
Definition: Target.h:39
halide_target_feature_soft_float_abi
@ halide_target_feature_soft_float_abi
Enable soft float ABI. This only enables the soft float ABI calling convention, which does not necess...
Definition: HalideRuntime.h:1292
Halide::Target::ASAN
@ ASAN
Definition: Target.h:116
Halide::Target::HVX_v62
@ HVX_v62
Definition: Target.h:98
Halide::Target::with_feature
Target with_feature(Feature f) const
Return a copy of the target with the given feature set.
halide_target_feature_cuda
@ halide_target_feature_cuda
Enable the CUDA runtime. Defaults to compute capability 2.0 (Fermi)
Definition: HalideRuntime.h:1258
Halide::Target::EGL
@ EGL
Definition: Target.h:87
halide_target_feature_fuzz_float_stores
@ halide_target_feature_fuzz_float_stores
On every floating point store, set the last bit of the mantissa to zero. Pipelines for which the outp...
Definition: HalideRuntime.h:1291
halide_target_feature_avx512_knl
@ halide_target_feature_avx512_knl
Enable the AVX512 features supported by Knight's Landing chips, such as the Xeon Phi x200....
Definition: HalideRuntime.h:1295
halide_target_feature_cuda_capability80
@ halide_target_feature_cuda_capability80
Enable CUDA compute capability 8.0 (Ampere)
Definition: HalideRuntime.h:1266
halide_target_feature_check_unsafe_promises
@ halide_target_feature_check_unsafe_promises
Insert assertions for promises.
Definition: HalideRuntime.h:1310
Halide::get_jit_target_from_environment
Target get_jit_target_from_environment()
Return the target that Halide will use for jit-compilation.
Halide::Target::arch
enum Halide::Target::Arch arch
Halide::Target::get_runtime_compatible_target
bool get_runtime_compatible_target(const Target &other, Target &result)
Create a "greatest common denominator" runtime target that is compatible with both this target and ot...
Halide::Target::ArchUnknown
@ ArchUnknown
Definition: Target.h:40
Halide::Target::Hexagon
@ Hexagon
Definition: Target.h:44
Halide::Target::has_feature
bool has_feature(halide_target_feature_t f) const
Definition: Target.h:167
Halide::Target::EmbedBitcode
@ EmbedBitcode
Definition: Target.h:118
Halide::Target::OpenGL
@ OpenGL
Definition: Target.h:85
halide_target_feature_avx512_cannonlake
@ halide_target_feature_avx512_cannonlake
Enable the AVX512 features expected to be supported by future Cannonlake processors....
Definition: HalideRuntime.h:1297
halide_target_feature_egl
@ halide_target_feature_egl
Force use of EGL support.
Definition: HalideRuntime.h:1320
halide_target_feature_trace_loads
@ halide_target_feature_trace_loads
Trace all loads done by the pipeline. Equivalent to calling Func::trace_loads on every non-inlined Fu...
Definition: HalideRuntime.h:1299
Halide::Target::AVX2
@ AVX2
Definition: Target.h:64
Halide::Target::StrictFloat
@ StrictFloat
Definition: Target.h:114
halide_target_feature_c_plus_plus_mangling
@ halide_target_feature_c_plus_plus_mangling
Generate C++ mangled names for result function, et al.
Definition: HalideRuntime.h:1284
halide_target_feature_wasm_sat_float_to_int
@ halide_target_feature_wasm_sat_float_to_int
Enable saturating (nontrapping) float-to-int instructions for WebAssembly codegen.
Definition: HalideRuntime.h:1317
Halide::Target::get_cuda_capability_lower_bound
int get_cuda_capability_lower_bound() const
Get the minimum cuda capability found as an integer.
halide_target_feature_sve2
@ halide_target_feature_sve2
Enable ARM Scalable Vector Extensions v2.
Definition: HalideRuntime.h:1319
halide_target_feature_metal
@ halide_target_feature_metal
Enable the (Apple) Metal runtime.
Definition: HalideRuntime.h:1282
Halide::Target::ARMDotProd
@ ARMDotProd
Definition: Target.h:126
Halide::Target::HVX_v66
@ HVX_v66
Definition: Target.h:100
Halide::Target::ARMv7s
@ ARMv7s
Definition: Target.h:68
halide_target_feature_hexagon_dma
@ halide_target_feature_hexagon_dma
Enable Hexagon DMA buffers.
Definition: HalideRuntime.h:1311
Halide::Target::NoBoundsQuery
@ NoBoundsQuery
Definition: Target.h:61
halide_target_feature_vsx
@ halide_target_feature_vsx
Use VSX instructions. Only relevant on POWERPC.
Definition: HalideRuntime.h:1255
halide_target_feature_hvx_v62
@ halide_target_feature_hvx_v62
Enable Hexagon v62 architecture.
Definition: HalideRuntime.h:1290
halide_target_feature_hvx_64
@ halide_target_feature_hvx_64
Enable HVX 64 byte mode.
Definition: HalideRuntime.h:1288
Halide::Target::without_feature
Target without_feature(Feature f) const
Return a copy of the target with the given feature cleared.
halide_target_feature_fma4
@ halide_target_feature_fma4
Enable x86 (AMD) FMA4 instruction set.
Definition: HalideRuntime.h:1249
Halide::Target::ARM
@ ARM
Definition: Target.h:42
Halide::Target::OSUnknown
@ OSUnknown
Definition: Target.h:24
Halide::Target::SoftFloatABI
@ SoftFloatABI
Definition: Target.h:103
Halide::Target
A struct representing a target machine and os to generate code for.
Definition: Target.h:19
Halide::Target::features_any_of
bool features_any_of(const std::vector< Feature > &test_features) const
Halide::Target::CUDACapability80
@ CUDACapability80
Definition: Target.h:80
Halide::Target::Target
Target(OS o, Arch a, int b, const std::vector< Feature > &initial_features=std::vector< Feature >())
Definition: Target.h:132
halide_target_feature_arm_dot_prod
@ halide_target_feature_arm_dot_prod
Enable ARMv8.2-a dotprod extension (i.e. udot and sdot instructions)
Definition: HalideRuntime.h:1322
Halide::Target::CUDACapability61
@ CUDACapability61
Definition: Target.h:77
Halide::Target::AVX512
@ AVX512
Definition: Target.h:105
Halide::Target::CUDA
@ CUDA
Definition: Target.h:72
halide_target_feature_f16c
@ halide_target_feature_f16c
Enable x86 16-bit float support.
Definition: HalideRuntime.h:1250
Halide::Target::has_large_buffers
bool has_large_buffers() const
Return true iff 64 bits and has_feature(LargeBuffers).
Definition: Target.h:265
Halide::Target::LargeBuffers
@ LargeBuffers
Definition: Target.h:94
Halide::DeviceAPI
DeviceAPI
An enum describing a type of device API.
Definition: DeviceAPI.h:15
Halide::Target::SVE
@ SVE
Definition: Target.h:124
Halide::Target::OpenGLCompute
@ OpenGLCompute
Definition: Target.h:86