diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index 77cfb7287153b602a5e6ddc3c2c94af6d2b13862..a1d8ece5b9858645e159b3d63b829cc04d04a21f 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -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 diff --git a/test/test_apps.py b/test/test_apps.py index aec54f661a8a12712f15e7dcf44593ef0a9f87a6..a73356671a545557e61ae9d3da0228086ade3903 100644 --- a/test/test_apps.py +++ b/test/test_apps.py @@ -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 diff --git a/test/test_dg.py b/test/test_dg.py index fafef86c35211183ebdaeb75acf2b664a36586a0..d65c68ed4c729582d511064d6495535efcf7a9a4 100644 --- a/test/test_dg.py +++ b/test/test_dg.py @@ -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