code: def _assign_targets_to_primfuncs_irmodule(mod, target):
      """Helper to assign target for PrimFunc in a IRModule"""
      ret = tvm.IRModule()
      for global_var, basefunc in mod.functions.items():
          if isinstance(basefunc, tvm.tir.PrimFunc):
              ret[global_var] = basefunc.with_attr("target", target)
      return ret
  
imports: import sys
  import pytest
  import tvm
  from tvm import PoolInfoProperties, WorkspacePoolInfo
  from tvm.script import tir, ir
  from tvm.target import Target
  from tvm.tir import stmt_functor
  from tvm.tir.usmp import utils
label_desc: Use image node_id 4 for calling a global function with example usage: _assign_targets_to_primfuncs_irmodule(mod, target) and returns: ret