Skip to content

Instantly share code, notes, and snippets.

@jquagga jquagga/ryzenishaswell.patch Secret
Created Dec 22, 2019

Embed
What would you like to do?
Enable AVX2 haswell codepath on Ryzen processors
From 72a8b58958e7fda743b20d43e6d3f8096e026b81 Mon Sep 17 00:00:00 2001
From:
Date: Sat, 21 Dec 2019 16:46:48 -0500
Subject: [PATCH] Enable the AVX2 haswell platform for AMD Ryzen.
This should allow any Excavator or newer processor to choose the haswell
architecture as the gcc flags for -march=haswell should be covered by
march=bdver4 (and the Ryzen processors). This only checks for the AVX2
feature as bdver4 was the first AMD architecture with that flag per gcc.
---
sysdeps/x86/cpu-features.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index 4bab1549..3015a300 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -539,6 +539,17 @@ no_cpuid:
&& CPU_FEATURES_CPU_P (cpu_features, POPCNT))
platform = "haswell";
+ if (platform != NULL)
+ GLRO(dl_platform) = platform;
+ }
+ else if (cpu_features->basic.kind == arch_kind_amd)
+ {
+ const char *platform = NULL;
+
+ if (platform == NULL
+ && CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable))
+ platform = "haswell";
+
if (platform != NULL)
GLRO(dl_platform) = platform;
}
--
2.24.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.