From 2b11fd2dbe89fefc7e9e37a1544aa1458e7faffc Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 15 Mar 2025 23:03:21 +0900 Subject: [PATCH 01/12] gh-11599: Update whats news for free-threaded 3.14 --- Doc/whatsnew/3.14.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index b1337190636529..aa5b33513c63e6 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -68,6 +68,7 @@ Summary -- release highlights * :ref:`PEP 741: Python Configuration C API ` * :ref:`PEP 761: Discontinuation of PGP signatures ` * :ref:`A new type of interpreter ` +* :ref:`Free-threaded CPython ` Incompatible changes @@ -311,6 +312,24 @@ For further information on how to build Python, see (Contributed by Ken Jin in :gh:`128563`, with ideas on how to implement this in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh Haberman.) +.. _whatsnew314-free-threaded-cpython: + +Free-threaded CPython +--------------------- + +Free-threaded CPython now supports :pep:`659` which is known +as the specializing adaptive interpreter, the execution mechanisms is almost same +as the default build, but at free-threaded CPython build, each thread maintains +a thread-local copy of specialized bytecode. + +With this change, the free-threaded CPython build achieve better performance +and 10-15% slower than the default build. + +This work was done by many contributors, Matt Page, Neil Schemenauer, +Sam Gross, Thomas Wouters, Donghee Na and Kirill Podoprigora +Meta also provided significant engineering resources for performance benchmark and +design per thread specialized bytecode mechanisms. + Other language changes ====================== From 4b87b5bcb283894ff492a929610cb5115b3e883d Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 15 Mar 2025 23:04:38 +0900 Subject: [PATCH 02/12] Add Ken Jin because he involves early design --- Doc/whatsnew/3.14.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index aa5b33513c63e6..5f7b991210bb9a 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -326,7 +326,7 @@ With this change, the free-threaded CPython build achieve better performance and 10-15% slower than the default build. This work was done by many contributors, Matt Page, Neil Schemenauer, -Sam Gross, Thomas Wouters, Donghee Na and Kirill Podoprigora +Sam Gross, Thomas Wouters, Donghee Na, Kirill Podoprigora and Ken Jin. Meta also provided significant engineering resources for performance benchmark and design per thread specialized bytecode mechanisms. From e384e7a403782296ef0c4bb9134959e911c732dd Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sun, 16 Mar 2025 10:37:50 +0900 Subject: [PATCH 03/12] Apply suggestions from code review Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/whatsnew/3.14.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 5f7b991210bb9a..2c07ed93ab8b07 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -318,17 +318,17 @@ Free-threaded CPython --------------------- Free-threaded CPython now supports :pep:`659` which is known -as the specializing adaptive interpreter, the execution mechanisms is almost same +as the specializing adaptive interpreter. The execution mechanism is almost same as the default build, but at free-threaded CPython build, each thread maintains a thread-local copy of specialized bytecode. -With this change, the free-threaded CPython build achieve better performance -and 10-15% slower than the default build. +With this change, the free-threaded CPython build achieves better performance, +and is only 10-15% slower than the default build. This work was done by many contributors, Matt Page, Neil Schemenauer, Sam Gross, Thomas Wouters, Donghee Na, Kirill Podoprigora and Ken Jin. -Meta also provided significant engineering resources for performance benchmark and -design per thread specialized bytecode mechanisms. +Meta also provided significant engineering resources for performance benchmarking and +design of per thread specialized bytecode mechanisms. Other language changes From 1b0d395bda53d0edffcd00f46c4d23cc5730e9d4 Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sun, 16 Mar 2025 10:38:45 +0900 Subject: [PATCH 04/12] Update Doc/whatsnew/3.14.rst Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/whatsnew/3.14.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 2c07ed93ab8b07..95db060c3d43c1 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -319,8 +319,8 @@ Free-threaded CPython Free-threaded CPython now supports :pep:`659` which is known as the specializing adaptive interpreter. The execution mechanism is almost same -as the default build, but at free-threaded CPython build, each thread maintains -a thread-local copy of specialized bytecode. +as the default build, however in a free-threaded CPython build, each thread +maintains a thread-local copy of specialized bytecode. With this change, the free-threaded CPython build achieves better performance, and is only 10-15% slower than the default build. From c2d689d9f3523167b821261beaf83f169ccd6918 Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 10 May 2025 00:32:16 +0900 Subject: [PATCH 05/12] Update Doc/whatsnew/3.14.rst Co-authored-by: T. Wouters --- Doc/whatsnew/3.14.rst | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index d20b85345395bf..b38ca3ac84a3f7 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -315,21 +315,15 @@ in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh Haberman.) .. _whatsnew314-free-threaded-cpython: -Free-threaded CPython +Free-threaded mode --------------------- -Free-threaded CPython now supports :pep:`659` which is known -as the specializing adaptive interpreter. The execution mechanism is almost same -as the default build, however in a free-threaded CPython build, each thread -maintains a thread-local copy of specialized bytecode. +The free-threaded mode (:pep:`703`), initially added in 3.13, has been significantly improved. The implementation described in PEP 703 was finished, including C API changes, and temporary workarounds in the interpreter were replaced with more permanent solutions. The specializing adaptive interpreter (:pep:`659`) is now enabled in free-threaded mode, which along with many other optimizations greatly improves its performance. The performance penalty on single-threaded code in free-threaded mode is now roughly 5-10%, depending on platform and C compiler used. -With this change, the free-threaded CPython build achieves better performance, -and is only 10-15% slower than the default build. +This work was done by many contributors: Sam Gross, Matt Page, Neil Schemenauer, Thomas Wouters, Donghee Na, Kirill Podoprigora, Ken Jin, Itamar Oren, Brett Simmers, Dino Viehland, Nathan Goldbaum, Ralf Gommers, +Lysandros Nikolaou, and many others. -This work was done by many contributors, Matt Page, Neil Schemenauer, -Sam Gross, Thomas Wouters, Donghee Na, Kirill Podoprigora and Ken Jin. -Meta also provided significant engineering resources for performance benchmarking and -design of per thread specialized bytecode mechanisms. +Some of these contributors are employed by Meta, which has continued to provide significant engineering resources to support this project. Other language changes From 244d00c686cd8eefeeb433d9bc1089b53b0cb40f Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 10 May 2025 00:34:13 +0900 Subject: [PATCH 06/12] Update Doc/whatsnew/3.14.rst Co-authored-by: T. Wouters --- Doc/whatsnew/3.14.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index b38ca3ac84a3f7..69db296e9ca5e6 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -69,7 +69,7 @@ Summary -- release highlights * :ref:`PEP 761: Discontinuation of PGP signatures ` * :ref:`A new type of interpreter ` * :ref:`PEP 765: Disallow return/break/continue that exit a finally block ` -* :ref:`Free-threaded CPython ` +* :ref:`Free-threaded mode improvements ` Incompatible changes From 64a7af006880fbb26b5b66ef394aee2213374263 Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 10 May 2025 02:01:08 +0900 Subject: [PATCH 07/12] Update Doc/whatsnew/3.14.rst Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/whatsnew/3.14.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 3c3a42a40c91f6..a44eef200bf934 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -800,7 +800,7 @@ in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh Haberman.) Free-threaded mode --------------------- -The free-threaded mode (:pep:`703`), initially added in 3.13, has been significantly improved. The implementation described in PEP 703 was finished, including C API changes, and temporary workarounds in the interpreter were replaced with more permanent solutions. The specializing adaptive interpreter (:pep:`659`) is now enabled in free-threaded mode, which along with many other optimizations greatly improves its performance. The performance penalty on single-threaded code in free-threaded mode is now roughly 5-10%, depending on platform and C compiler used. +Free-threaded mode (:pep:`703`), initially added in 3.13, has been significantly improved. The implementation described in PEP 703 was finished, including C API changes, and temporary workarounds in the interpreter were replaced with more permanent solutions. The specializing adaptive interpreter (:pep:`659`) is now enabled in free-threaded mode, which along with many other optimizations greatly improves its performance. The performance penalty on single-threaded code in free-threaded mode is now roughly 5-10%, depending on platform and C compiler used. This work was done by many contributors: Sam Gross, Matt Page, Neil Schemenauer, Thomas Wouters, Donghee Na, Kirill Podoprigora, Ken Jin, Itamar Oren, Brett Simmers, Dino Viehland, Nathan Goldbaum, Ralf Gommers, Lysandros Nikolaou, and many others. From 2fdbac547d843205249febe9d987accf2f19d7ce Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 10 May 2025 08:34:07 +0900 Subject: [PATCH 08/12] Update Doc/whatsnew/3.14.rst Co-authored-by: mpage --- Doc/whatsnew/3.14.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index a44eef200bf934..6f5633715232c7 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -803,7 +803,7 @@ Free-threaded mode Free-threaded mode (:pep:`703`), initially added in 3.13, has been significantly improved. The implementation described in PEP 703 was finished, including C API changes, and temporary workarounds in the interpreter were replaced with more permanent solutions. The specializing adaptive interpreter (:pep:`659`) is now enabled in free-threaded mode, which along with many other optimizations greatly improves its performance. The performance penalty on single-threaded code in free-threaded mode is now roughly 5-10%, depending on platform and C compiler used. This work was done by many contributors: Sam Gross, Matt Page, Neil Schemenauer, Thomas Wouters, Donghee Na, Kirill Podoprigora, Ken Jin, Itamar Oren, Brett Simmers, Dino Viehland, Nathan Goldbaum, Ralf Gommers, -Lysandros Nikolaou, and many others. +Lysandros Nikolaou, Kumar Aditya, and many others. Some of these contributors are employed by Meta, which has continued to provide significant engineering resources to support this project. From 920b493207ec16514da6c8d88a904fd249dcf183 Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 10 May 2025 08:34:25 +0900 Subject: [PATCH 09/12] Update Doc/whatsnew/3.14.rst Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/whatsnew/3.14.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 6f5633715232c7..19926186d9f6b3 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -798,7 +798,7 @@ in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh Haberman.) .. _whatsnew314-free-threaded-cpython: Free-threaded mode ---------------------- +------------------ Free-threaded mode (:pep:`703`), initially added in 3.13, has been significantly improved. The implementation described in PEP 703 was finished, including C API changes, and temporary workarounds in the interpreter were replaced with more permanent solutions. The specializing adaptive interpreter (:pep:`659`) is now enabled in free-threaded mode, which along with many other optimizations greatly improves its performance. The performance penalty on single-threaded code in free-threaded mode is now roughly 5-10%, depending on platform and C compiler used. From 290149a13318827d2350f10fb77a2434631cd9ab Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 10 May 2025 13:21:05 +0900 Subject: [PATCH 10/12] Wrap --- Doc/whatsnew/3.14.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 19926186d9f6b3..7c0fd223e59081 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -800,10 +800,15 @@ in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh Haberman.) Free-threaded mode ------------------ -Free-threaded mode (:pep:`703`), initially added in 3.13, has been significantly improved. The implementation described in PEP 703 was finished, including C API changes, and temporary workarounds in the interpreter were replaced with more permanent solutions. The specializing adaptive interpreter (:pep:`659`) is now enabled in free-threaded mode, which along with many other optimizations greatly improves its performance. The performance penalty on single-threaded code in free-threaded mode is now roughly 5-10%, depending on platform and C compiler used. - -This work was done by many contributors: Sam Gross, Matt Page, Neil Schemenauer, Thomas Wouters, Donghee Na, Kirill Podoprigora, Ken Jin, Itamar Oren, Brett Simmers, Dino Viehland, Nathan Goldbaum, Ralf Gommers, -Lysandros Nikolaou, Kumar Aditya, and many others. +Free-threaded mode (:pep:`703`), initially added in 3.13, has been significantly improved. +The implementation described in PEP 703 was finished, including C API changes, and temporary workarounds +in the interpreter were replaced with more permanent solutions. +The specializing adaptive interpreter (:pep:`659`) is now enabled in free-threaded mode, +which along with many other optimizations greatly improves its performance. +The performance penalty on single-threaded code in free-threaded mode is now roughly 5-10%, depending on platform and C compiler used. + +This work was done by many contributors: Sam Gross, Matt Page, Neil Schemenauer, Thomas Wouters, Donghee Na, Kirill Podoprigora, +Ken Jin, Itamar Oren, Brett Simmers, Dino Viehland, Nathan Goldbaum, Ralf Gommers, Lysandros Nikolaou, Kumar Aditya, and many others. Some of these contributors are employed by Meta, which has continued to provide significant engineering resources to support this project. From 3dd4d3fb4269416568475a91cfa02273408bba5b Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 10 May 2025 13:24:11 +0900 Subject: [PATCH 11/12] wrap again --- Doc/whatsnew/3.14.rst | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 7c0fd223e59081..ad7f573d5122f3 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -801,16 +801,20 @@ Free-threaded mode ------------------ Free-threaded mode (:pep:`703`), initially added in 3.13, has been significantly improved. -The implementation described in PEP 703 was finished, including C API changes, and temporary workarounds -in the interpreter were replaced with more permanent solutions. +The implementation described in PEP 703 was finished, including C API changes, +and temporary workarounds in the interpreter were replaced with more permanent solutions. The specializing adaptive interpreter (:pep:`659`) is now enabled in free-threaded mode, which along with many other optimizations greatly improves its performance. -The performance penalty on single-threaded code in free-threaded mode is now roughly 5-10%, depending on platform and C compiler used. +The performance penalty on single-threaded code in free-threaded mode is now roughly 5-10%, +depending on platform and C compiler used. -This work was done by many contributors: Sam Gross, Matt Page, Neil Schemenauer, Thomas Wouters, Donghee Na, Kirill Podoprigora, -Ken Jin, Itamar Oren, Brett Simmers, Dino Viehland, Nathan Goldbaum, Ralf Gommers, Lysandros Nikolaou, Kumar Aditya, and many others. +This work was done by many contributors: Sam Gross, Matt Page, Neil Schemenauer, +Thomas Wouters, Donghee Na, Kirill Podoprigora, Ken Jin, Itamar Oren, +Brett Simmers, Dino Viehland, Nathan Goldbaum, Ralf Gommers, Lysandros Nikolaou, +Kumar Aditya, and many others. -Some of these contributors are employed by Meta, which has continued to provide significant engineering resources to support this project. +Some of these contributors are employed by Meta, which has continued to provide +significant engineering resources to support this project. .. _whatsnew314-pyrepl-highlighting: From ce28d2561c0484d78712698d83d62a3cb75e0a88 Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Sat, 10 May 2025 13:54:51 +0900 Subject: [PATCH 12/12] Add Edgar Margffoy --- Doc/whatsnew/3.14.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index ad7f573d5122f3..d7b3bac8d85f1f 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -811,7 +811,7 @@ depending on platform and C compiler used. This work was done by many contributors: Sam Gross, Matt Page, Neil Schemenauer, Thomas Wouters, Donghee Na, Kirill Podoprigora, Ken Jin, Itamar Oren, Brett Simmers, Dino Viehland, Nathan Goldbaum, Ralf Gommers, Lysandros Nikolaou, -Kumar Aditya, and many others. +Kumar Aditya, Edgar Margffoy, and many others. Some of these contributors are employed by Meta, which has continued to provide significant engineering resources to support this project.