diff --git a/R-package/configure.win b/R-package/configure.win index e69de29bb2d1..3a01292ab6a3 100644 --- a/R-package/configure.win +++ b/R-package/configure.win @@ -0,0 +1,21 @@ +R_EXE="${R_HOME}/bin${R_ARCH_BIN}/R.exe" +CXX=`"${R_EXE}" CMD config CXX` + +cat > test.cpp < +int main() { + char data = 0; + const char* address = &data; + _mm_prefetch(address, _MM_HINT_NTA); + return 0; +} +EOL + +XGBOOST_MM_PREFETCH_PRESENT="" +${CXX} -o test test.cpp 2>/dev/null && ./test && XGBOOST_MM_PREFETCH_PRESENT="-DXGBOOST_MM_PREFETCH_PRESENT=1" +rm -f ./test +rm -f ./test.cpp + +sed \ + -e "s/@XGBOOST_MM_PREFETCH_PRESENT@/$XGBOOST_MM_PREFETCH_PRESENT/" \ + < src/Makevars.win.in > src/Makevars.win diff --git a/R-package/src/Makevars.win b/R-package/src/Makevars.win.in similarity index 98% rename from R-package/src/Makevars.win rename to R-package/src/Makevars.win.in index 875b3aaca630..8a86ba97c34d 100644 --- a/R-package/src/Makevars.win +++ b/R-package/src/Makevars.win.in @@ -22,6 +22,8 @@ PKG_CPPFLAGS = \ -I$(PKGROOT)/include \ -I$(PKGROOT)/dmlc-core/include \ -I$(PKGROOT) \ + -DXGBOOST_BUILTIN_PREFETCH_PRESENT=1 \ + @XGBOOST_MM_PREFETCH_PRESENT@ \ $(XGB_RFLAGS) PKG_CXXFLAGS = \ diff --git a/ops/script/test_r_package.py b/ops/script/test_r_package.py index 3ce886c1bc41..ed0d6b1d9faa 100644 --- a/ops/script/test_r_package.py +++ b/ops/script/test_r_package.py @@ -63,7 +63,7 @@ def pkgroot(path: str) -> None: if os.path.exists(osxmakef): os.remove(osxmakef) pkgroot("Makevars.in") - pkgroot("Makevars.win") + pkgroot("Makevars.win.in") # misc rwsp = Path("R-package") / "remove_warning_suppression_pragma.sh" if system() != "Windows":