From 4305d758c4a13bc1c93748dc59c689554bb10a19 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Tue, 7 Jun 2022 19:27:18 -0500
Subject: [PATCH] Deprecate passing unevaluated arrays to compiled functions

---
 arraycontext/impl/pytato/compile.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arraycontext/impl/pytato/compile.py b/arraycontext/impl/pytato/compile.py
index 129a2c4..a8da390 100644
--- a/arraycontext/impl/pytato/compile.py
+++ b/arraycontext/impl/pytato/compile.py
@@ -468,6 +468,14 @@ def _args_to_device_buffers(actx, input_id_to_name_in_program, arg_id_to_arg):
             pass
         elif isinstance(arg, pt.Array):
             # got an array expression => evaluate it
+            from warnings import warn
+            warn(f"Argument array '{arg_id}' to a compiled function is "
+                    "unevaluated. Evaluating just-in-time, at "
+                    "considerable expense. This is deprecated and will stop "
+                    "working in 2023. To avoid this warning, force evaluation "
+                    "of all arguments via freeze/thaw.",
+                    DeprecationWarning, stacklevel=4)
+
             arg = actx.freeze(arg)
         else:
             raise NotImplementedError(type(arg))
-- 
GitLab