From 735ec7b79dfdb8fcfa0e90e5e33a7c9c8160eb57 Mon Sep 17 00:00:00 2001 From: Kaushik Kulkarni Date: Mon, 26 Mar 2018 16:28:33 -0500 Subject: [PATCH] Minor changes --- loopy/codegen/__init__.py | 2 +- loopy/codegen/auxiliary_kernels.py | 2 +- loopy/kernel/__init__.py | 15 ++++++++------- loopy/kernel/creation.py | 2 +- loopy/library/random123.py | 1 + 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/loopy/codegen/__init__.py b/loopy/codegen/__init__.py index 57bf4c6a8..4d847612b 100644 --- a/loopy/codegen/__init__.py +++ b/loopy/codegen/__init__.py @@ -513,7 +513,7 @@ def generate_code_v2(kernel): _DataObliviousInstruction)): pass else: - raise NotImplementedError("register_knl not made for %s type of" + raise NotImplementedError("register_knl not made for %s type of " "instruciton" % (str(type(insn)))) # }}} diff --git a/loopy/codegen/auxiliary_kernels.py b/loopy/codegen/auxiliary_kernels.py index 799ab59bf..6c4166bd3 100644 --- a/loopy/codegen/auxiliary_kernels.py +++ b/loopy/codegen/auxiliary_kernels.py @@ -153,7 +153,7 @@ def generate_auxiliary_kernel_device_code(kernel, target): _DataObliviousInstruction)): pass else: - raise NotImplementedError("register_knl not made for %s type of" + raise NotImplementedError("register_knl not made for %s type of " "instruciton" % (str(type(insn)))) # }}} diff --git a/loopy/kernel/__init__.py b/loopy/kernel/__init__.py index 25737786c..b87e55ca9 100644 --- a/loopy/kernel/__init__.py +++ b/loopy/kernel/__init__.py @@ -143,7 +143,6 @@ class LoopKernel(ImmutableRecordWithoutPickling): to instances of :class:`loopy.kernel.data.IndexTag`. .. attribute:: function_manglers - .. attribute:: function_identifiers .. attribute:: symbol_manglers .. attribute:: substitutions @@ -201,7 +200,6 @@ class LoopKernel(ImmutableRecordWithoutPickling): default_function_mangler, single_arg_function_mangler, ], - function_identifiers=set(), scoped_functions={}, symbol_manglers=[], @@ -268,10 +266,6 @@ class LoopKernel(ImmutableRecordWithoutPickling): assert all(dom.get_ctx() == isl.DEFAULT_CONTEXT for dom in domains) assert assumptions.get_ctx() == isl.DEFAULT_CONTEXT - # Populating the function identifiers based on the target and the default - # function identifiers - function_identifiers = target.get_device_ast_builder().function_identifiers() - ImmutableRecordWithoutPickling.__init__(self, domains=domains, instructions=instructions, @@ -291,7 +285,6 @@ class LoopKernel(ImmutableRecordWithoutPickling): cache_manager=cache_manager, applied_iname_rewrites=applied_iname_rewrites, function_manglers=function_manglers, - function_identifiers=function_identifiers, scoped_functions=scoped_functions, symbol_manglers=symbol_manglers, index_dtype=index_dtype, @@ -350,6 +343,14 @@ class LoopKernel(ImmutableRecordWithoutPickling): # }}} + # {{{ target function identifiers + + @property + def function_identifiers(self): + return self.target.get_device_ast_builder().function_identifiers() + + # }}} + # {{{ symbol mangling def mangle_symbol(self, ast_builder, identifier): diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index b8100f3ab..b97639c91 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -1974,7 +1974,7 @@ class ScopedFunctionCollector(CombineMapper): def scope_functions(kernel): - func_ids = kernel.function_identifiers.copy() + func_ids = kernel.function_identifiers from loopy.kernel.instruction import CInstruction, _DataObliviousInstruction function_scoper = FunctionScoper(func_ids) diff --git a/loopy/library/random123.py b/loopy/library/random123.py index b28d11ba6..5cc3dd9ce 100644 --- a/loopy/library/random123.py +++ b/loopy/library/random123.py @@ -225,6 +225,7 @@ def random123_function_mangler(kernel, name, arg_dtypes): def random123_with_types(in_knl_callable, arg_id_to_dtype, target): + # FIXME: Translate the mangler to this. name = in_knl_callable.name if name not in FUNC_NAMES_TO_RNG: -- GitLab