code: def test_triton_kernel_constants(self):
      @triton.jit
      def mulC_kernel(
          in_ptr0,
          out_ptr,
          n_elements,
          BLOCK_SIZE: "tl.constexpr",
          CONSTANT_NAME: "tl.constexpr",
      ):
          pid = tl.program_id(axis=0)
          block_start = pid * BLOCK_SIZE
          offsets = block_start + tl.arange(0, BLOCK_SIZE)
          mask = offsets < n_elements
          x = tl.load(in_ptr0 + offsets, mask=mask)
          if CONSTANT_NAME.value == STRING_CONSTANT_C:
              output = CONSTANT_C * x
          if BOOL_CONSTANT_C:
              output *= CONSTANT_C
          tl.store(out_ptr + offsets, output, mask=mask)
  
      def call_triton(
          x: torch.Tensor,
      ):
          output = torch.zeros_like(x)
          n_elements = output.numel()
  
          grid = (x.numel(),)
          mulC_kernel[grid](
              x,
              output,
              n_elements,
              BLOCK_SIZE=16,
              CONSTANT_NAME="CONSTANT_C",
          )
          return output
  
      # Triton kernels capture global constants by their parse time value
      # not runtime value
      global CONSTANT_C
      prev_c = CONSTANT_C
      # If the behavior of triton kernels change, this test will fail
      CONSTANT_C = 10
      assert CONSTANT_C != prev_c
  
      t = torch.randn(5, device="cuda")
      torch_result = call_triton(t)
      compiled_result = torch.compile(call_triton)(t)
  
      self.assertEqual(torch_result, compiled_result)
  
      # reset back
      CONSTANT_C = prev_c
  
imports: from unittest.mock import patch
  import torch
  import torch._dynamo.test_case
  import torch._dynamo.testing
  from torch._higher_order_ops.triton_kernel_wrap import triton_kernel_wrapper_functional, triton_kernel_wrapper_mutation
  from torch._inductor import metrics
  from torch.testing._internal import common_utils
  from torch.testing._internal.common_utils import skipIfRocm
  from torch.testing._internal.triton_utils import *
label_desc: Use image node_id 14 for calling the KernelTests obj's underlying member method code with example usage: obj.test_triton_kernel_constants() and returns: output