diff --git a/loopy/__init__.py b/loopy/__init__.py index 406dadc73ccacd97761a9bd8c15bdd883019ecb6..51925f9b6a59e8875f4238615589948ae4fc32a3 100644 --- a/loopy/__init__.py +++ b/loopy/__init__.py @@ -360,7 +360,7 @@ def join_inames(kernel, inames, new_iname=None, tag=None, within=None): joint_aff = joint_aff + base_divisor*iname_aff - bounds = kernel.get_iname_bounds(iname) + bounds = kernel.get_iname_bounds(iname, constants_only=True) from loopy.isl_helpers import ( static_max_of_pw_aff, static_value_of_pw_aff) diff --git a/loopy/codegen/loop.py b/loopy/codegen/loop.py index 03074ea73db47b7d91521fcc02058da8597b2cbe..8ad4a08caf226e14a3e524d6b3e29b2f0819ca5a 100644 --- a/loopy/codegen/loop.py +++ b/loopy/codegen/loop.py @@ -116,7 +116,7 @@ def get_slab_decomposition(kernel, iname, sched_index, codegen_state): def generate_unroll_loop(kernel, sched_index, codegen_state): iname = kernel.schedule[sched_index].iname - bounds = kernel.get_iname_bounds(iname) + bounds = kernel.get_iname_bounds(iname, constants_only=True) from loopy.isl_helpers import ( static_max_of_pw_aff, static_value_of_pw_aff) diff --git a/loopy/isl_helpers.py b/loopy/isl_helpers.py index a0b94cce0089ae56e06b131589968cebde8a714e..587b1be383c0dc580f4e2d9952aa5c695fec8b0a 100644 --- a/loopy/isl_helpers.py +++ b/loopy/isl_helpers.py @@ -368,10 +368,4 @@ def boxify(cache_manager, domain, box_inames, context): return convexify(result) - - - - - - # vim: foldmethod=marker diff --git a/loopy/kernel/__init__.py b/loopy/kernel/__init__.py index eed39c6d7d80b9f63c40d2105d529dacb2945b62..58d8eb33be3e9800a9fe3757e10def687c0387eb 100644 --- a/loopy/kernel/__init__.py +++ b/loopy/kernel/__init__.py @@ -716,9 +716,8 @@ class LoopKernel(Record): # {{{ bounds finding @memoize_method - def get_iname_bounds(self, iname): + def get_iname_bounds(self, iname, constants_only=False): domain = self.get_inames_domain(frozenset([iname])) - d_var_dict = domain.get_var_dict() assumptions = self.assumptions.project_out_except( set(domain.get_var_dict(dim_type.param)), [dim_type.param]) @@ -727,15 +726,20 @@ class LoopKernel(Record): dom_intersect_assumptions = aligned_assumptions & domain + if constants_only: + # Kill all variable dependencies + dom_intersect_assumptions = dom_intersect_assumptions.project_out_except( + [iname], [dim_type.param, dim_type.set]) + + iname_idx = dom_intersect_assumptions.get_var_dict()[iname][1] + lower_bound_pw_aff = ( self.cache_manager.dim_min( - dom_intersect_assumptions, - d_var_dict[iname][1]) + dom_intersect_assumptions, iname_idx) .coalesce()) upper_bound_pw_aff = ( self.cache_manager.dim_max( - dom_intersect_assumptions, - d_var_dict[iname][1]) + dom_intersect_assumptions, iname_idx) .coalesce()) class BoundsRecord(Record): @@ -754,7 +758,7 @@ class LoopKernel(Record): from loopy.isl_helpers import static_max_of_pw_aff from loopy.symbolic import aff_to_expr return int(aff_to_expr(static_max_of_pw_aff( - self.get_iname_bounds(iname).size, + self.get_iname_bounds(iname, constants_only=True).size, constants_only=True))) @memoize_method diff --git a/loopy/preprocess.py b/loopy/preprocess.py index 88efa0fbb54d36d1a00718ce1a97bc88516895ad..ec1e750d36bcda766b9a5f0810dd88a3d359e168 100644 --- a/loopy/preprocess.py +++ b/loopy/preprocess.py @@ -567,7 +567,7 @@ def duplicate_private_temporaries_for_ilp(kernel): if iname in ilp_iname_to_length: continue - bounds = kernel.get_iname_bounds(iname) + bounds = kernel.get_iname_bounds(iname, constants_only=True) ilp_iname_to_length[iname] = int(pw_aff_to_expr( static_max_of_pw_aff(bounds.size, constants_only=True)))