https://github.com/python/cpython/commit/c66ffcf8e3ab889a30aae43520aa29c167344bd3
commit: c66ffcf8e3ab889a30aae43520aa29c167344bd3
branch: main
author: T. Wouters <tho...@python.org>
committer: Yhg1s <tho...@python.org>
date: 2025-04-15T09:39:32Z
summary:

gh-129987: Selectively re-enable SLP autovectorization of 
_PyEval_EvalFrameDefault (#132530)

Only disable SLP autovectorization of `_PyEval_EvalFrameDefault` on newer
GCCs, as the optimization bug seems to exist only on GCC 12 and later, and
before GCC 9 disabling the optimization has a dramatic performance impact.

files:
M Python/ceval.c

diff --git a/Python/ceval.c b/Python/ceval.c
index 278d9e36045da2..e534c7e2b883d5 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -948,11 +948,15 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch)
 #include "generated_cases.c.h"
 #endif
 
-#if (defined(__GNUC__) && !defined(__clang__)) && defined(__x86_64__)
+#if (defined(__GNUC__) && __GNUC__ >= 10 && !defined(__clang__)) && 
defined(__x86_64__)
 /*
- * gh-129987: The SLP autovectorizer can cause poor code generation for opcode
- * dispatch, negating any benefit we get from vectorization elsewhere in the
- * interpreter loop.
+ * gh-129987: The SLP autovectorizer can cause poor code generation for
+ * opcode dispatch in some GCC versions (observed in GCCs 12 through 15,
+ * probably caused by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115777),
+ * negating any benefit we get from vectorization elsewhere in the
+ * interpreter loop. Disabling it significantly affected older GCC versions
+ * (prior to GCC 9, 40% performance drop), so we have to selectively disable
+ * it.
  */
 #define DONT_SLP_VECTORIZE __attribute__((optimize ("no-tree-slp-vectorize")))
 #else

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to