Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

itv::interval itv::interval_algebra::fPow(const itv::interval&, const itv::interval&): Assertion `x.lo() > 0' failed. #1117

Open
jcelerier opened this issue Feb 5, 2025 · 7 comments

Comments

@jcelerier
Copy link
Contributor

Hello !
I'm seeing this error crop up in various examples.

I haven't managed to reduce it so far, but it happens for instance on archlinux with the official faust package, when compiling the example distortion.dsp:

declare name "distortion";
declare version "0.0";
declare author "JOS, revised by RM";
declare description "Distortion demo application.";

import("stdfaust.lib");

process = dm.cubicnl_demo;

here's a stacktrace without debug info, I'm going to rebuild faust with debuginfo and give more precision

(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at pthread_kill.c:44
#1  __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at pthread_kill.c:89
#3  0x00007ffff1e417d8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff1e2447b in __GI_abort () at abort.c:79
#5  0x00007ffff1e2439f in __assert_fail_base (
    fmt=0x7ffff1fbf620 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=assertion@entry=0x7fffcb023d9e "x.lo() > 0",
    file=file@entry=0x7fffcb00ddb0 "/usr/src/debug/faust/faust-2.75.7/compiler/interval/intervalPow.cpp", line=line@entry=88,
    function=function@entry=0x7fffcb00dd58 "itv::interval itv::interval_algebra::fPow(const itv::interval&, const itv::interval&)") at assert.c:96
#6  0x00007ffff1e37de6 in __assert_fail (assertion=0x7fffcb023d9e "x.lo() > 0",
    file=0x7fffcb00ddb0 "/usr/src/debug/faust/faust-2.75.7/compiler/interval/intervalPow.cpp",
    line=88,
    function=0x7fffcb00dd58 "itv::interval itv::interval_algebra::fPow(const itv::interval&, const itv::interval&)") at assert.c:105
#7  0x00007fffcacbecbc in itv::interval_algebra::fPow(itv::interval const&, itv::interval const&) ()
   from /usr/lib/libfaust.so.2
#8  0x00007fffcacbef13 in itv::interval_algebra::Pow(itv::interval const&, itv::interval const&) ()
   from /usr/lib/libfaust.so.2
#9  0x00007fffcaca2472 in PowPrim::inferSigType(std::vector<P<AudioType>, std::allocator<P<AudioType> > > const&) () from /usr/lib/libfaust.so.2
#10 0x00007fffcae3b33b in ?? () from /usr/lib/libfaust.so.2

...

#23 0x00007fffcae3eb2f in ?? () from /usr/lib/libfaust.so.2
#24 0x00007fffcae41783 in typeAnnotation(CTreeBase*, bool) () from /usr/lib/libfaust.so.2
#25 0x00007fffcade420b in simplifyToNormalForm(CTreeBase*) () from /usr/lib/libfaust.so.2
#26 0x00007fffcac3fe3c in InstructionsCompiler::prepare(CTreeBase*) () from /usr/lib/libfaust.so.2
#27 0x00007fffcac01198 in DAGInstructionsCompiler::compileMultiSignal(CTreeBase*) ()
   from /usr/lib/libfaust.so.2
#28 0x00007fffcacce6f7 in ?? () from /usr/lib/libfaust.so.2
#29 0x00007fffcacd0fd4 in ?? () from /usr/lib/libfaust.so.2
#30 0x00007ffff1e9ec07 in start_thread (arg=<optimized out>) at pthread_create.c:447
#31 0x00007ffff1f2188c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
@sletz
Copy link
Member

sletz commented Feb 5, 2025

Which faust version precisely ?

@jcelerier
Copy link
Contributor Author

Reduction:

fails:

process(x) =  x * x;  

works:

process(x) =  x;  
FAUST Version 2.75.7
Embedded backends:
   DSP to C
   DSP to C++
   DSP to Cmajor
   DSP to Codebox
   DSP to CSharp
   DSP to DLang
   DSP to FIR
   DSP to Interpreter
   DSP to Java
   DSP to JAX
   DSP to Julia
   DSP to JSFX
   DSP to LLVM IR
   DSP to old C++
   DSP to Rust
   DSP to VHDL
   DSP to WebAssembly (wast/wasm)
Build with LLVM version 19.1.6
Copyright (C) 2002-2024, GRAME - Centre National de Creation Musicale. All rights reserved.

@jcelerier
Copy link
Contributor Author

https://archlinux.org/packages/extra/x86_64/faust/ it's this package

@jcelerier
Copy link
Contributor Author

that said it works on a simple example so maybe I'm having a case of multiple libraries that export symbols with the same name... investigating

@jcelerier
Copy link
Contributor Author

jcelerier commented Feb 5, 2025

ah! found the root cause.. it seems that compiling doesn't work when denormal fp numbers are disabled:

#include <cassert>
#include <iostream>

#include <faust/dsp/llvm-dsp.h>
int main(int argc, char** argv)
{
  _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
  _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
  std::string err;
  err.resize(4097);

  llvm_dsp_factory* fac{};

  {
    int argc = 0;
    const char* argv[] = {nullptr};
    fac = createDSPFactoryFromString(
        "score", "process(x) = x * x;", argc, argv, "", err, -1);
    assert(fac);

    auto obj = fac->createDSPInstance();
    assert(obj);

    obj->init(44100);
  }
}

@sletz
Copy link
Member

sletz commented Feb 5, 2025

Interesting... does not fail on ARM here. I'll have look ASAP.

@jcelerier
Copy link
Contributor Author

I think it's fine to assume that denormal numbers should be on during compilation time, that said maybe this crash could be revealing some bug in the interval arithmetic calculation as I'd expect these assertions from a quick glance to hold either case. But I'm definitely not a deep IEEE754 expert aha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants