Repository navigation
Conversation
Signed-off-by: Shivansh Singh <singhshivansh023@gmail.com>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Up to standards ✅🟢 Issues
|
hkaiser
left a comment
There was a problem hiding this comment.
Thanks, a NaN from a tuner shouldn't end up in the setting, and the tests are welcome. Two small things in clamped(): std::isnan is not constexpr before C++23, so clamped<float> can no longer be used in a constant expression; value != value does the same check and keeps it constexpr. And please mention in the doc comments of set() and set_all() that a NaN sets the setting to its minimum, since a tuner wouldn't expect that otherwise.
… NaN behavior Signed-off-by: Shivansh Singh <singhshivansh023@gmail.com>
|
Thanks @hkaiser! Replaced std::isnan(value) with value != value in clamped() to keep it constexpr in C++20 (added static_assert coverage including quiet_NaN()), removed the unused / <type_traits> includes, and updated the doc comments on set() and set_all() to note that NaN sets the setting to its minimum bound. |
hkaiser
left a comment
There was a problem hiding this comment.
Thanks, both are done, LGTM.
Proposed Changes
Guard
tuning_parameter_info::clamped<float>againstNaN(scheduler_tuning.hpp)std::clampwith aNaNinput is undefined behavior / propagatesNaNinto the atomic parameter slot (for example, if a dynamic tuner divides by zero).std::isnan(value)check forfloatparameters that falls back tomin_value.as<float>(), coveringadd(),set(), andset_all().Add unit test coverage (
scheduler_tuning.cpp)test_float_clamping: verifies out-of-range values,±infinity,quiet_NaN(), andsignaling_NaN()acrossadd(),set(), andset_all().test_add_setting_errors: verifieshpx::error::bad_parameteris thrown on duplicate parameter names and when exceedingmax_parameters(16).test_concurrent_set_all_get: verifies concurrentset_all()updates against multiple reader threads callingget<T>()without out-of-range reads or races.Verification
./build/bin/inspect --all libs/core/threading_base/ libs/core/schedulers/— 0 issues.tests.unit.modules.schedulers.scheduler_tuning— passed.tests.unit.modules.threading_base.scheduling_policy_idle_step— passed.