|
43 | 43 | ArrayOrContainerOrScalar,
|
44 | 44 | ArrayOrContainerOrScalarT,
|
45 | 45 | NumpyOrContainerOrScalar,
|
| 46 | + UntransformedCodeWarning, |
46 | 47 | )
|
47 | 48 |
|
48 | 49 |
|
@@ -116,9 +117,21 @@ def _thaw(ary):
|
116 | 117 | # }}}
|
117 | 118 |
|
118 | 119 | def transform_loopy_program(self, t_unit):
|
119 |
| - raise ValueError("NumpyArrayContext does not implement " |
120 |
| - "transform_loopy_program. Sub-classes are supposed " |
121 |
| - "to implement it.") |
| 120 | + from warnings import warn |
| 121 | + warn("Using the base " |
| 122 | + f"{type(self).__name__}.transform_loopy_program " |
| 123 | + "to transform a translation unit. " |
| 124 | + "This is a no-op and will result in unoptimized C code for" |
| 125 | + "the requested optimization, all in a single statement." |
| 126 | + "This will work, but is unlikely to be performant." |
| 127 | + f"Instead, subclass {type(self).__name__} and implement " |
| 128 | + "the specific transform logic required to transform the program " |
| 129 | + "for your package or application. Check higher-level packages " |
| 130 | + "(e.g. meshmode), which may already have subclasses you may want " |
| 131 | + "to build on.", |
| 132 | + UntransformedCodeWarning, stacklevel=2) |
| 133 | + |
| 134 | + return t_unit |
122 | 135 |
|
123 | 136 | def tag(self,
|
124 | 137 | tags: ToTagSetConvertible,
|
|
0 commit comments