This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # CUDA contention benchmark v2: realistic LLM-like workload. | |
| # | |
| # Simulates a transformer decode step more faithfully than v1: | |
| # - Multiple linear layers (like attention Q/K/V projections + MLP) | |
| # - Small element-wise ops (RMSNorm, activations, residual adds) | |
| # - Index/gather operations (like token embedding lookup, KV cache scatter) | |
| # - Tensor creation/destruction churn | |
| # - Periodic CPU readback (like reading sampled token IDs) | |
| # | |
| # This should stress the same code paths as a real LLM step — many CUDA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Dual-engine multi-GPU threaded vLLM throughput benchmark. | |
| # | |
| # Architecture: two independent LLMEngine instances (one per GPU) fed from | |
| # a shared tokenized-request queue, with a single tokenizer thread. | |
| # | |
| # Tokenizer Thread (CPU) Engine Thread 0 (cuda:0) Engine Thread 1 (cuda:1) | |
| # input_processor.process() add_request (from queue) add_request (from queue) | |
| # tokenized_queue.put(ecr) engine0.step() engine1.step() | |
| # (continuous streaming) (continuous streaming) | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # See: https://github.com/pytest-dev/pytest/issues/14077 | |
| from concurrent.futures import ThreadPoolExecutor | |
| import numpy as np | |
| import pytest | |
| @pytest.fixture(scope="module") | |
| def pool(): | |
| yield ThreadPoolExecutor(max_workers=1) | |
| def test_1(pool): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ./python | |
| import contextlib | |
| import os | |
| import sys | |
| import shutil | |
| import subprocess | |
| import time | |
| import venv | |
| from pathlib import Path | |
| import tempfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-07-09-21-27-14.gh-issue-132657.kSA8R3.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-07-09-21-27-14.gh-issue-132657.kSA8R3.rst | |
| new file mode 100644 | |
| index 00000000000..99f7a990875 | |
| --- /dev/null | |
| +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-07-09-21-27-14.gh-issue-132657.kSA8R3.rst | |
| @@ -0,0 +1 @@ | |
| +Improve performance of :class:`frozenset` by removing locks in the free-threading build. | |
| diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-10-22-12-48-05.gh-issue-140476.F3-d1P.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-10-22-12-48-05.gh-issue-140476.F3-d1P.rst | |
| new file mode 100644 | |
| index 00000000000..a24033208c5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import importlib | |
| import types | |
| class _LazyModule(types.ModuleType): | |
| def __init__(self, fullname): | |
| self._lazy_module_name = fullname | |
| def __getattribute__(self, attr): | |
| # Stop triggering this method. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [600, 6107, 1667, 754, 6609, 999, 5030, 5668, 1135, 5712, 2386, 6015, | |
| 846, 1360, 5628, 2078, 6904, 2226, 855, 1254, 5861, 2130, 6110, 6148, | |
| 2853, 1050, 5890, 1937, 5417, 2153, 2255, 6883, 2173, 2189, 6914, | |
| 2822, 5629, 2079, 5492, 1291, 2227, 5572, 5672, 2344, 2801, 164, 6149, | |
| 719, 5904, 542, 5875, 483, 2776, 1105, 308, 2015, 6787, 6596, 2176, | |
| 2996, 5627, 1292, 5869, 6150, 5194, 6009, 165, 5741, 643, 2060, 2779, | |
| 1106, 5838, 6598, 5885, 1346, 5626, 6153, 5803, 910, 6319, 6160, 1739, | |
| 1293, 6255, 2324, 6011, 964, 2480, 166, 2780, 1575, 798, 6938, 423, | |
| 771, 1726, 6530, 1639, 1741, 5542, 1455, 5066, 6436, 5673, 167, 5297, | |
| 5116, 114, 2164, 2380, 6391, 5368, 674, 1136, 5664, 6016, 847, 6602, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [469, 470, 473, 16019, 6858, 11563, 11427, 12015, 5405, 16020, 471, | |
| 472, 475, 540, 6857, 19787, 7389, 11562, 6856, 11555, 6859, 11564, | |
| 5860, 5406, 3544, 3546, 3545, 6462, 6887, 12029, 12028, 12030, 12027, | |
| 19838, 5450, 9735, 9736, 9737, 8906, 9366, 8911, 9401, 6215, 6657, | |
| 6850, 6673, 5804, 5623, 5700, 6561, 3247, 3742, 3739, 3741, 3740, | |
| 5177, 5176, 5205, 5178, 9504, 9505, 9506, 7109, 3195, 9452, 7335, | |
| 7851, 7336, 7862, 3359, 3360, 3361, 5065, 7558, 5659, 4944, 6672, | |
| 7626, 3690, 3689, 7624, 5592, 7912, 5507, 7916, 5508, 7722, 7723, | |
| 5299, 7706, 4299, 4297, 4298, 4296, 3272, 3271, 7, 15964, 15965, | |
| 15967, 15963, 6, 8, 16151, 6681, 6693, 6680, 5434, 5436, 6986, 5435, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdbool.h> | |
| #include <stddef.h> | |
| #include <stdint.h> | |
| #include <limits.h> | |
| #include <assert.h> | |
| typedef size_t Py_ssize_t; | |
| #define PY_SSIZE_T_MAX ULONG_MAX | |
| /* dummy PyObject structure */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gc | |
| import time | |
| import statistics | |
| # Adapted from https://gist.github.com/stedolan/4369a0fa27820e27d6e56bee5e412896 | |
| # See https://github.com/ocaml/ocaml/pull/10195 | |
| # | |
| # In Python (free threading), this uses closer to 1.9 GiB of memory isntead of 800 MiB | |
| # perf stat -e L1-dcache-loads,L1-dcache-load-misses,LLC-loads,LLC-load-misses ./python gc_big_800m.py |
NewerOlder