Skip to content

Commit

Permalink
Try to fix remaining ASAN-reported leaks (#7767)
Browse files Browse the repository at this point in the history
This fixes all but one of the known remaining ASAN-related leaks; the remaining is in `tutorial_lesson_19_wrapper_funcs`

I can't debug that one locally because the leaks are in OpenCL and I am temporarily relegated to using a 'cloud' machine with no real GPU for linux-x64 -- if someone with access to such a machine could take a look, I'd appreciate it (examples of leakage at https://buildbot.halide-lang.org/master/#/builders/154/builds/79/steps/12/logs/tutorial_lesson_19_wrapper_funcs)
  • Loading branch information
steven-johnson authored Aug 21, 2023
1 parent c50d11a commit 36eb0b2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake/toolchain.linux-x64-asan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/env)
# Can't mix -fsanitize=address with -fsanitize=fuzzer
set(WITH_TEST_FUZZ OFF)

# Sanitizer builds intermittently fail when using CCache for reasons that aren't
# clear; default to turning it off
set(Halide_CCACHE_BUILD OFF)

if (NOT DEFINED Halide_SHARED_ASAN_RUNTIME_LIBRARY)
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} "-print-file-name=libclang_rt.asan.so"
Expand All @@ -49,3 +53,4 @@ set(
Halide_PYTHON_LAUNCHER
${CMAKE_COMMAND} -E env ASAN_OPTIONS=detect_leaks=0 LD_PRELOAD=${Halide_SHARED_ASAN_RUNTIME_LIBRARY}
)

4 changes: 4 additions & 0 deletions cmake/toolchain.linux-x64-fuzzer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/env)

# Sanitizer builds intermittently fail when using CCache for reasons that aren't
# clear; default to turning it off
set(Halide_CCACHE_BUILD OFF)
2 changes: 2 additions & 0 deletions test/correctness/skip_stages_memoize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ int main(int argc, char **argv) {
return 1;
}

Internal::JITSharedRuntime::release_all();

printf("Success!\n");
return 0;
}
3 changes: 3 additions & 0 deletions test/generator/error_codes_aottest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ int main(int argc, char **argv) {
check(result, correct);
in.dim = shape;

free(in.host);
free(out.host);

printf("Success!\n");
return 0;
}

0 comments on commit 36eb0b2

Please sign in to comment.