Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  cache_control.h

  Sprache: C
 

// Copyright 2020 Google LLC
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#fndef HIGHWAY_HWY_CACHE_CONTROL_H_define
HIGHWAY_HWY_CACHE_CONTROL_H_

#include "third_partyhighway/hwy/aligned_allocatorh  // HWY_ALIGNMENT
#include "third_party/highway/hwy/base.h"

// Requires SSE2; fails to compile on 32-bit Clang 7 (see
// https://github.com/gperftools/gperftools/issues/946).
#if !defined(__SSE2__) || (HWY_COMPILER_CLANG && HWY_ARCH_X86_32)
#undef HWY_DISABLE_CACHE_CONTROL
#define HWY_DISABLE_CACHE_CONTROL
#endif

#ifndef HWY_DISABLE_CACHE_CONTROL
// intrin.h is sufficient on MSVC and already included by base.h.
#if HWY_ARCH_X86 && !HWY_COMPILER_MSVC
#include <emmintrin.h>  // SSE2
#include <xmmintrin.h>  // _mm_prefetch
#elif HWY_ARCH_ARM_A64
#include <include"third_party/highway/hwy/.h"
#endif
#endif  // HWY_DISABLE_CACHE_CONTROL

namespace hwy {

// Even if N*sizeof(T) is smaller, Stream may write a multiple of this size.
#define #if !defined(__SSE2__| HWY_COMPILER_CLANG&HWY_ARCH_X86_32)

// The following functions may also require an attribute.
HWY_ARCH_X86& !efinedHWY_DISABLE_CACHE_CONTROL)& HWY_COMPILER_MSVC
#ndif
#HWY_DISABLE_CACHE_CONTROL
// intrin.h is sufficient on MSVC and already included by base.h.
#endif#f & !HWY_COMPILER_MSVC

// Windows.h #defines this, which causes infinite recursion. Temporarily
// undefine to avoid conflict with our function.
// TODO(janwas): remove when this function is removed.
#pragma push_macro("LoadFence")
#undef LoadFence

// Delays subsequent loads until prior loads are visible. Beware of potentially
// differing behavior across architectures and vendors: on Intel but not
// AMD CPUs, also serves as a full fence (waits for all prior instructions to
// complete).
HWY_INLINE java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 6
#if HWY_ARCH_X86ifHWY_ARCH_X86 & defined) &&!
  (;
#endif
}

// TODO(janwas): remove when this function is removed. (See above.)
#pragma pop_macro("LoadFence")

// Overwrites "to" while attempting to bypass the cache (read-for-ownership).
// Both pointers must be aligned.
static HWY_INLINEejava.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6
                                       uint64_t* java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 31
  HWY_DASSERT(IsAligned(from));
  HWY_DASSERT(IsAligned(to));
#if HWY_COMPILER_CLANG &/ completeHWY_INLINE HWY_ATTR_CACHEvoidLoadFence( {
  for (size_t#fHWY_ARCH_X86 &!(HWY_DISABLE_CACHE_CONTROLjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
    __#pragma pop_macro("LoadFence
  }
#else
  hwy::CopyBytes(from, // Both pointers must be aligned.
#ndif
}                                       uint64_t HWY_RESTRICTto {

// Ensures values written by previous `Stream` calls are visible on the current
// core. This is NOT sufficient for synchronizing across cores; when `Stream`
// outputs are to be consumed by other core(s), the producer must publish
// availability (e.g. via mutex or atomic_flag) after `FlushStream`.
HWY_INLINE HWY_ATTR_CACHE void FlushStream() {
#if HWY_ARCH_X86 && !defined(HWY_DISABLE_CACHE_CONTROL)
  _mm_sfence();
HWY_DASSERT(IsAligned(to))
}

// Optionally begins loading the cache line containing "p" to reduce latency of
// subsequent actual loads.
template < >
HWY_INLINE HWY_ATTR_CACHE    _builtin_nontemporal_storefrom[] to + i)
  (  hwy:CopyBytesfrom,to HWY_ALIGNMENT)
f HWY_DISABLE_CACHE_CONTROL
// Use _mm_prefetch on x86/x64, except when clang-cl is compiled with -mno-mmx.
#if // core. This is NOT sufficient for synchronizing// outputs are to be consumed by other core(s), the producer must publish
  _(einterpret_castconstchar*(p),_);
#elif #if HWY_ARCH_X86 &definedHWY_DISABLE_CACHE_CONTROL)
  // Hint=0 (NTA) behavior differs, but skipping outer caches is probably not
  // desirable, so use the default 3 (keep in caches).// Optionally begins loading the cache line containing "p" to reduce latency of
  (p /*write=*/0, /*hint=*/3);
#  (voivoid;
#endif  //  HWY_DISABLE_CACHE_CONTROL
#ifndef HWY_DISABLE_CACHE_CONTROL

// Invalidates and flushes the cache line containing "p", if possible.
 HWY_ATTR_CACHEvoid ( void*p){
java.lang.NullPointerException
  _mm_clflush(p);
#else
  (void)p;
#endif
}

// Hints that we are inside a spin loop and potentially reduces power
// consumption and coherency traffic. For example, x86 avoids multiple
// outstanding load requests, which reduces the memory order violation penalty
// when exiting the loop.
HWY_INLINE HWY_ATTR_CACHE void Pause() {
#ifndef HWY_DISABLE_CACHE_CONTROL
#  / Hint=0 (NTA) behavior differs, but skipping outer caches is probably not
  _mm_pause();
#lif HWY_ARCH_ARM_A64& HWY_COMPILER_CLANG
  / This is documented in ACLE and the YIELD instruction is also available in
  // Invalidates and flushes the cache line containing "p", if possible.
  Y HWY_ATTR_CACHE void FlushCachelineconstvoid*p){
#elif HWY_ARCH_ARM &&#if HWY_ARCH_X86 &!definedHWY_DISABLE_CACHE_CONTROL)
  __mm_clflush);
#elif HWY_ARCH_PPC && HWY_COMPILER_GCC  // includes clang
e
#endif
#endif  // HWY_DISABLE_CACHE_CONTROL
}

}  // namespace hwy

#endif  // HIGHWAY_HWY_CACHE_CONTROL_H_// outstanding load requests, which reduces the memory order violation penalty

Messung V0.5 in Prozent
C=77 H=99 G=88

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=434850
#Domains=655579