godot/thirdparty/embree/common/sys/sysinfo.h

// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#pragma once

#define CACHELINE_SIZE

#if !defined(PAGE_SIZE)
  #define PAGE_SIZE
#endif

#define PAGE_SIZE_2M
#define PAGE_SIZE_4K

#include "platform.h"

/* define isa namespace and ISA bitvector */
#if defined (__AVX512VL__)
#define isa
#define ISA
#define ISA_STR
#elif defined (__AVX2__)
#define isa
#define ISA
#define ISA_STR
#elif defined(__AVXI__)
#define isa
#define ISA
#define ISA_STR
#elif defined(__AVX__)
#define isa
#define ISA
#define ISA_STR
#elif defined (__SSE4_2__)
#define isa
#define ISA
#define ISA_STR
//#elif defined (__SSE4_1__) //  we demote this to SSE2, MacOSX code compiles with SSE41 by default with XCode 11
//#  define isa sse41
//#  define ISA SSE41
//#  define ISA_STR "SSE4.1"
//#elif defined(__SSSE3__) // we demote this to SSE2, MacOSX code compiles with SSSE3 by default with ICC
//#  define isa ssse3
//#  define ISA SSSE3
//#  define ISA_STR "SSSE3"
//#elif defined(__SSE3__) // we demote this to SSE2, MacOSX code compiles with SSE3 by default with clang
//#  define isa sse3
//#  define ISA SSE3
//#  define ISA_STR "SSE3"
#elif defined(__SSE2__) || defined(__SSE3__) || defined(__SSSE3__)
#define isa
#define ISA
#define ISA_STR
#elif defined(__SSE__)
#define isa
#define ISA
#define ISA_STR
#elif defined(__ARM_NEON)
// NOTE(LTE): Use sse2 for `isa` for the compatibility at the moment.
#define isa
#define ISA
#define ISA_STR
#else
#error Unknown ISA
#endif

namespace embree
{
  enum class CPU
  {};
  
  /*! get the full path to the running executable */
  std::string getExecutableFileName();

  /*! return platform name */
  std::string getPlatformName();

  /*! get the full name of the compiler */
  std::string getCompilerName();

  /*! return the name of the CPU */
  std::string getCPUVendor();

  /*! get microprocessor model */
  CPU getCPUModel(); 

  /*! converts CPU model into string */
  std::string stringOfCPUModel(CPU model);

  /*! CPU features */
  static const int CPU_FEATURE_SSE    =;
  static const int CPU_FEATURE_SSE2   =;
  static const int CPU_FEATURE_SSE3   =;
  static const int CPU_FEATURE_SSSE3  =;
  static const int CPU_FEATURE_SSE41  =;
  static const int CPU_FEATURE_SSE42  =; 
  static const int CPU_FEATURE_POPCNT =;
  static const int CPU_FEATURE_AVX    =;
  static const int CPU_FEATURE_F16C   =;
  static const int CPU_FEATURE_RDRAND =;
  static const int CPU_FEATURE_AVX2   =;
  static const int CPU_FEATURE_FMA3   =;
  static const int CPU_FEATURE_LZCNT  =;
  static const int CPU_FEATURE_BMI1   =;
  static const int CPU_FEATURE_BMI2   =;
  static const int CPU_FEATURE_AVX512F =;
  static const int CPU_FEATURE_AVX512DQ =;    
  static const int CPU_FEATURE_AVX512PF =;
  static const int CPU_FEATURE_AVX512ER =;
  static const int CPU_FEATURE_AVX512CD =;
  static const int CPU_FEATURE_AVX512BW =;
  static const int CPU_FEATURE_AVX512VL =;
  static const int CPU_FEATURE_AVX512IFMA =;
  static const int CPU_FEATURE_AVX512VBMI =;
  static const int CPU_FEATURE_XMM_ENABLED =;
  static const int CPU_FEATURE_YMM_ENABLED =;
  static const int CPU_FEATURE_ZMM_ENABLED =;
  static const int CPU_FEATURE_NEON =;
  static const int CPU_FEATURE_NEON_2X =;

  /*! get CPU features */
  int getCPUFeatures();

  /*! convert CPU features into a string */
  std::string stringOfCPUFeatures(int features);

  /*! creates a string of all supported targets that are supported */
  std::string supportedTargetList (int isa);

  /*! ISAs */
  static const int SSE    =; 
  static const int SSE2   =;
  static const int SSE3   =;
  static const int SSSE3  =;
  static const int SSE41  =;
  static const int SSE42  =;
  static const int AVX    =;
  static const int AVXI   =;
  static const int AVX2   =;
  static const int AVX512 =;
  static const int NEON =;
  static const int NEON_2X =;

  /*! converts ISA bitvector into a string */
  std::string stringOfISA(int features);

  /*! return the number of logical threads of the system */
  unsigned int getNumberOfLogicalThreads();

  /*! returns the size of the terminal window in characters */
  int getTerminalWidth();

  /*! returns performance counter in seconds */
  double getSeconds();

  /*! sleeps the specified number of seconds */
  void sleepSeconds(double t);

  /*! returns virtual address space occupied by process */
  size_t getVirtualMemoryBytes();

  /*! returns resident memory required by process */
  size_t getResidentMemoryBytes();
}