Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,9 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "C
# For ARM architecture, as a hack, ensure that char is signed
message(STATUS "ARM architecture detected: adding -fsigned-char flag")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char")
else()
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "(x86_64|amd64|AMD64|i386|i486|i586|i686|x86)")
# -mfpmath=sse only exists on x86, so non-x86 ISAs (loongarch64, riscv64, ppc64le, mips64,
# ...) must not get it - they hard-error with "unrecognized command-line option".
# KataGo wants IEEE-compliant float math.
# On x86-64 SSE-based IEEE float math is already the ABI default (x87 excess precision cannot occur),
# but mandate it explicitly anyway.
Expand Down
18 changes: 18 additions & 0 deletions cpp/tests/testsearchcommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,24 @@ NNEvaluator* TestSearchCommon::startNNEval(
const string& modelName = modelFile;
const string homeDataDirOverride = "";
ConfigParser cfg;
#if defined(USE_EIGEN_BACKEND)
//The Eigen backend only implements the NHWC float32 path and hard-errors on anything else
//(see eigenbackend.cpp), but the tests and the runsearchtests*.sh scripts are written for the
//GPU backends and pass NCHW and/or FP16. Normalize here, at the one choke point every NN test
//goes through, rather than fixing up each call site.
if(!inputsUseNHWC) {
std::cout << "Backend is Eigen, ignoring args and forcing inputsUseNHWC=true" << std::endl;
inputsUseNHWC = true;
}
if(!useNHWC) {
std::cout << "Backend is Eigen, ignoring args and forcing useNHWC=true" << std::endl;
useNHWC = true;
}
if(useFP16) {
std::cout << "Backend is Eigen, ignoring args and forcing useFP16=false" << std::endl;
useFP16 = false;
}
#endif
//NHWC layout is no longer a generic NNEvaluator option; only the CUDA backend reads it (off cfg).
//Route the test's useNHWC param into a cudaUseNHWC override so it still drives the CUDA layout.
cfg.overrideKey("cudaUseNHWC", useNHWC ? "true" : "false");
Expand Down
13 changes: 13 additions & 0 deletions cpp/tests/testtrainingwrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ static NNEvaluator* startNNEval(
bool debugSkipNeuralNet = modelFile == "/dev/null";
const string homeDataDirOverride = "";
ConfigParser cfg;
#if defined(USE_EIGEN_BACKEND)
//The Eigen backend only implements the NHWC float32 path and hard-errors on NCHW
//(see eigenbackend.cpp). These tests default to useNHWC=false, which the GPU backends accept
//but Eigen does not, so normalize here at the one choke point they all go through.
if(!inputsUseNHWC) {
cout << "Backend is Eigen, ignoring args and forcing inputsUseNHWC=true" << endl;
inputsUseNHWC = true;
}
if(!useNHWC) {
cout << "Backend is Eigen, ignoring args and forcing useNHWC=true" << endl;
useNHWC = true;
}
#endif
//NHWC layout is no longer a generic NNEvaluator option; only the CUDA backend reads it (off cfg).
//Route the test's useNHWC param into a cudaUseNHWC override so it still drives the CUDA layout.
cfg.overrideKey("cudaUseNHWC", useNHWC ? "true" : "false");
Expand Down