8 #ifndef META_OCEAN_BASE_PROCESSOR_H
9 #define META_OCEAN_BASE_PROCESSOR_H
94 template <ProcessorInstructions tHighestInstructions, ProcessorInstructions tNecessaryInstruction>
122 inline unsigned int cores()
const;
184 template <
bool tIndependentOfBinary>
191 static inline bool isLittleEndian();
200 #if defined(__APPLE__)
209 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE==1
230 unsigned int forcedCores_ = 0u;
272 template <ProcessorInstructions tHighestInstructions>
286 template <ProcessorInstructions tHighestInstructions>
300 template <ProcessorInstructions tHighestInstructions>
314 template <ProcessorInstructions tHighestInstructions>
328 template <ProcessorInstructions tHighestInstructions>
342 template <ProcessorInstructions tHighestInstructions>
356 template <ProcessorInstructions tHighestInstructions>
370 template <ProcessorInstructions tHighestInstructions>
384 template <ProcessorInstructions tHighestInstructions>
398 template <ProcessorInstructions tHighestInstructions>
407 template <
bool tIndependentOfBinary>
446 #if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 41 && defined(OCEAN_HARDWARE_AVX_VERSION) && OCEAN_HARDWARE_AVX_VERSION >= 20
453 #if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 41
460 #if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 20 && defined(OCEAN_HARDWARE_AVX_VERSION) && OCEAN_HARDWARE_AVX_VERSION >= 20
467 #if defined(OCEAN_HARDWARE_AVX_VERSION) && OCEAN_HARDWARE_AVX_VERSION >= 20
474 #if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 20
481 #if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
495 const int32_t littleEndianValue = 1;
497 const bool result = (*(int8_t*)(&littleEndianValue)) == int8_t(1);
499 #ifdef OCEAN_LITTLE_ENDIAN
500 ocean_assert(result);
502 ocean_assert(!result);
This class implements a recursive lock object.
Definition: Lock.h:31
This class implements basic functions relating the system processor.
Definition: base/Processor.h:111
Lock lock_
The lock of the processor class.
Definition: base/Processor.h:239
bool forceCores(const unsigned int cores)
Forces a user defined number of processor cores.
ProcessorInstructions instructions()
Returns the supported instruction set of the processor.
Definition: base/Processor.h:254
ProcessorInstructions forcedProcessorInstructions_
Explicitly forced CPU instructions.
Definition: base/Processor.h:233
static std::string deviceModelAppleIOS()
Returns the device name of the Apple iOS device.
static unsigned int realCores()
Returns the number of available processor cores currently detectable.
static ProcessorInstructions bestInstructionGroup(const ProcessorInstructions instructions)
Returns the best group of instructions value for a set of given processor instructions.
Definition: base/Processor.h:408
ProcessorInstructions processorInstructions_
The real instructions of the processor.
Definition: base/Processor.h:236
static ProcessorInstructions realInstructions()
Returns the supported instruction set of the processor.
bool forceInstructions(const ProcessorInstructions instructions)
Forces a user-defined processor instruction set.
static std::string brand()
Returns the processor's brand.
static constexpr ProcessorInstructions invalidProcessorInstructions()
Returns invalid processor instructions.
Definition: base/Processor.h:508
static std::string translateInstructions(const ProcessorInstructions instructions)
Translates a set of processor instructions to a readable string.
static bool isLittleEndian()
Returns whether the processor/system is using the little endian convention (like e....
Definition: base/Processor.h:493
unsigned int forcedCores_
Explicitly forced number of processor cores.
Definition: base/Processor.h:230
static unsigned int realCoresApple()
Returns the number of available processor cores currently detectable.
unsigned int cores() const
Returns the number of available processor cores.
Definition: base/Processor.h:242
Processor()
Constructs a new processor object.
This helper class allows to determine a compile-time known boolean statement whether a set of availab...
Definition: base/Processor.h:96
This class implements a scoped lock object for recursive lock objects.
Definition: Lock.h:135
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
ProcessorInstructions
Definition of individual processor instruction types.
Definition: base/Processor.h:22
@ PI_AVX
AVX instructions.
Definition: base/Processor.h:41
@ PI_SSE_3
SSE3 instructions.
Definition: base/Processor.h:30
@ PI_NONE
Unknown processor instruction set.
Definition: base/Processor.h:24
@ PI_GROUP_AVX_2_SSE_2
All AVX instructions between (including) AVX and AVX2 and SSE instructions between (including) SSE an...
Definition: base/Processor.h:64
@ PI_GROUP_AVX_2
All AVX instructions between (including) AVX and AVX2.
Definition: base/Processor.h:62
@ PI_SSE_4_1
SSE_4.1 instructions.
Definition: base/Processor.h:34
@ PI_GROUP_SSE_4_1
All SSE instructions between (including) SSE and SSE4.1.
Definition: base/Processor.h:60
@ PI_NEON_ANY
Any NEON instructions.
Definition: base/Processor.h:52
@ PI_SSE_4_2
SSE 4.2 instructions.
Definition: base/Processor.h:36
@ PI_SSE_2
SEE2 instructions.
Definition: base/Processor.h:28
@ PI_AVX_ANY
Any AVX instructions.
Definition: base/Processor.h:47
@ PI_NEON
NEON instructions.
Definition: base/Processor.h:50
@ PI_SSE_ANY
Any SSE instructions.
Definition: base/Processor.h:38
@ PI_AVX_512
AVX 512 instructions.
Definition: base/Processor.h:45
@ PI_AVX_2
AVX2 instructions.
Definition: base/Processor.h:43
@ PI_SSE
SEE instructions.
Definition: base/Processor.h:26
@ PI_GROUP_AVX_2_SSE_4_1
All AVX instructions between (including) AVX and AVX2 and SSE instructions between (including) SSE an...
Definition: base/Processor.h:68
@ PI_GROUP_SSE_2
All SSE instructions between (including) SSE and SSE2.
Definition: base/Processor.h:58
@ PI_GROUP_NEON
All NEON instructions (which is currently NEON only).
Definition: base/Processor.h:66
@ PI_AES
AES instructions.
Definition: base/Processor.h:55
@ PI_SSSE_3
SSSE3 instructions.
Definition: base/Processor.h:32
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15