From 1e0696efb71c3e0aa83f0dacd3d50afdef7c9825 Mon Sep 17 00:00:00 2001
From: Matt Wala <wala1@illinois.edu>
Date: Sat, 15 Jul 2017 20:20:35 -0500
Subject: [PATCH] Type inference for reduction: Make sure reduction arg types
 have a target too.

---
 loopy/type_inference.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/loopy/type_inference.py b/loopy/type_inference.py
index 3fb165ead..7b3a67c6b 100644
--- a/loopy/type_inference.py
+++ b/loopy/type_inference.py
@@ -671,6 +671,11 @@ def infer_arg_and_reduction_dtypes_for_reduction_expression(
                 raise LoopyError("failed to determine type of accumulator for "
                         "reduction '%s'" % expr)
 
+    arg_dtypes = tuple(
+            dt.with_target(kernel.target)
+            if dt is not lp.auto else dt
+            for dt in arg_dtypes)
+
     reduction_dtypes = expr.operation.result_dtypes(kernel, *arg_dtypes)
     reduction_dtypes = tuple(
             dt.with_target(kernel.target)
-- 
GitLab