code: def parse_launch_bounds(code):
      func_arr = code.split('extern "C" __global__ ')
      for i in range(1, len(func_arr)):
          axis_map = dict()
          lines = func_arr[i].split("\n")
          for it in lines:
              if it.startswith("  // [thread_extent] "):
                  words = it.split(" ")
                  nthread = int(words[-1])
                  axis = words[-3]
                  if axis in axis_map:
                      if axis_map[axis] != nthread:
                          assert False
                  else:
                      axis_map[axis] = nthread
          block_bound = (
              axis_map.get("threadIdx.x", 1)
              * axis_map.get("threadIdx.y", 1)
              * axis_map.get("threadIdx.z", 1)
          )
          func_arr[
              i
          ] = 'extern "C" __global__ __launch_bounds__(%d) %s' % (
              block_bound,
              func_arr[i],
          )
  
      code = "".join(func_arr)
      return code
  
imports: import numpy
  import tvm
  import logging
  import math
  import re
  import sys, time, subprocess, os, random, hashlib
  from tvm import autotvm
  import topi
  import json
  from topi.util import get_const_tuple
  import importlib
  from tvm.autotvm.task.dispatcher import ApplyConfig
  from tvm.autotvm.task import ConfigEntity
  from threading import Timer
label_desc: Use image node_id 6 for calling a global function with example usage: parse_launch_bounds(code) and returns: code