mic_common.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. Copyright (c) 2005-2020 Intel Corporation
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #ifndef __TBB_mic_common_H
  14. #define __TBB_mic_common_H
  15. #ifndef __TBB_machine_H
  16. #error Do not #include this internal file directly; use public TBB headers instead.
  17. #endif
  18. #if ! __TBB_DEFINE_MIC
  19. #error mic_common.h should be included only when building for Intel(R) Many Integrated Core Architecture
  20. #endif
  21. #ifndef __TBB_PREFETCHING
  22. #define __TBB_PREFETCHING 1
  23. #endif
  24. #if __TBB_PREFETCHING
  25. #include <immintrin.h>
  26. #define __TBB_cl_prefetch(p) _mm_prefetch((const char*)p, _MM_HINT_T1)
  27. #define __TBB_cl_evict(p) _mm_clevict(p, _MM_HINT_T1)
  28. #endif
  29. /** Intel(R) Many Integrated Core Architecture does not support mfence and pause instructions **/
  30. #define __TBB_full_memory_fence() __asm__ __volatile__("lock; addl $0,(%%rsp)":::"memory")
  31. #define __TBB_Pause(x) _mm_delay_32(16*(x))
  32. #define __TBB_STEALING_PAUSE 1500/16
  33. #include <sched.h>
  34. #define __TBB_Yield() sched_yield()
  35. /** Specifics **/
  36. #define __TBB_STEALING_ABORT_ON_CONTENTION 1
  37. #define __TBB_YIELD2P 1
  38. #define __TBB_HOARD_NONLOCAL_TASKS 1
  39. #if ! ( __FreeBSD__ || __linux__ )
  40. #error Intel(R) Many Integrated Core Compiler does not define __FreeBSD__ or __linux__ anymore. Check for the __TBB_XXX_BROKEN defined under __FreeBSD__ or __linux__.
  41. #endif /* ! ( __FreeBSD__ || __linux__ ) */
  42. #endif /* __TBB_mic_common_H */