diff --git a/loopy/target/opencl.py b/loopy/target/opencl.py
index e9054470fd13b44ab1d8c41b66d70231788e1ed8..a87132cde442e452dd8f24b15e02570d3199641b 100644
--- a/loopy/target/opencl.py
+++ b/loopy/target/opencl.py
@@ -191,7 +191,8 @@ def opencl_preamble_generator(preamble_info):
     has_double = False
 
     for dtype in preamble_info.seen_dtypes:
-        if dtype in [np.float64, np.complex128]:
+        if (isinstance(dtype, NumpyType)
+                and dtype.numpy_dtype in [np.float64, np.complex128]):
             has_double = True
 
     if has_double: