code: def check_error(func, rel_lineno):
      check_error_re = re.compile(r"^.*# check_error: (.+)$")
      """check if TIR script throws error"""
      # Override the default renderer to accumulate errors
      errors = []
  
      def render(e):
          for d in e.diagnostics:
              errors.append(d)
  
      override_renderer(render)
      # The diagnostic context throws an exception when it gets an error
      try:
          source_code = inspect.getsource(func)
          indent = len(re.match(r"^\s*", source_code).group(0))
          source_code = "@T.prim_func\n" + "\n".join(
              line[indent:] for line in source_code.splitlines()
          )
          from_source(source_code)
      except tvm.error.DiagnosticError as e:
          pass
      assert len(errors) == 1, errors
      if rel_lineno is None:
          return
      error = errors[0]
      assert (
          error.span.line - 1 == rel_lineno
          or error.span.line == rel_lineno
      ), f"Expected error to be on line {rel_lineno}, but it was on {error.span.line - 1}"
  
      error_line = source_code.split("\n")[rel_lineno]
      m = check_error_re.match(error_line)
      if m:
          expected_error_text = m.group(1)
          error = error.message
          assert (
              expected_error_text == error
          ), f'check_error expects "{expected_error_text} in str(errors): {error}'
  
imports: import inspect
  import re
  import pytest
  import tvm
  import tvm.testing
  from tvm import tir
  from tvm.ir.diagnostics import override_renderer
  from tvm.script import from_source
  from tvm.script import tir
label_desc: Use image node_id 1 for calling a global function with example usage: check_error(func, rel_lineno) without return types