From c9cacd0bfb326e39a7e755cb91dd1f9722cda87e Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Tue, 18 Jun 2013 18:34:41 -0400
Subject: [PATCH] Provide an intelligible error for auto_test with deferred
 types

---
 loopy/auto_test.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/loopy/auto_test.py b/loopy/auto_test.py
index efc1fa3bb..690e2bec2 100644
--- a/loopy/auto_test.py
+++ b/loopy/auto_test.py
@@ -324,6 +324,15 @@ def _enumerate_cl_devices_for_ref_test():
 
 # {{{ main automatic testing entrypoint
 
+def _complain_about_deferred_types(knl):
+    print "COMPL"
+    for arg in knl.args:
+        if arg.dtype is None:
+            raise RuntimeError("Automatic testing requires that all "
+                    "argument types are known.  Argument '%s' has "
+                    "an unknown/deferred type." % arg.name)
+
+
 def auto_test_vs_ref(
         ref_knl, ctx, test_knl, op_count=[], op_label=[], parameters={},
         print_ref_code=False, print_code=True, warmup_rounds=2,
@@ -375,6 +384,8 @@ def auto_test_vs_ref(
 
     # {{{ compile and run reference code
 
+    _complain_about_deferred_types(ref_knl)
+
     found_ref_device = False
 
     ref_errors = []
@@ -475,6 +486,7 @@ def auto_test_vs_ref(
             test_kernels = [test_knl]
 
     for i, kernel in enumerate(test_kernels):
+        _complain_about_deferred_types(kernel)
         compiled = CompiledKernel(ctx, kernel, options=options,
                 codegen_kwargs=codegen_kwargs)
 
-- 
GitLab