code: def decide_global_ordering_of_comms(
      nodes: List["scheduler.BaseSchedulerNode"],
  ):
      """
      Decide global ordering of comms, by just enforcing the ordering that's in the input graph
      (might not be the same ordering as the eager mode program).
      TODO: Come up with a better approach
      """
      comm_nodes = [
          n for n in nodes if isinstance(n.node, ir.CollectiveKernel)
      ]
      for i in range(1, len(comm_nodes)):
          # Enforce ordering by making previous comm a `WeakDep` dependency of the next comm
          comm_nodes[i].add_fake_dep(
              WeakDep(comm_nodes[i - 1].get_name())
          )
  
file_path: pytorch/torch/_inductor/comms.py
imports: from typing import List
  import torch
  from .None import config, ir, scheduler
  from .dependencies import WeakDep
  from .utils import tuple_sorted
label_desc: Use image node_id 5 for calling a global function with example usage: decide_global_ordering_of_comms(nodes) without return types