code: def test_spirv(ctx_factory):
      ctx = ctx_factory()
      queue = cl.CommandQueue(ctx)
  
      if ctx._get_cl_version() < (
          2,
          1,
      ) or cl.get_cl_header_version() < (2, 1):
          pytest.skip(
              "SPIR-V program creation only available "
              "in OpenCL 2.1 and higher"
          )
  
      if not queue.device.il_version:
          pytest.skip("SPIR-V program creation not supported by device")
  
      n = 50000
  
      a_dev = cl.clrandom.rand(queue, n, np.float32)
      b_dev = cl.clrandom.rand(queue, n, np.float32)
      dest_dev = cl_array.empty_like(a_dev)
  
      from os.path import dirname, join
  
      spv_filename = join(
          dirname(__file__),
          "add-vectors-%d.spv" % queue.device.address_bits,
      )
  
      with open(spv_filename, "rb") as spv_file:
          spv = spv_file.read()
  
      prg = cl.Program(ctx, spv).build()
      if (
          not prg.all_kernels()
          and queue.device.platform.name.startswith("AMD Accelerated")
      ):
          pytest.skip(
              "SPIR-V program creation on AMD did not result in any kernels"
          )
  
      prg.sum(
          queue,
          a_dev.shape,
          None,
          a_dev.data,
          b_dev.data,
          dest_dev.data,
      )
  
      assert la.norm((dest_dev - (a_dev + b_dev)).get()) < 1e-7
  
imports: import numpy
  import numpy.linalg
  import pytest
  import pyopencl
  import pyopencl.array
  import pyopencl.cltypes
  import pyopencl.clrandom
  from pyopencl.tools import pytest_generate_tests_for_pyopencl, ImmediateAllocator, DeferredAllocator
  from pyopencl.characterize import get_pocl_version
label_desc: Use image node_id 31 for calling a global function with example usage: test_spirv(ctx_factory) without return types