PYTORCH_FUSION_DEBUG=1 gives blank output

username: david-macleod
cooked: <p>I have seen in several places examples using <code>PYTORCH_FUSION_DEBUG=1</code> to retrieve the source of the fused kernels (for example here <a href="https://github.com/pytorch/pytorch/issues/24032" class="inline-onebox" rel="noopener nofollow ugc">[JIT] Fusion of Dropout without constant is_training parameter is unsuccessful · Issue #24032 · pytorch/pytorch · GitHub</a>), I am assuming this dumps it to stdout, but when run with this variable set I see nothing.</p>
<p>Could anyone give advice on how to get this working? Perhaps I need to compile PyTorch with specific flags set?</p>

username: tom
cooked: <p>PyTorch has 3 fusers (legacy, NNC/TensorExpr fuser, and cuda/nvFuser), the <code>PYTORCH_FUSION_DEBUG</code> only worked for the old (now legacy) fuser.<br>
For the newer fusers, you probably could get some info from the logging facility described here:</p>
<aside class="onebox githubblob" data-onebox-src="https://github.com/pytorch/pytorch/blob/f9c0a39ad9320795fc8df77b570c317e0c2ab60e/torch/csrc/jit/jit_log.h#L7-L38">
  <header class="source">

      <a href="https://github.com/pytorch/pytorch/blob/f9c0a39ad9320795fc8df77b570c317e0c2ab60e/torch/csrc/jit/jit_log.h#L7-L38" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/pytorch/blob/f9c0a39ad9320795fc8df77b570c317e0c2ab60e/torch/csrc/jit/jit_log.h#L7-L38" target="_blank" rel="noopener nofollow ugc">pytorch/pytorch/blob/f9c0a39ad9320795fc8df77b570c317e0c2ab60e/torch/csrc/jit/jit_log.h#L7-L38</a></h4>



  <pre class="onebox">    <code class="lang-h">
      <ol class="start lines" start="7" style="counter-reset: li-counter 6 ;">
          <li>// `TorchScript` offers a simple logging facility that can enabled by setting an</li>
          <li>// environment variable `PYTORCH_JIT_LOG_LEVEL`.</li>
          <li>
          </li>
<li>// Logging is enabled on a per file basis. To enable logging in</li>
          <li>// `dead_code_elimination.cpp`, `PYTORCH_JIT_LOG_LEVEL` should be</li>
          <li>// set to `dead_code_elimination.cpp` or, simply, to `dead_code_elimination`</li>
          <li>// (i.e. `PYTORCH_JIT_LOG_LEVEL=dead_code_elimination`).</li>
          <li>
          </li>
<li>// Multiple files can be logged by separating each file name with a colon `:` as</li>
          <li>// in the following example,</li>
          <li>// `PYTORCH_JIT_LOG_LEVEL=dead_code_elimination:guard_elimination`</li>
          <li>
          </li>
<li>// There are 3 logging levels available for your use ordered by the detail level</li>
          <li>// from lowest to highest.</li>
          <li>
          </li>
<li>// * `GRAPH_DUMP` should be used for printing entire graphs after optimization</li>
          <li>// passes</li>
          <li>// * `GRAPH_UPDATE` should be used for reporting graph transformations (i.e.</li>
          <li>// node deletion, constant folding, etc)</li>
          <li>// * `GRAPH_DEBUG` should be used for providing information useful for debugging</li>
      </ol>
    </code>
  </pre>

  This file has been truncated. <a href="https://github.com/pytorch/pytorch/blob/f9c0a39ad9320795fc8df77b570c317e0c2ab60e/torch/csrc/jit/jit_log.h#L7-L38" target="_blank" rel="noopener nofollow ugc">show original</a>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>Best regards</p>
<p>Thomas</p>

username: david-macleod
cooked: <p>Great, thanks for the quick reply!</p>