From 7a9606c96cdc055cf008b9c10791e6032c393c17 Mon Sep 17 00:00:00 2001 From: Anuj Shukla Date: Thu, 4 Dec 2025 07:19:57 -0500 Subject: [PATCH 1/3] Fix: Replace hard-coded thread limit with TIMEMORY_MAX_STORAGE_THREADS --- CHANGELOG.md | 19 +++++++++++++++++++ VERSION | 2 +- cmake/Modules/Options.cmake | 20 ++++++++++++++++++++ source/timemory/operations/types.hpp | 2 +- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bc7fb000..e797dc7c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # timemory +## Version 3.2.5 + +> Date: Tue Dec 3 2025 + +### Bug Fixes + +- Fixed hard-coded thread limit in `operation::set_storage` + - Changed from `max_threads = 4096` to use `TIMEMORY_MAX_STORAGE_THREADS` + - Prevents segfaults when Linux thread IDs exceed 4096 + +### Build System + +- Added `TIMEMORY_MAX_STORAGE_THREADS` CMake option + - Defaults to `TIMEMORY_MAX_THREADS` value + - Controls storage array sizing for per-thread data + - Auto-adjusts to `TIMEMORY_MAX_THREADS` if set lower than `TIMEMORY_MAX_THREADS` + +# timemory + ## Version 3.2.4 > Date: Mon Jul 19 17:22:28 2021 -0500 diff --git a/VERSION b/VERSION index b19ee8389..c8621cb54 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.0.0rc0 +4.0.1rc0 diff --git a/cmake/Modules/Options.cmake b/cmake/Modules/Options.cmake index de58f9df3..290dabc28 100644 --- a/cmake/Modules/Options.cmake +++ b/cmake/Modules/Options.cmake @@ -564,6 +564,26 @@ timemory_add_feature(TIMEMORY_MAX_THREADS "Maximum number of statically allocated thread-local statics") timemory_add_cmake_defines(TIMEMORY_MAX_THREADS VALUE DEFAULT) +if(NOT DEFINED TIMEMORY_MAX_STORAGE_THREADS) + set(TIMEMORY_MAX_STORAGE_THREADS + "${TIMEMORY_MAX_THREADS}" + CACHE STRING "Maximum number of storage thread slots") +endif() + +if(TIMEMORY_MAX_STORAGE_THREADS LESS TIMEMORY_MAX_THREADS) + timemory_message( + WARNING "TIMEMORY_MAX_STORAGE_THREADS (${TIMEMORY_MAX_STORAGE_THREADS}) " + "is less than TIMEMORY_MAX_THREADS (${TIMEMORY_MAX_THREADS}). " + "Auto-adjusting to ${TIMEMORY_MAX_THREADS}") + set(TIMEMORY_MAX_STORAGE_THREADS + "${TIMEMORY_MAX_THREADS}" + CACHE STRING "Maximum number of storage thread slots" FORCE) +endif() + +timemory_add_feature(TIMEMORY_MAX_STORAGE_THREADS + "Maximum number of storage thread slots") +timemory_add_cmake_defines(TIMEMORY_MAX_STORAGE_THREADS VALUE DEFAULT) + if(TIMEMORY_BUILD_EXAMPLES AND TIMEMORY_USE_COVERAGE AND "$ENV{CONTINUOUS_INTEGRATION}" STREQUAL "true") diff --git a/source/timemory/operations/types.hpp b/source/timemory/operations/types.hpp index 40d6ad052..1f6b86529 100644 --- a/source/timemory/operations/types.hpp +++ b/source/timemory/operations/types.hpp @@ -813,7 +813,7 @@ template struct set_storage { friend struct get_storage; - static constexpr size_t max_threads = 4096; + static constexpr size_t max_threads = TIMEMORY_MAX_STORAGE_THREADS; using type = T; using storage_array_t = std::array*, max_threads>; From db747366db05ec5929b6956eab481369409332cf Mon Sep 17 00:00:00 2001 From: anujshuk-amd Date: Fri, 5 Dec 2025 13:30:47 +0530 Subject: [PATCH 2/3] Update CHANGELOG.md Co-authored-by: David Galiffi --- CHANGELOG.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e797dc7c1..165a65eee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # timemory -## Version 3.2.5 +## Version 4.0.1rc0 -> Date: Tue Dec 3 2025 +> Date: Tue Dec 3, 2025 ### Bug Fixes @@ -17,8 +17,6 @@ - Controls storage array sizing for per-thread data - Auto-adjusts to `TIMEMORY_MAX_THREADS` if set lower than `TIMEMORY_MAX_THREADS` -# timemory - ## Version 3.2.4 > Date: Mon Jul 19 17:22:28 2021 -0500 From 144d21dbe61fa0698737277301fa17ea27be99ed Mon Sep 17 00:00:00 2001 From: Anuj Shukla Date: Fri, 5 Dec 2025 04:29:41 -0500 Subject: [PATCH 3/3] Fix: Replace hard-coded thread limit with TIMEMORY_MAX_THREADS --- CHANGELOG.md | 9 +-------- cmake/Modules/Options.cmake | 20 -------------------- source/timemory/operations/types.hpp | 2 +- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 165a65eee..0f4936900 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,16 +7,9 @@ ### Bug Fixes - Fixed hard-coded thread limit in `operation::set_storage` - - Changed from `max_threads = 4096` to use `TIMEMORY_MAX_STORAGE_THREADS` + - Changed from `max_threads = 4096` to use `TIMEMORY_MAX_THREADS` - Prevents segfaults when Linux thread IDs exceed 4096 -### Build System - -- Added `TIMEMORY_MAX_STORAGE_THREADS` CMake option - - Defaults to `TIMEMORY_MAX_THREADS` value - - Controls storage array sizing for per-thread data - - Auto-adjusts to `TIMEMORY_MAX_THREADS` if set lower than `TIMEMORY_MAX_THREADS` - ## Version 3.2.4 > Date: Mon Jul 19 17:22:28 2021 -0500 diff --git a/cmake/Modules/Options.cmake b/cmake/Modules/Options.cmake index 290dabc28..de58f9df3 100644 --- a/cmake/Modules/Options.cmake +++ b/cmake/Modules/Options.cmake @@ -564,26 +564,6 @@ timemory_add_feature(TIMEMORY_MAX_THREADS "Maximum number of statically allocated thread-local statics") timemory_add_cmake_defines(TIMEMORY_MAX_THREADS VALUE DEFAULT) -if(NOT DEFINED TIMEMORY_MAX_STORAGE_THREADS) - set(TIMEMORY_MAX_STORAGE_THREADS - "${TIMEMORY_MAX_THREADS}" - CACHE STRING "Maximum number of storage thread slots") -endif() - -if(TIMEMORY_MAX_STORAGE_THREADS LESS TIMEMORY_MAX_THREADS) - timemory_message( - WARNING "TIMEMORY_MAX_STORAGE_THREADS (${TIMEMORY_MAX_STORAGE_THREADS}) " - "is less than TIMEMORY_MAX_THREADS (${TIMEMORY_MAX_THREADS}). " - "Auto-adjusting to ${TIMEMORY_MAX_THREADS}") - set(TIMEMORY_MAX_STORAGE_THREADS - "${TIMEMORY_MAX_THREADS}" - CACHE STRING "Maximum number of storage thread slots" FORCE) -endif() - -timemory_add_feature(TIMEMORY_MAX_STORAGE_THREADS - "Maximum number of storage thread slots") -timemory_add_cmake_defines(TIMEMORY_MAX_STORAGE_THREADS VALUE DEFAULT) - if(TIMEMORY_BUILD_EXAMPLES AND TIMEMORY_USE_COVERAGE AND "$ENV{CONTINUOUS_INTEGRATION}" STREQUAL "true") diff --git a/source/timemory/operations/types.hpp b/source/timemory/operations/types.hpp index 1f6b86529..cb0850176 100644 --- a/source/timemory/operations/types.hpp +++ b/source/timemory/operations/types.hpp @@ -813,7 +813,7 @@ template struct set_storage { friend struct get_storage; - static constexpr size_t max_threads = TIMEMORY_MAX_STORAGE_THREADS; + static constexpr size_t max_threads = TIMEMORY_MAX_THREADS; using type = T; using storage_array_t = std::array*, max_threads>;