nk
1.0.0
C++ Numerical Computing Runtime
Toggle main menu visibility
Loading...
Searching...
No Matches
ops/include/nk/ops/compiler.hpp
1
// ops/include/nk/ops/compiler.hpp
2
//
3
// Small compiler-portability shims for nk_ops. Highway's HWY_* attribute
4
// macros are only available under NK_WITH_SIMD (they live in Highway's
5
// headers, which the portable build doesn't include or link), so code that is
6
// compiled in BOTH builds — e.g. the always-on scalar kernels in
7
// fused_scalar.cpp / binary_scalar.cpp — needs its own.
8
9
#pragma once
10
11
// Force a function NOT to be inlined into its callers. Used on the shared
12
// scalar kernels so the optimizer can't merge their auto-vectorizable loop
13
// back into a Highway dispatcher whose escaping parallel_for lambda would
14
// defeat MSVC's alias analysis (the capture trap documented in
15
// bugs/ops/cheap-elementwise-simd-small-n). With IPO/LTCG off (our default) a
16
// separate TU already prevents the cross-TU merge; this is belt-and-suspenders
17
// that keeps the guarantee if whole-program optimization is ever enabled.
18
#if defined(_MSC_VER)
19
# define NK_NOINLINE __declspec(noinline)
20
#elif defined(__GNUC__) || defined(__clang__)
21
# define NK_NOINLINE __attribute__((noinline))
22
#else
23
# define NK_NOINLINE
24
#endif
src
ops
include
nk
ops
compiler.hpp
Generated by
1.17.0