8#ifndef META_OCEAN_BASE_PROCESSOR_H
9#define META_OCEAN_BASE_PROCESSOR_H
94template <ProcessorInstructions tHighestInstructions, ProcessorInstructions tNecessaryInstruction>
122 inline unsigned int cores()
const;
184 template <
bool tIndependentOfBinary>
218#if defined(__APPLE__)
227 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE==1
290template <ProcessorInstructions tHighestInstructions>
304template <ProcessorInstructions tHighestInstructions>
318template <ProcessorInstructions tHighestInstructions>
332template <ProcessorInstructions tHighestInstructions>
346template <ProcessorInstructions tHighestInstructions>
360template <ProcessorInstructions tHighestInstructions>
374template <ProcessorInstructions tHighestInstructions>
388template <ProcessorInstructions tHighestInstructions>
402template <ProcessorInstructions tHighestInstructions>
416template <ProcessorInstructions tHighestInstructions>
425template <
bool tIndependentOfBinary>
464#if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 41 && defined(OCEAN_HARDWARE_AVX_VERSION) && OCEAN_HARDWARE_AVX_VERSION >= 20
471#if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 41
478#if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 20 && defined(OCEAN_HARDWARE_AVX_VERSION) && OCEAN_HARDWARE_AVX_VERSION >= 20
485#if defined(OCEAN_HARDWARE_AVX_VERSION) && OCEAN_HARDWARE_AVX_VERSION >= 20
492#if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 20
499#if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
513 const int32_t littleEndianValue = 1;
515 const bool result = (*(int8_t*)(&littleEndianValue)) == int8_t(1);
517#ifdef OCEAN_LITTLE_ENDIAN
518 ocean_assert(result);
520 ocean_assert(!result);
This class implements a recursive lock object.
Definition Lock.h:31
Lock lock_
The lock of the processor class.
Definition base/Processor.h:257
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:272
ProcessorInstructions forcedProcessorInstructions_
Explicitly forced CPU instructions.
Definition base/Processor.h:251
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:426
ProcessorInstructions processorInstructions_
The real instructions of the processor.
Definition base/Processor.h:254
static ProcessorInstructions realInstructions()
Returns the supported instruction set of the processor.
bool forceInstructions(const ProcessorInstructions instructions)
Forces a user-defined processor instruction set.
static bool virtualCountRegister(uint64_t &counter)
Returns the current value of the ARM Generic Timer virtual counter register CNTVCT.
static std::string brand()
Returns the processor's brand.
static constexpr ProcessorInstructions invalidProcessorInstructions()
Returns invalid processor instructions.
Definition base/Processor.h:526
static std::string translateInstructions(const ProcessorInstructions instructions)
Translates a set of processor instructions to a readable string.
static bool virtualCountFrequency(uint64_t &frequency)
Returns the frequency of the ARM Generic Timer virtual count register CNTVCT from the system counter ...
static bool isLittleEndian()
Returns whether the processor/system is using the little endian convention (like e....
Definition base/Processor.h:511
unsigned int forcedCores_
Explicitly forced number of processor cores.
Definition base/Processor.h:248
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:260
Processor()
Constructs a new processor object.
static constexpr bool value
True, if the requested instruction is part of the provided set of instructions.
Definition base/Processor.h:380
static constexpr bool value
True, if the requested instruction is part of the provided set of instructions.
Definition base/Processor.h:394
static constexpr bool value
True, if the requested instruction is part of the provided set of instructions.
Definition base/Processor.h:408
static constexpr bool value
True, if the requested instruction is part of the provided set of instructions.
Definition base/Processor.h:422
static constexpr bool value
True, if the requested instruction is part of the provided set of instructions.
Definition base/Processor.h:296
static constexpr bool value
True, if the requested instruction is part of the provided set of instructions.
Definition base/Processor.h:310
static constexpr bool value
True, if the requested instruction is part of the provided set of instructions.
Definition base/Processor.h:324
static constexpr bool value
True, if the requested instruction is part of the provided set of instructions.
Definition base/Processor.h:352
static constexpr bool value
True, if the requested instruction is part of the provided set of instructions.
Definition base/Processor.h:366
static constexpr bool value
True, if the requested instruction is part of the provided set of instructions.
Definition base/Processor.h:338
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:147
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