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

Fix a data race and add a CMake TSan option. #848

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Conversation

bjacob
Copy link
Contributor

@bjacob bjacob commented Jan 20, 2025

The C++ bit solves a data race reported by TSan, see #847.

The CMake bit mimics what exists for ASAN and removes an incorrect # Enable more ASAN checks comment. The IREE_SANITIZER_ are used in core logic to check against mismatches between the IREE runtime and the libraries it loads.
https://github.com/iree-org/iree/blob/db129e500f35ead4debc363eb15ebfb929ee512b/runtime/src/iree/hal/local/loaders/system_library_loader.c#L168-L178

Fixes #847

Signed-off-by: Benoit Jacob <[email protected]>
add_compile_definitions(IREE_SANITIZER_ADDRESS)
endif()

option(SHORTFIN_ENABLE_TSAN "Enable TSAN" OFF)
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a note here advertising the TSAN option too?

shark-ai/shortfin/README.md

Lines 146 to 148 in 26bb250

* `SHORTFIN_ENABLE_ASAN=ON` : Enables an ASAN build. Requires a Python runtime
setup that is ASAN clean (either by env vars to preload libraries or set
suppressions or a dev build of Python with ASAN enabled).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't tried to run anything else than ctest so I have no experience with Python so I wouldn't know what to write here.... can I just defer to you in a follow-up?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, fair. That is Python-specific and does also rely on this plumbing:

add_env_cmake_setting(cmake_args, "SHORTFIN_ENABLE_ASAN")

I was mainly looking for any developer docs we have that mention ASan, since they could also mention TSan and other sanitizers too.

Fine to just add the option to CMake for now.

@bjacob bjacob merged commit 3d36fe8 into nod-ai:main Jan 20, 2025
37 checks passed
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

Successfully merging this pull request may close these issues.

TSan reports a data race in BlockingExecutor::ThreadInstance::RunOnThread()
2 participants