#include "mathtest/TestConfig.hpp"
#include "mathtest/DeviceContext.hpp"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SmallVectorExtras.h"
using namespace mathtest;
[[nodiscard]] const llvm::SmallVector<TestConfig, 4> &
mathtest::getAllTestConfigs() {
static auto AllTestConfigs = []() -> llvm::SmallVector<TestConfig, 4> {
return {
{"llvm-libm", "amdgpu"},
{"llvm-libm", "cuda"},
{"cuda-math", "cuda"},
{"hip-math", "amdgpu"},
};
}();
return AllTestConfigs;
};
[[nodiscard]] const llvm::SmallVector<TestConfig, 4> &
mathtest::getDefaultTestConfigs() {
static auto DefaultTestConfigs = []() -> llvm::SmallVector<TestConfig, 4> {
const auto Platforms = getPlatforms();
const auto AllTestConfigs = getAllTestConfigs();
llvm::StringRef Provider = "llvm-libm";
return llvm::filter_to_vector(AllTestConfigs, [&](const auto &Config) {
return Provider.equals_insensitive(Config.Provider) &&
llvm::any_of(Platforms, [&](llvm::StringRef Platform) {
return Platform.equals_insensitive(Config.Platform);
});
});
}();
return DefaultTestConfigs;
};