Skip to content

Bypass denormals-to-zero assertion when running under Valgrind - #16072

Merged
JoergAtGithub merged 1 commit into
mixxxdj:mainfrom
LuciferDono:fix/valgrind-denormals-assertion
Mar 6, 2026
Merged

Bypass denormals-to-zero assertion when running under Valgrind#16072
JoergAtGithub merged 1 commit into
mixxxdj:mainfrom
LuciferDono:fix/valgrind-denormals-assertion

Conversation

@LuciferDono

Copy link
Copy Markdown
Contributor

When running Mixxx under Valgrind, the denormals-to-zero verification assertion fails:

DEBUG ASSERT: "doubleMin / 2 == 0.0" in function callbackProcessClkRef()
Denormals to zero mode is not working. EQs and effects may suffer high CPU load

This happens because Valgrind intentionally does not emulate SSE DAZ/FTZ modes and instead uses standard IEEE 754 floating-point behavior, so DBL_MIN / 2 produces a subnormal value rather than 0.0.

This patch detects Valgrind at runtime using the RUNNING_ON_VALGRIND macro from <valgrind/valgrind.h> and skips the assertion in that case. The include is guarded with __has_include so it compiles cleanly on systems without valgrind-dev installed.

Both sounddeviceportaudio.cpp and sounddevicenetwork.cpp are patched since they share the same assertion.

Fixes #16053

@JoergAtGithub

Copy link
Copy Markdown
Member

Welcome at Mixxx!
As a first-time contributor we need you to sign the Mixxx Contributor Agreement and comment here when you have done so. It gives us permission to distribute your contribution under the GPL v2 or later license and the Apple Mac App Store. It is also helpful for us to have contact information for contributors in case we may need it in the future.

@daschuer daschuer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. The code looks good..
We only waif for confirmation that you have signed the CLA

@LuciferDono

Copy link
Copy Markdown
Contributor Author

Thank you. The code looks good.. We only waif for confirmation that you have signed the CLA

Done.

@LuciferDono
LuciferDono force-pushed the fix/valgrind-denormals-assertion branch from d1ac51e to 1202eee Compare March 3, 2026 13:41
@LuciferDono

Copy link
Copy Markdown
Contributor Author

Fixed the pre-commit code style check — adjusted indentation of the VERIFY_OR_DEBUG_ASSERT block and the else branch to satisfy clang-format when nested under the #if/else preprocessor guard.

@daschuer

daschuer commented Mar 3, 2026

Copy link
Copy Markdown
Member

Oh I see that unfortunately pre-commit is still complaining. The recommended way to solve it is to run pre-commit locally.
https://github.com/mixxxdj/mixxx/wiki/Using-Git#set-up-automatic-code-checking

The other option is to apply the patch from the faulty workflow run.

Valgrind intentionally does not emulate SSE DAZ/FTZ modes, so the
DBL_MIN / 2 == 0.0 check always fails under Valgrind. Detect this
at runtime using RUNNING_ON_VALGRIND and skip the assertion.

The include is guarded with __has_include so it compiles cleanly
on systems without valgrind-dev installed.

Fixes mixxxdj#16053
@LuciferDono
LuciferDono force-pushed the fix/valgrind-denormals-assertion branch from 1202eee to 1aefc3f Compare March 5, 2026 18:37
@LuciferDono

Copy link
Copy Markdown
Contributor Author

Applied the pre-commit patch — the only issue was a long qWarning() string in sounddeviceportaudio.cpp that needed wrapping to satisfy clang-format. Should be green now.

@JoergAtGithub

Copy link
Copy Markdown
Member

LGTM! Thank you!

@JoergAtGithub
JoergAtGithub merged commit d9801d5 into mixxxdj:main Mar 6, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Valgrind: Denormals to zero mode is not working

3 participants