From 624083bcc13e46a9f06138547ba846faa7b6d5e5 Mon Sep 17 00:00:00 2001
From: Matt Wala <wala1@illinois.edu>
Date: Sun, 18 Nov 2018 19:35:33 -0600
Subject: [PATCH] Make warnings more informative

---
 loopy/kernel/array.py    | 5 +++--
 loopy/kernel/creation.py | 2 +-
 loopy/kernel/data.py     | 5 +++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/loopy/kernel/array.py b/loopy/kernel/array.py
index 6bf733a84..7130e815c 100644
--- a/loopy/kernel/array.py
+++ b/loopy/kernel/array.py
@@ -693,8 +693,9 @@ class ArrayBase(ImmutableRecord):
 
         if dtype is lp.auto:
             from warnings import warn
-            warn("Argument/temporary data type should be None if unspecified, "
-                    "not auto. This usage will be disallowed in 2018.",
+            warn("Argument/temporary data type for '%s' should be None if "
+                    "unspecified, not auto. This usage will be disallowed in 2018."
+                    % name,
                     DeprecationWarning, stacklevel=2)
 
             dtype = None
diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py
index 3ae293667..92ce79bb5 100644
--- a/loopy/kernel/creation.py
+++ b/loopy/kernel/creation.py
@@ -454,7 +454,6 @@ def parse_insn(groups, insn_options):
         and *inames_to_dup* is None or a list of tuples `(old, new)`.
     """
 
-    import loopy as lp
     from loopy.symbolic import parse
 
     if "lhs" in groups:
@@ -1145,6 +1144,7 @@ class ArgumentGuesser:
             # It's not a temp var, and thereby not a domain parameter--the only
             # other writable type of variable is an argument.
 
+            import loopy as lp
             return ArrayArg(arg_name,
                     shape=lp.auto,
                     offset=self.default_offset,
diff --git a/loopy/kernel/data.py b/loopy/kernel/data.py
index 3e776bd06..ddc4dd79b 100644
--- a/loopy/kernel/data.py
+++ b/loopy/kernel/data.py
@@ -330,8 +330,9 @@ class KernelArgument(ImmutableRecord):
 
         import loopy as lp
         if dtype is lp.auto:
-            warn("Argument/temporary data type should be None if unspecified, "
-                    "not auto. This usage will be disallowed in 2018.",
+            warn("Argument/temporary data type for '%s' should be None if "
+                   "unspecified, not auto. This usage will be disallowed in 2018."
+                    % kwargs["name"],
                     DeprecationWarning, stacklevel=2)
 
             dtype = None
-- 
GitLab