From 89deff324639aab9cd28d6f47c29259d02e3a036 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 24 Sep 2012 18:05:02 -0400
Subject: [PATCH] In CSE: Only inherit restrictions unrelated to storage from
 global s2s map.

---
 MEMO         | 10 +++++-----
 loopy/cse.py | 11 +++++------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/MEMO b/MEMO
index 23d230940..3087e53bb 100644
--- a/MEMO
+++ b/MEMO
@@ -16,9 +16,6 @@ Things to consider
 - Every loop in loopy is opened at most once.
   Too restrictive?
 
-- Loop bounds currently may not depend on parallel dimensions
-  Does it make sense to relax this?
-
 - Why do CSEs necessarily have to duplicate the inames?
   -> because that would be necessary for a sequential prefetch
 
@@ -49,8 +46,6 @@ To-do
 
 - Fix timer / call code
 
-- make sure simple side effects in global work
-
 - Fuse: store/fetch elimination?
 
 Fixes:
@@ -115,6 +110,11 @@ Future ideas
 Dealt with
 ^^^^^^^^^^
 
+- make sure simple side effects work
+
+- Loop bounds currently may not depend on parallel dimensions
+  Does it make sense to relax this?
+
 - Streamline argument specification
 
 - syntax for linear array access
diff --git a/loopy/cse.py b/loopy/cse.py
index 71b7b3c46..bd5ca733a 100644
--- a/loopy/cse.py
+++ b/loopy/cse.py
@@ -197,13 +197,12 @@ def build_global_storage_to_sweep_map(kernel, invocation_descriptors,
             s2s_domain, aligned_g_s2s_parm_dom = isl.align_two(
                     s2s_domain, global_s2s_par_dom)
 
-            s2s_domain = s2s_domain.project_out_except(
-                    arg_inames, [dim_type.param])
-            aligned_g_s2s_parm_dom = aligned_g_s2s_parm_dom.project_out_except(
-                    arg_inames, [dim_type.param])
+            arg_restrictions = (
+                    aligned_g_s2s_parm_dom
+                    .eliminate(dim_type.set, 0, aligned_g_s2s_parm_dom.dim(dim_type.set))
+                    .remove_divs())
 
-            is_in_footprint = ((s2s_domain & aligned_g_s2s_parm_dom)
-                    .is_subset(aligned_g_s2s_parm_dom))
+            is_in_footprint = (arg_restrictions & s2s_domain).is_subset(aligned_g_s2s_parm_dom)
 
             invdesc.is_in_footprint = is_in_footprint
 
-- 
GitLab