Add iteration limit warning to static_val and code formatting fixes#197
Open
PhilippGrulich wants to merge 2 commits intov0.1from
Open
Add iteration limit warning to static_val and code formatting fixes#197PhilippGrulich wants to merge 2 commits intov0.1from
PhilippGrulich wants to merge 2 commits intov0.1from
Conversation
Warn on stderr when a static_val exceeds 1000 increments, as excessive iterations cause large traces and slow compilation. The warning fires once (at exactly 1000) and suggests using a regular val<> loop instead. Also applies clang-format fixes to several files. https://claude.ai/code/session_01DtVn8hcLR2jjfA7dB4A4xy
Replace std::cerr with spdlog::warn via the existing logging infrastructure. Add a free function WarnStaticValIterationLimit declared in the public header and defined in a new static.cpp, avoiding the namespace clash between nautilus::log (logging) and nautilus::log (cmath). Also add log::warn to logging.hpp. https://claude.ai/code/session_01DtVn8hcLR2jjfA7dB4A4xy
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a warning mechanism to
static_valwhen iteration limits are exceeded, and applies consistent code formatting across the codebase.Key Changes
Add iteration limit warning to static_val:
MAX_ITERATIONSconstant (1000) tostatic_valclassWarnStaticValIterationLimit()function to log warnings when iteration limit is reachedstatic.cppfile to implement the warning function using spdlog loggingAdd warn() logging function:
warn()template function inlogging.hppto support warning-level log messagestrace()anderror()functions with conditional compilation based onENABLE_LOGGINGCode formatting improvements:
operator##=→operator##=without space)IRGraph.cpp,ExecutionTrace.cpp, andTracingUtil.cppF T::* pm→F T::*pm)Build system update:
static.cppto CMakeLists.txt source filesImplementation Details
The iteration limit warning helps developers identify when
static_valloops may be causing excessive trace sizes and long compilation times, encouraging them to use regularval<>loops instead. The warning is only emitted once per loop when the limit is first reached.https://claude.ai/code/session_01DtVn8hcLR2jjfA7dB4A4xy