code: def compile_for_cutlass(mod, cutlass_target):
      """Given an IRModule with at least one Compiler='cutlass' Relay function, return a
      LibraryModule with all such functions compiled into their PackedFunc-compatible form.
       - First runs CUTLASS tuning to decide on the best kernels, which itself requires the
         repeated compilation and execution of CUDA code using nvcc. The results of this
         is captured as annotation on each relevant function. Kernel performance is cached
         overall all functions.
       - Then generates a single CSourceModule containing C code implementing all the
         Compiler='cutlass' Relay functions, accounting for the tuning done above.
       - Then compiles that CSourceModule with the appropriate nvcc arguments to yield
         a static .o library. An export_library step will be required on the final runtime
         module to link that library into the overall .so library.
       See CompileForCutlass in src/relay/backend/contrib/cutlass/codegen.cc for where this
       helper function is used to implement the RelayToTIR pass hook for CUTLASS.
      """
  
      # Recover options from the current 'cutlass' Target
      assert cutlass_target.kind.name == "cutlass"
      tuning_config = {
          key: cutlass_target.attrs.get(key)
          for key in [
              "sm",
              "use_3xtf32",
              "split_k_slices",
              "profile_all_alignments",
              "find_first_valid",
              "use_multiprocessing",
          ]
      }
      compile_config = {
          key: cutlass_target.attrs.get(key)
          for key in ["sm", "threads", "use_fast_math"]
      }
      tmp_dir = cutlass_target.attrs.get("tmp_dir")
      compile_config["tmp_dir"] = tmp_dir
  
      # Tune
      logger.info("Tuning for CUTLASS")
      mod, _ = tune_cutlass_kernels(
          mod, tmp_dir=tmp_dir, **tuning_config
      )
  
      # Compile
      logger.info("Creating CSource module for CUTLASS")
      create_c_source_module = tvm._ffi.get_global_func(
          "relay.ext.cutlass.create_c_source_module"
      )
      c_module = create_c_source_module(mod)
      return compile_cutlass_module(c_module, compile_config)
  
imports: import logging
  import os
  import multiprocessing
  import tvm
  from tvm import relay, runtime
  from tvm._ffi.registry import register_func
  from tvm.contrib.nvcc import get_cuda_version
  from .gen_conv2d import CutlassConv2DProfiler
  from .gen_gemm import CutlassGemmProfiler
  from .library import ConvKind
label_desc: Use image node_id 12 for calling a global function with example usage: compile_for_cutlass(mod, cutlass_target) and returns: compile_cutlass_module