HostFeatures: Removes distinction between AVX and AVX2

We now no longer care about AVX versions, consolidate them in to a
single config option which enables both.
This commit is contained in:
Ryan Houdek 2024-06-23 13:17:30 -07:00
parent 52e541d453
commit add0e7a8db
No known key found for this signature in database
5 changed files with 3 additions and 21 deletions

View File

@ -50,8 +50,6 @@
"DISABLESVE": "disablesve",
"ENABLEAVX": "enableavx",
"DISABLEAVX": "disableavx",
"ENABLEAVX2": "enableavx2",
"DISABLEAVX2": "disableavx2",
"ENABLEAFP": "enableafp",
"DISABLEAFP": "disableafp",
"ENABLELRCPC": "enablelrcpc",
@ -86,7 +84,6 @@
"\toff: Default CPU features queried from CPU features",
"\t{enable,disable}sve: Will force enable or disable sve even if the host doesn't support it",
"\t{enable,disable}avx: Will force enable or disable avx even if the host doesn't support it",
"\t{enable,disable}avx2: Will force enable or disable avx2 even if the host doesn't support it",
"\t{enable,disable}afp: Will force enable or disable afp even if the host doesn't support it",
"\t{enable,disable}lrcpc: Will force enable or disable lrcpc even if the host doesn't support it",
"\t{enable,disable}lrcpc2: Will force enable or disable lrcpc2 even if the host doesn't support it",

View File

@ -82,7 +82,6 @@ static void OverrideFeatures(HostFeatures* Features) {
LogMan::Throw::AFmt(!(Disable##name && Enable##name), "Disabling and Enabling CPU feature (" #name ") is mutually exclusive");
ENABLE_DISABLE_OPTION(SupportsAVX, AVX, AVX);
ENABLE_DISABLE_OPTION(SupportsAVX2, AVX2, AVX2);
ENABLE_DISABLE_OPTION(SupportsSVE128, SVE, SVE);
ENABLE_DISABLE_OPTION(SupportsAFP, AFP, AFP);
ENABLE_DISABLE_OPTION(SupportsRCPC, LRCPC, LRCPC);
@ -169,8 +168,6 @@ HostFeatures::HostFeatures() {
SupportsAES256 = SupportsAVX && SupportsAES;
// TODO: AVX2 is currently unsupported. Disable until the remaining features are implemented.
SupportsAVX2 = false;
SupportsBMI1 = true;
SupportsBMI2 = true;
SupportsCLWB = true;
@ -257,7 +254,6 @@ HostFeatures::HostFeatures() {
Supports3DNow = X86Features.has(Xbyak::util::Cpu::t3DN) && X86Features.has(Xbyak::util::Cpu::tE3DN);
SupportsSSE4A = X86Features.has(Xbyak::util::Cpu::tSSE4a);
SupportsAVX = true;
SupportsAVX2 = true;
SupportsSHA = X86Features.has(Xbyak::util::Cpu::tSHA);
SupportsBMI1 = X86Features.has(Xbyak::util::Cpu::tBMI1);
SupportsBMI2 = X86Features.has(Xbyak::util::Cpu::tBMI2);

View File

@ -25,7 +25,6 @@ public:
bool Supports3DNow {};
bool SupportsSSE4A {};
bool SupportsAVX {};
bool SupportsAVX2 {};
bool SupportsSVE128 {};
bool SupportsSVE256 {};
bool SupportsSHA {};

View File

@ -307,8 +307,7 @@ public:
FEATURE_BMI2 = (1 << 7),
FEATURE_CLWB = (1 << 8),
FEATURE_LINUX = (1 << 9),
FEATURE_AVX2 = (1 << 10),
FEATURE_AES256 = (1 << 11),
FEATURE_AES256 = (1 << 10),
};
bool Requires3DNow() const {
@ -320,9 +319,6 @@ public:
bool RequiresAVX() const {
return BaseConfig.OptionHostFeatures & HostFeatures::FEATURE_AVX;
}
bool RequiresAVX2() const {
return BaseConfig.OptionHostFeatures & HostFeatures::FEATURE_AVX2;
}
bool RequiresRAND() const {
return BaseConfig.OptionHostFeatures & HostFeatures::FEATURE_RAND;
}
@ -492,9 +488,6 @@ public:
bool RequiresAVX() const {
return Config.RequiresAVX();
}
bool RequiresAVX2() const {
return Config.RequiresAVX2();
}
bool RequiresRAND() const {
return Config.RequiresRAND();
}

View File

@ -242,7 +242,6 @@ int main(int argc, char** argv, char** const envp) {
#endif
bool SupportsAVX = false;
bool SupportsAVX2 = false;
FEXCore::Core::CPUState State;
FEXCore::Context::InitializeStaticTables(Loader.Is64BitMode() ? FEXCore::Context::MODE_64BIT : FEXCore::Context::MODE_32BIT);
@ -262,11 +261,9 @@ int main(int argc, char** argv, char** const envp) {
// Skip any tests that the host doesn't support features for
auto HostFeatures = CTX->GetHostFeatures();
SupportsAVX = HostFeatures.SupportsAVX;
SupportsAVX2 = HostFeatures.SupportsAVX2;
bool TestUnsupported = (!HostFeatures.Supports3DNow && Loader.Requires3DNow()) ||
(!HostFeatures.SupportsSSE4A && Loader.RequiresSSE4A()) || (!SupportsAVX && Loader.RequiresAVX()) ||
(!SupportsAVX2 && Loader.RequiresAVX2()) || (!HostFeatures.SupportsRAND && Loader.RequiresRAND()) ||
bool TestUnsupported = (!HostFeatures.Supports3DNow && Loader.Requires3DNow()) || (!HostFeatures.SupportsSSE4A && Loader.RequiresSSE4A()) ||
(!SupportsAVX && Loader.RequiresAVX()) || (!HostFeatures.SupportsRAND && Loader.RequiresRAND()) ||
(!HostFeatures.SupportsSHA && Loader.RequiresSHA()) || (!HostFeatures.SupportsCLZERO && Loader.RequiresCLZERO()) ||
(!HostFeatures.SupportsBMI1 && Loader.RequiresBMI1()) || (!HostFeatures.SupportsBMI2 && Loader.RequiresBMI2()) ||
(!HostFeatures.SupportsCLWB && Loader.RequiresCLWB()) || (!HostFeatures.SupportsAES256 && Loader.RequiresAES256());