Skip to content
Snippets Groups Projects
Commit 2999f30e authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Deprecate 'defines' in make_kernel

parent 991582f7
No related branches found
No related tags found
No related merge requests found
......@@ -1179,14 +1179,6 @@ def make_kernel(domains, instructions, kernel_data=["..."], **kwargs):
:arg preamble_generators: a list of functions of signature
(seen_dtypes, seen_functions) where seen_functions is a set of
(name, c_name, arg_dtypes), generating extra entries for *preambles*.
:arg defines: a dictionary of replacements to be made in instructions given
as strings before parsing. A macro instance intended to be replaced
should look like "MACRO" in the instruction code. The expansion given
in this parameter is allowed to be a list. In this case, instructions
are generated for *each* combination of macro values.
These defines may also be used in the domain and in argument shapes and
strides. They are expanded only upon kernel creation.
:arg default_order: "C" (default) or "F"
:arg default_offset: 0 or :class:`loopy.auto`. The default value of
*offset* in :attr:`GlobalArg` for guessed arguments.
......@@ -1220,6 +1212,12 @@ def make_kernel(domains, instructions, kernel_data=["..."], **kwargs):
flags = kwargs.pop("flags", None)
target = kwargs.pop("target", None)
if defines:
from warnings import warn
warn("'defines' argument to make_kernel is deprecated. "
"Use lp.fix_parameters instead",
DeprecationWarning, stacklevel=2)
if target is None:
from loopy import _DEFAULT_TARGET
target = _DEFAULT_TARGET
......
......@@ -74,12 +74,11 @@ def test_convolution(ctx_factory):
"..."
],
assumptions="f_w>=1 and im_w, im_h >= 2*f_w+1 and nfeats>=1 and nimgs>=0",
options="annotate_inames",
defines=dict(ncolors=3))
options="annotate_inames")
f_w = 3
knl = lp.fix_parameters(knl, f_w=f_w)
knl = lp.fix_parameters(knl, f_w=f_w, ncolors=3)
ref_knl = knl
......@@ -142,8 +141,9 @@ def test_convolution_with_nonzero_base(ctx_factory):
"..."
],
assumptions="f_w>=1 and im_w, im_h >= 2*f_w+1 and nfeats>=1 and nimgs>=0",
flags="annotate_inames",
defines=dict(ncolors=3))
options="annotate_inames")
knl = lp.fix_parameters(knl, ncolors=3)
ref_knl = knl
......
......@@ -72,8 +72,9 @@ def test_dg_volume(ctx_factory):
order=order),
lp.ValueArg("K", np.int32, approximately=1000),
],
name="dg_volume", assumptions="K>=1",
defines=dict(Np=Np))
name="dg_volume", assumptions="K>=1")
knl = lp.fix_parameters(knl, Np=Np)
seq_knl = knl
......@@ -218,9 +219,10 @@ def no_test_dg_surface(ctx_factory):
lp.GlobalArg("LIFT", dtype, shape="Np, NfpNfaces", order="C"),
lp.ValueArg("K", np.int32, approximately=1000),
],
name="dg_surface", assumptions="K>=1",
defines=dict(Np=Np, Nfp=Nfp, NfpNfaces=Nfaces*Nfp, nsurf_dofs=K*Nfp),
)
name="dg_surface", assumptions="K>=1")
knl = lp.fix_parameters(knl,
Np=Np, Nfp=Nfp, NfpNfaces=Nfaces*Nfp, nsurf_dofs=K*Nfp)
seq_knl = knl
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment