Skip to content

Commit e85d494

Browse files
authored
make valgrind_toggle and valgrind_supported_platform private (pytorch#46718)
1 parent a6e96b1 commit e85d494

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

torch/_C/__init__.pyi.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ def _log_api_usage_once(str) -> None: ... # LogAPIUsageOnceFromPython
381381
def _demangle(str) -> str: ... # c10::demangle
382382

383383
# Defined in `valgrind.h` and `callgrind.h` respecitively.
384-
def valgrind_supported_platform() -> _bool: ... # NVALGRIND
385-
def valgrind_toggle() -> None: ... # CALLGRIND_TOGGLE_COLLECT
384+
def _valgrind_supported_platform() -> _bool: ... # NVALGRIND
385+
def _valgrind_toggle() -> None: ... # CALLGRIND_TOGGLE_COLLECT
386386

387387
has_openmp: _bool
388388
has_mkl: _bool

torch/csrc/Module.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ Call this whenever a new thread is created in order to propagate values from
828828
ASSERT_TRUE(set_module_attr("has_lapack", at::hasLAPACK() ? Py_True : Py_False));
829829

830830
py_module.def(
831-
"valgrind_supported_platform", [](){
831+
"_valgrind_supported_platform", [](){
832832
#if defined(NVALGRIND)
833833
return false;
834834
#else
@@ -838,7 +838,7 @@ Call this whenever a new thread is created in order to propagate values from
838838
);
839839

840840
py_module.def(
841-
"valgrind_toggle", [](){
841+
"_valgrind_toggle", [](){
842842
#if defined(NVALGRIND)
843843
TORCH_CHECK(false, "Valgrind is not supported.");
844844
#else

torch/overrides.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ def get_ignored_functions() -> Set[Callable]:
156156
torch.is_deterministic,
157157
torch.set_deterministic,
158158
torch.unify_type_list,
159-
torch.valgrind_supported_platform,
160-
torch.valgrind_toggle,
161159
Tensor.__delitem__,
162160
Tensor.__dir__,
163161
Tensor.__getattribute__,

torch/utils/benchmark/utils/valgrind_wrapper/timer_interface.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def _diff(first: Tuple[FunctionCount, ...], second: Tuple[FunctionCount, ...]) -
176176
class _ValgrindWrapper(object):
177177
def __init__(self) -> None:
178178
self._commands_available: Dict[str, bool] = {}
179-
if torch._C.valgrind_supported_platform():
179+
if torch._C._valgrind_supported_platform():
180180
# Only bother checking on supported platforms.
181181
for cmd in ("valgrind", "callgrind_control", "callgrind_annotate"):
182182
self._commands_available[cmd] = not subprocess.run(
@@ -193,7 +193,7 @@ def __init__(self) -> None:
193193
self._baseline_cache: Dict[Tuple[int, int], Tuple[Tuple[FunctionCount, ...], Tuple[FunctionCount, ...]]] = {}
194194

195195
def _validate(self) -> None:
196-
if not torch._C.valgrind_supported_platform():
196+
if not torch._C._valgrind_supported_platform():
197197
raise OSError("Valgrind is not supported on this platform.")
198198

199199
missing_cmds = [cmd for cmd, available in self._commands_available.items() if not available]
@@ -444,13 +444,13 @@ def check_result(completed_process):
444444
# =============================================================================
445445
# == User code block ==========================================================
446446
# =============================================================================
447-
torch._C.valgrind_toggle()
447+
torch._C._valgrind_toggle()
448448
{blocked_stmt}
449449
450450
# Sleep is to allow the interpreter to catch up before we stop collecting in
451451
# order to reduce jitter.
452452
time.sleep(0.01)
453-
torch._C.valgrind_toggle()
453+
torch._C._valgrind_toggle()
454454
""").strip().format(
455455
indented_stmt=textwrap.indent(stmt, " " * 4),
456456
blocked_stmt=blocked_stmt,

0 commit comments

Comments
 (0)