Skip to content

Commit 85e09c7

Browse files
author
Han Wang
committed
fix(ci): clear LD_PRELOAD before AOTInductor compilation
LSAN runtime inherited by g++ subprocesses causes false leak reports and non-zero exit codes, making torch._inductor think no C++ compiler works. Clear LD_PRELOAD after custom ops are loaded since it's no longer needed.
1 parent 0c52e80 commit 85e09c7

5 files changed

Lines changed: 15 additions & 0 deletions

File tree

source/tests/infer/gen_dpa1.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ def _ensure_inductor_compiler():
3737
if fallback not in search and shutil.which(fallback):
3838
search.append(fallback)
3939
inductor_config.cpp.cxx = tuple(search)
40+
# Clear LD_PRELOAD so compiler subprocesses don't inherit the LSAN runtime,
41+
# which causes false leak reports and non-zero exit codes in g++.
42+
os.environ.pop("LD_PRELOAD", None)
4043

4144

4245
def _load_custom_ops():

source/tests/infer/gen_dpa2.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ def _ensure_inductor_compiler():
3737
if fallback not in search and shutil.which(fallback):
3838
search.append(fallback)
3939
inductor_config.cpp.cxx = tuple(search)
40+
# Clear LD_PRELOAD so compiler subprocesses don't inherit the LSAN runtime,
41+
# which causes false leak reports and non-zero exit codes in g++.
42+
os.environ.pop("LD_PRELOAD", None)
4043

4144

4245
def _load_custom_ops():

source/tests/infer/gen_dpa3.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ def _ensure_inductor_compiler():
3737
if fallback not in search and shutil.which(fallback):
3838
search.append(fallback)
3939
inductor_config.cpp.cxx = tuple(search)
40+
# Clear LD_PRELOAD so compiler subprocesses don't inherit the LSAN runtime,
41+
# which causes false leak reports and non-zero exit codes in g++.
42+
os.environ.pop("LD_PRELOAD", None)
4043

4144

4245
def _load_custom_ops():

source/tests/infer/gen_fparam_aparam.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ def _ensure_inductor_compiler():
3737
if fallback not in search and shutil.which(fallback):
3838
search.append(fallback)
3939
inductor_config.cpp.cxx = tuple(search)
40+
# Clear LD_PRELOAD so compiler subprocesses don't inherit the LSAN runtime,
41+
# which causes false leak reports and non-zero exit codes in g++.
42+
os.environ.pop("LD_PRELOAD", None)
4043

4144

4245
def _load_custom_ops():

source/tests/infer/gen_sea.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def _ensure_inductor_compiler():
3333
if fallback not in search and shutil.which(fallback):
3434
search.append(fallback)
3535
inductor_config.cpp.cxx = tuple(search)
36+
# Clear LD_PRELOAD so compiler subprocesses don't inherit the LSAN runtime,
37+
# which causes false leak reports and non-zero exit codes in g++.
38+
os.environ.pop("LD_PRELOAD", None)
3639

3740

3841
def _load_custom_ops():

0 commit comments

Comments
 (0)