code: def test_mma_script_after_build():
      arch = tvm.contrib.nvcc.get_target_compute_version()
      major, _ = tvm.contrib.nvcc.parse_compute_version(arch)
      if major < 8:
          # At least sm80 is required
          return
  
      mod = te.create_prim_func(
          matmul_fp16(M=4096, N=4096, K=4096, out_dtype="float16")
      )
      actual = _design_space(mod, "float16")
      assert len(actual) == 1
      sketch = actual[0]
  
      i = 0
      new_decisions = {}
      for inst in sketch.trace.insts:
          if not inst.kind.name.startswith("Sample"):
              continue
          assert i < len(gemm_decision)
          if inst.kind.name == gemm_decision[i][0]:
              new_decisions[inst] = gemm_decision[i][1]
              i += 1
      assert len(new_decisions) == len(gemm_decision)
      sch = Schedule(mod)
      Trace(
          insts=sketch.trace.insts,
          decisions=new_decisions,
      ).apply_to_schedule(sch, remove_postproc=True)
  
      sch.enter_postproc()
      # DefaultCUDATensorCore
      ms.postproc.DisallowDynamicLoop().apply(sch)
      ms.postproc.RewriteCooperativeFetch().apply(sch)
      # Disable RewriteUnboundBlock here since max_threads_per_block_ is not set
      # ms.postproc.RewriteUnboundBlock(256).apply(sch)
      ms.postproc.RewriteParallelVectorizeUnroll().apply(sch)
      ms.postproc.RewriteReductionBlock().apply(sch)
      ms.postproc.VerifyGPUCode().apply(sch)
      ms.postproc.RewriteTensorize(False).apply(sch)
  
      with tvm.transform.PassContext(config={"tir.use_async_copy": 1}):
          rt_mod = tvm.build(sch.mod, target="cuda")
  
      assert (
          rt_mod.imported_modules[0].get_source()
          == expected_cuda_script
      )
  
imports: import tempfile
  import numpy
  import tvm
  from tvm import te
  from tvm import meta_schedule
  from tvm._ffi import register_func
  from tvm.meta_schedule.testing.space_generation import check_sketches, generate_design_space
  from tvm.meta_schedule.builder import LocalBuilder
  from tvm.script import ir
  from tvm.script import tir
  from tvm.target import Target
  from tvm.tir import Schedule
  from tvm.tir.schedule import Trace
  from tvm.tir.tensor_intrin import cuda
  import tvm.testing
label_desc: Use image node_id 5 for calling a global function with example usage: test_mma_script_after_build() without return types