code: def test_fine_grain_svm(ctx_factory):
      import sys
  
      is_pypy = "__pypy__" in sys.builtin_module_names
  
      ctx = ctx_factory()
      queue = cl.CommandQueue(ctx)
  
      _xfail_if_pocl_gpu(queue.device, "GPU SVM")
  
      from pyopencl.characterize import has_fine_grain_buffer_svm
      from pytest import skip
  
      if not has_fine_grain_buffer_svm(queue.device):
          skip("device does not support fine-grain SVM")
  
      n = 3000
      ary = cl.fsvm_empty(ctx, n, np.float32, alignment=64)
  
      if not is_pypy:
          # https://bitbucket.org/pypy/numpy/issues/52
          assert isinstance(ary.base, cl.SVMAllocation)
  
      ary.fill(17)
      orig_ary = ary.copy()
  
      prg = cl.Program(
          ctx,
          """
          __kernel void twice(__global float *a_g)
          {
            a_g[get_global_id(0)] *= 2;
          }
          """,
      ).build()
  
      prg.twice(queue, ary.shape, None, cl.SVM(ary))
      queue.finish()
  
      print(ary)
      assert np.array_equal(orig_ary * 2, ary)
  
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 33 for calling a global function with example usage: test_fine_grain_svm(ctx_factory) without return types