File indexing completed on 2024-04-06 12:13:11
0001 #ifndef FWCore_Utilities_interface_CMSUnrollLoop_h
0002 #define FWCore_Utilities_interface_CMSUnrollLoop_h
0003
0004 #include "FWCore/Utilities/interface/stringize.h"
0005
0006 #if defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__)
0007
0008
0009 #define CMS_UNROLL_LOOP _Pragma(EDM_STRINGIZE(unroll))
0010 #define CMS_UNROLL_LOOP_COUNT(N) _Pragma(EDM_STRINGIZE(unroll N))
0011 #define CMS_UNROLL_LOOP_DISABLE _Pragma(EDM_STRINGIZE(unroll 1))
0012
0013 #define CMS_DEVICE_UNROLL_LOOP _Pragma(EDM_STRINGIZE(unroll))
0014 #define CMS_DEVICE_UNROLL_LOOP_COUNT(N) _Pragma(EDM_STRINGIZE(unroll N))
0015 #define CMS_DEVICE_UNROLL_LOOP_DISABLE _Pragma(EDM_STRINGIZE(unroll 1))
0016
0017 #else
0018
0019
0020 #define CMS_DEVICE_UNROLL_LOOP
0021 #define CMS_DEVICE_UNROLL_LOOP_COUNT(N)
0022 #define CMS_DEVICE_UNROLL_LOOP_DISABLE
0023
0024 #if defined(__clang__)
0025
0026
0027 #define CMS_UNROLL_LOOP _Pragma(EDM_STRINGIZE(clang loop unroll(enable)))
0028 #define CMS_UNROLL_LOOP_COUNT(N) _Pragma(EDM_STRINGIZE(clang loop unroll_count(N)))
0029 #define CMS_UNROLL_LOOP_DISABLE _Pragma(EDM_STRINGIZE(clang loop unroll(disable)))
0030
0031 #elif defined(__INTEL_COMPILER)
0032
0033 #define CMS_UNROLL_LOOP _Pragma(EDM_STRINGIZE(unroll))
0034 #define CMS_UNROLL_LOOP_COUNT(N) _Pragma(EDM_STRINGIZE(unroll(N)))
0035 #define CMS_UNROLL_LOOP_DISABLE _Pragma(EDM_STRINGIZE(nounroll))
0036
0037 #elif defined(__GNUC__)
0038
0039
0040 #define CMS_UNROLL_LOOP _Pragma(EDM_STRINGIZE(GCC ivdep))
0041 #define CMS_UNROLL_LOOP_COUNT(N) _Pragma(EDM_STRINGIZE(GCC unroll N)) _Pragma(EDM_STRINGIZE(GCC ivdep))
0042 #define CMS_UNROLL_LOOP_DISABLE _Pragma(EDM_STRINGIZE(GCC unroll 1))
0043
0044 #else
0045
0046
0047 #define CMS_UNROLL_LOOP
0048 #define CMS_UNROLL_LOOP_COUNT(N)
0049 #define CMS_UNROLL_LOOP_DISABLE
0050
0051 #endif
0052
0053 #endif
0054
0055 #endif