class_docstr: Generates and executes code that performs prefix sums ("scans") on
  arbitrary types, with many possible tweaks.
  
  Usage example::
  
      from pyopencl.scan import GenericScanKernel
      knl = GenericScanKernel(
              context, np.int32,
              arguments="__global int *ary",
              input_expr="ary[i]",
              scan_expr="a+b", neutral="0",
              output_statement="ary[i+1] = item;")
  
      a = cl.array.arange(queue, 10000, dtype=np.int32)
      knl(a, queue=queue)
  
  .. automethod:: __init__
  .. automethod:: __call__
class_docstr_tok: ["Generates","and","executes","code","that","performs","prefix","sums","(","``","scans","''",")","on","arbitrary","types",",","with","many","possible","tweaks",".","Usage","example",":",":","from","pyopencl.scan","import","GenericScanKernel","knl","=","GenericScanKernel","(","context",",","np.int32",",","arguments=","''","__global","int","*","ary","''",",","input_expr=","''","ary","[","i","]","''",",","scan_expr=","''","a+b","''",",","neutral=","''","0","''",",","output_statement=","''","ary","[","i+1","]","=","item",";","''",")","a","=","cl.array.arange","(","queue",",","10000",",","dtype=np.int32",")","knl","(","a",",","queue=queue",")","..","automethod",":",":","__init__","..","automethod",":",":","__call__"]
code: def get_local_mem_use(
      self,
      k_group_size: int,
      wg_size: int,
      use_bank_conflict_avoidance: bool,
  ) -> int:
      arg_dtypes = {}
      for arg in self.parsed_args:
          arg_dtypes[arg.name] = arg.dtype
  
      fetch_expr_offsets: Dict[str, Set] = {}
      for _name, arg_name, ife_offset in self.input_fetch_exprs:
          fetch_expr_offsets.setdefault(arg_name, set()).add(ife_offset)
  
      itemsize = self.dtype.itemsize
      if use_bank_conflict_avoidance:
          itemsize += 4
  
      return (
          # ldata
          itemsize * (k_group_size + 1) * (wg_size + 1)
          # l_segment_start_flags
          + k_group_size * wg_size
          # l_first_segment_start_in_subtree
          + self.index_dtype.itemsize * wg_size
          + k_group_size
          * wg_size
          * sum(
              arg_dtypes[arg_name].itemsize
              for arg_name, ife_offsets in list(
                  fetch_expr_offsets.items()
              )
              if -1 in ife_offsets or len(ife_offsets) > 1
          )
      )
  
imports: from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Set, Tuple, Union
  import numpy
  import pyopencl
  import pyopencl.array
  from pyopencl.tools import KernelTemplateBase, DtypedArgument, bitlog2, context_dependent_memoize, dtype_to_ctype, get_arg_list_scalar_arg_dtypes, get_arg_offset_adjuster_code, _process_code_for_macro, _NumpyTypesKeyBuilder
  import pyopencl._mymako
  from pyopencl._cluda import CLUDA_PREAMBLE
  from pytools.persistent_dict import WriteOncePersistentDict
  import logging
label_desc: Use image node_id 3 for calling the GenericScanKernel obj's underlying member method code with example usage: obj.get_local_mem_use(k_group_size, wg_size, use_bank_conflict_avoidance) and returns: unknown