[JIT] add GRAPH_DEBUG for setGraphExecutorOptimize (#153549)

Summary: Optionally log when setGraphExecutorOptimize is called, so we can get insight into the GraphExecutor behavior.

Differential Revision: D74692508

Pull Request resolved: https://github.com/pytorch/pytorch/pull/153549
Approved by: https://github.com/PaulZhang12, https://github.com/SamGinzburg
This commit is contained in:
David Berard 2025-05-14 20:07:22 +00:00 committed by PyTorch MergeBot
parent dda2c7c8fc
commit 5e6e52e7c9
2 changed files with 3 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <c10/util/StringUtil.h>
#include <torch/csrc/Export.h> #include <torch/csrc/Export.h>
#include <memory> #include <memory>
#include <ostream> #include <ostream>

View File

@ -1,3 +1,4 @@
#include <torch/csrc/jit/jit_log.h>
#include <torch/csrc/jit/python/update_graph_executor_opt.h> #include <torch/csrc/jit/python/update_graph_executor_opt.h>
namespace torch::jit { namespace torch::jit {
@ -5,6 +6,7 @@ namespace torch::jit {
static thread_local bool kOptimize = true; static thread_local bool kOptimize = true;
void setGraphExecutorOptimize(bool o) { void setGraphExecutorOptimize(bool o) {
kOptimize = o; kOptimize = o;
GRAPH_DEBUG("GraphExecutorOptimize set to ", o);
} }
bool getGraphExecutorOptimize() { bool getGraphExecutorOptimize() {
return kOptimize; return kOptimize;