Skip to content

[handshake-runner] possible race condition when gathering the simulation time #1555

Open
@youngar

Description

@youngar

I'm building on OSX and using Clang version 12, using a unified build and LLVM_USE_SANITIZER:STRING=Address;Undefined. I did a fresh build from scratch today and started seeing this issue.

Many of the handshake-runner tests are spuriously failing due to an error detected by UBSan:

andrewy@ayoung-0504~/w/c/build> /Users/andrewy/wsp/circt/build/bin/circt-opt -create-dataflow /Users/andrewy/wsp/circt/test/handshake-runner/histogram-std.mlir | /Users/andrewy/wsp/circt/build/bin/handshake-runner
0
/Users/andrewy/wsp/circt/tools/handshake-runner/Simulation.cpp:716:25: runtime error: 9.59553e+210 is outside the range of representable values of type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Users/andrewy/wsp/circt/tools/handshake-runner/Simulation.cpp:716:25 in
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /Users/andrewy/wsp/circt/build/bin/handshake-runner
fish: Process 98048, '/Users/andrewy/wsp/circt/build/bin/handshake-runner' from job 1, '/Users/andrewy/wsp/circt/build/…' terminated by signal SIGABRT (Abort)

The code in question is here: https://github.com/llvm/circt/blob/main/tools/handshake-runner/Simulation.cpp#L715. When the double named time is larger than an integer can represent, UBSan is aborting the program. I added a printf:

llvm::errs() << "time: " << time << "\N";

right before the aborting line of code, and it looks like each test is 50% of the time printing some stable number (1.150000e+02 for the test above) and 50% of the time printing something very random looking which crashes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions