Why does custom passes before joint graph (joint_custom_pre_pass) executed twice?

QZero_Chen: <aside class="onebox githubblob" data-onebox-src="https://github.com/pytorch/pytorch/blob/d73c283c3a315cbed83e1795bb05db8ec315c48a/torch/_inductor/fx_passes/joint_graph.py#L581">
  <header class="source">

      <a href="https://github.com/pytorch/pytorch/blob/d73c283c3a315cbed83e1795bb05db8ec315c48a/torch/_inductor/fx_passes/joint_graph.py#L581" target="_blank" rel="noopener nofollow ugc">github.com/pytorch/pytorch</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/pytorch/blob/d73c283c3a315cbed83e1795bb05db8ec315c48a/torch/_inductor/fx_passes/joint_graph.py#L581" target="_blank" rel="noopener nofollow ugc">torch/_inductor/fx_passes/joint_graph.py</a></h4>

<div class="git-blob-info">
  <a href="https://github.com/pytorch/pytorch/blob/d73c283c3a315cbed83e1795bb05db8ec315c48a/torch/_inductor/fx_passes/joint_graph.py#L581" rel="noopener nofollow ugc"><code>d73c283c3</code></a>
</div>



    <pre class="onebox"><code class="lang-py">
      <ol class="start lines" start="571" style="counter-reset: li-counter 570 ;">
          <li>    torch.fx.passes.graph_transform_observer.GraphTransformObserver,</li>
          <li>    subsystem="joint_graph_passes",</li>
          <li>)</li>
          <li></li>
          <li>lazy_init()</li>
          <li>count = 0</li>
          <li></li>
          <li># must occur before other passes</li>
          <li>canonicalize_aten_ir_passes(graph)</li>
          <li></li>
          <li class="selected">if config.joint_custom_pre_pass is not None:</li>
          <li>    GraphTransformObserver(graph, "joint_custom_pre_pass").apply_graph_pass(</li>
          <li>        config.joint_custom_pre_pass</li>
          <li>    )</li>
          <li>    count += 1</li>
          <li></li>
          <li>from .post_grad import remove_noop_ops</li>
          <li></li>
          <li>GraphTransformObserver(graph, "remove_noop_ops").apply_graph_pass(remove_noop_ops)</li>
          <li></li>
          <li>if config.joint_graph_constant_folding:</li>
      </ol>
    </code></pre>



  </article>

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

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

<p>And</p>
<aside class="onebox githubblob" data-onebox-src="https://github.com/pytorch/pytorch/blob/d73c283c3a315cbed83e1795bb05db8ec315c48a/torch/_inductor/fx_passes/joint_graph.py#L596">
  <header class="source">

      <a href="https://github.com/pytorch/pytorch/blob/d73c283c3a315cbed83e1795bb05db8ec315c48a/torch/_inductor/fx_passes/joint_graph.py#L596" target="_blank" rel="noopener nofollow ugc">github.com/pytorch/pytorch</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/pytorch/blob/d73c283c3a315cbed83e1795bb05db8ec315c48a/torch/_inductor/fx_passes/joint_graph.py#L596" target="_blank" rel="noopener nofollow ugc">torch/_inductor/fx_passes/joint_graph.py</a></h4>

<div class="git-blob-info">
  <a href="https://github.com/pytorch/pytorch/blob/d73c283c3a315cbed83e1795bb05db8ec315c48a/torch/_inductor/fx_passes/joint_graph.py#L596" rel="noopener nofollow ugc"><code>d73c283c3</code></a>
</div>



    <pre class="onebox"><code class="lang-py">
      <ol class="start lines" start="586" style="counter-reset: li-counter 585 ;">
          <li></li>
          <li>from .post_grad import remove_noop_ops</li>
          <li></li>
          <li>GraphTransformObserver(graph, "remove_noop_ops").apply_graph_pass(remove_noop_ops)</li>
          <li></li>
          <li>if config.joint_graph_constant_folding:</li>
          <li>    GraphTransformObserver(graph, "constant_fold_uniform_value").apply_gm_pass(</li>
          <li>        constant_fold_uniform_value</li>
          <li>    )</li>
          <li></li>
          <li class="selected">if config.joint_custom_pre_pass is not None:</li>
          <li>    GraphTransformObserver(graph, "joint_custom_pre_pass").apply_graph_pass(</li>
          <li>        config.joint_custom_pre_pass</li>
          <li>    )</li>
          <li>    count += 1</li>
          <li></li>
          <li>if config.pattern_matcher:</li>
          <li>    for i, patterns in enumerate(pass_patterns):</li>
          <li>        maybe_count = GraphTransformObserver(</li>
          <li>            graph, f"pass_pattern_{i}"</li>
          <li>        ).apply_graph_pass(patterns.apply)</li>
      </ol>
    </code></pre>



  </article>

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

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

<p>Why does joint_custom_pre_pass executed twice, is this a mistake or a design by purpose?</p>