def wrap_temporary_decl(self, decl, scope): if scope == AddressSpace.LOCAL: from cgen.opencl import CLLocal return CLLocal(decl) elif scope == AddressSpace.PRIVATE: return decl else: raise ValueError("unexpected temporary variable scope: %s" % scope)
def get_array_arg_decl(self, name, mem_address_space, shape, dtype, is_written): from cgen.opencl import CLGlobal, CLLocal from loopy.kernel.data import AddressSpace if mem_address_space == AddressSpace.LOCAL: return CLLocal(super().get_array_arg_decl( name, mem_address_space, shape, dtype, is_written)) elif mem_address_space == AddressSpace.PRIVATE: return super().get_array_arg_decl( name, mem_address_space, shape, dtype, is_written) elif mem_address_space == AddressSpace.GLOBAL: return CLGlobal(super().get_array_arg_decl( name, mem_address_space, shape, dtype, is_written)) else: raise ValueError("unexpected array argument scope: %s" % mem_address_space)