12#ifndef ARCANE_UTILS_SIMD_H 
   13#define ARCANE_UTILS_SIMD_H 
   17#include "arcane/utils/SimdCommon.h" 
   18#include "arcane/utils/Real3.h" 
   19#include "arcane/utils/Real2.h" 
   20#include "arcane/utils/Real3x3.h" 
   21#include "arcane/utils/Real2x2.h" 
   22#include "arcane/utils/ArrayView.h" 
   72#include "arcane/utils/SimdEMUL.h" 
   75#if (defined(_M_X64) || defined(__x86_64__)) && !defined(ARCANE_NO_SSE) 
   81#include "arcane/utils/SimdSSE.h" 
   85#if defined(ARCANE_HAS_AVX) || defined(ARCANE_HAS_AVX512) 
   87#include "arcane/utils/SimdAVX.h" 
   91#if defined(ARCANE_HAS_AVX512) 
   93#include "arcane/utils/SimdAVX512.h" 
  103#define ENUMERATE_SIMD_REAL(_iter) \ 
  104  for( ::Arcane::Integer _iter(0); _iter < SimdReal ::BLOCK_SIZE; ++ _iter ) 
 
  109ARCANE_BEGIN_NAMESPACE
 
  117#if defined(ARCANE_HAS_AVX512) 
  118typedef AVX512SimdInfo SimdInfo;
 
  119#elif defined(ARCANE_HAS_AVX) 
  120typedef AVXSimdInfo SimdInfo;
 
  121#elif defined(ARCANE_HAS_SSE) 
  122typedef SSESimdInfo SimdInfo;
 
  124typedef EMULSimdInfo SimdInfo;
 
  135const int SimdSize = SimdReal::Length;
 
  149class ARCANE_UTILS_EXPORT SimdReal3
 
  152  typedef SimdReal::Int32IndexType Int32IndexType;
 
  159  SimdReal3(
const Real3* base,
const Int32IndexType& idx)
 
  161    for( 
Integer i=0, n=SimdReal::BLOCK_SIZE; i<n; ++i ){
 
  162      Real3 v = base[idx[i]];
 
  168  void set(
Real3* base,
const Int32IndexType& idx)
 const 
  170    for( 
Integer i=0, n=SimdReal::BLOCK_SIZE; i<n; ++i ){
 
  171      base[idx[i]] = this->get(i);
 
  184    return Real3(x[i],y[i],z[i]);
 
 
  194class ARCANE_UTILS_EXPORT SimdReal2
 
  197  typedef SimdReal::Int32IndexType Int32IndexType;
 
  203  SimdReal2(
const Real2* base,
const Int32IndexType& idx)
 
  205    for( 
Integer i=0, n=SimdReal::BLOCK_SIZE; i<n; ++i ){
 
  206      Real2 v = base[idx[i]];
 
  212  void set(
Real2* base,
const Int32IndexType& idx)
 const 
  214    for( 
Integer i=0, n=SimdReal::BLOCK_SIZE; i<n; ++i ){
 
  215      base[idx[i]] = this->get(i);
 
  226    return Real2(x[i],y[i]);
 
 
  236class ARCANE_UTILS_EXPORT SimdReal3x3
 
  239  typedef SimdReal::Int32IndexType Int32IndexType;
 
  246  SimdReal3x3(
const Real3x3* base,
const Int32IndexType& idx)
 
  248    for( 
Integer i=0, n=SimdReal::BLOCK_SIZE; i<n; ++i ){
 
  255  void set(
Real3x3* base,
const Int32IndexType& idx)
 const 
  257    for( 
Integer i=0, n=SimdReal::BLOCK_SIZE; i<n; ++i ){
 
  258      base[idx[i]] = this->get(i);
 
  271    return Real3x3(x[i],y[i],z[i]);
 
 
  281class ARCANE_UTILS_EXPORT SimdReal2x2
 
  284  typedef SimdReal::Int32IndexType Int32IndexType;
 
  290  SimdReal2x2(
const Real2x2* base,
const Int32IndexType& idx)
 
  292    for( 
Integer i=0, n=SimdReal::BLOCK_SIZE; i<n; ++i ){
 
  299  void set(
Real2x2* base,
const Int32IndexType& idx)
 const 
  301    for( 
Integer i=0, n=SimdReal::BLOCK_SIZE; i<n; ++i ){
 
  302      base[idx[i]] = this->get(i);
 
 
  328template<
typename DataType>
 
  332  typedef void SimdType;
 
 
  379class ARCANE_UTILS_EXPORT SimdEnumeratorBase
 
  383  typedef SimdInfo::SimdInt32IndexType SimdIndexType;
 
  388  : m_local_ids(
nullptr), m_index(0), m_count(0) { }
 
  390  : m_local_ids(local_ids), m_index(0), m_count(n)
 
  393  : m_local_ids(local_ids.data()), m_index(0), m_count(local_ids.size())
 
  398  bool hasNext() { 
return m_index<m_count; }
 
  403  void operator++() { m_index += SimdSize; }
 
  411    Integer nb_valid = (m_count-m_index);
 
  412    if (nb_valid>SimdSize)
 
 
  417  Integer count()
 const { 
return m_count; }
 
  421  const Int32* ARCANE_RESTRICT m_local_ids;
 
  425  const SimdIndexType* ARCANE_RESTRICT
 
  426  _currentSimdIndex()
 const 
  428    return (
const SimdIndexType*)(m_local_ids+m_index);
 
  436#ifdef ARCANE_SIMD_BENCH 
  437    Int64 modulo = (Int64)(m_local_ids) % SimdIndexType::Alignment;
 
  439      throw BadAlignmentException();
 
  445  void _checkValidHelper();
 
 
Classe gérant un vecteur de réel de dimension 2.
Classe gérant une matrice de réel de dimension 2x2.
Real2 x
Première composante.
Real2 y
Deuxième composante.
Classe gérant un vecteur de réel de dimension 3.
Classe gérant une matrice de réel de dimension 3x3.
Real3 z
premier élément du triplet
Real3 y
premier élément du triplet
Real3 x
premier élément du triplet
const Int32 * unguardedLocalIds() const
Indices locaux.
Integer nbValid() const
Nombre de valeurs valides pour l'itérateur courant.
Représente un Real2 vectoriel.
Représente un Real2x2 vectoriel.
Représente un Real3 vectoriel.
Représente un Real3x3 vectoriel.
Charactéristiques des types vectoriels.
SimdInfo::SimdReal SimdReal
Vecteur SIMD de réel.
Int32 Integer
Type représentant un entier.
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
double Real
Type représentant un réel.
std::int32_t Int32
Type entier signé sur 32 bits.
Real y
deuxième composante du couple
Real x
première composante du couple
Real y
deuxième composante du triplet
Real z
troisième composante du triplet
Real x
première composante du triplet