diff --git a/doc/tutorial.rst b/doc/tutorial.rst index af8c8281cf7f5b7bbf0f00a0841a15c5f05f14dd..3f2cbf5bf2fc9157e40718595cb0e95fed5fbb9a 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -25,7 +25,7 @@ import a few modules and set up a :class:`pyopencl.Context` and a >>> import loopy as lp >>> lp.set_caching_enabled(False) - >>> from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 + >>> from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 >>> from warnings import filterwarnings, catch_warnings >>> filterwarnings('error', category=lp.LoopyWarning) diff --git a/examples/python/hello-loopy.py b/examples/python/hello-loopy.py index 6fa9b5fd30b350a07e2d1d27fa36c930c9afb892..9098c544490035dd19b960422d1abbb7a5210b68 100644 --- a/examples/python/hello-loopy.py +++ b/examples/python/hello-loopy.py @@ -2,7 +2,7 @@ import numpy as np import loopy as lp import pyopencl as cl import pyopencl.array -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # setup # ----- diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index bd21a5f39cc6e761be582dba2fc3ad047b9260ea..583f7e7bf2b211e07aa29064ca9928c92f95f3c5 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -1925,7 +1925,7 @@ def make_kernel(domains, instructions, kernel_data=["..."], **kwargs): To set the kernel version for all :mod:`loopy` kernels in a (Python) source file, you may simply say:: - from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 + from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 If *lang_version* is not explicitly given, that version value will be used. @@ -2030,6 +2030,8 @@ def make_kernel(domains, instructions, kernel_data=["..."], **kwargs): if lang_version >= (2018, 1): options = options.copy(enforce_variable_access_ordered=True) + if lang_version >= (2018, 2): + options = options.copy(ignore_boostable_into=True) if isinstance(silenced_warnings, str): silenced_warnings = silenced_warnings.split(";") diff --git a/loopy/statistics.py b/loopy/statistics.py index 5e929b61830ef3dc286728ee63a659a0b16d19c3..7e74ab0a101a96b936b5ac8c0dcd8786e4df4be4 100755 --- a/loopy/statistics.py +++ b/loopy/statistics.py @@ -1286,6 +1286,10 @@ def get_op_map(knl, numpy_types=True, count_redundant_work=False, """ + if not knl.options.ignore_boostable_into: + raise LoopyError("Kernel '%s': Using operation counting requires the option " + "ignore_boostable_into to be set." % knl.name) + from loopy.preprocess import preprocess_kernel, infer_unknown_types from loopy.kernel.instruction import ( CallInstruction, CInstruction, Assignment, @@ -1424,6 +1428,10 @@ def get_mem_access_map(knl, numpy_types=True, count_redundant_work=False, """ from loopy.preprocess import preprocess_kernel, infer_unknown_types + if not knl.options.ignore_boostable_into: + raise LoopyError("Kernel '%s': Using operation counting requires the option " + "ignore_boostable_into to be set." % knl.name) + if not isinstance(subgroup_size, int): # try to find subgroup_size subgroup_size_guess = _find_subgroup_size_for_knl(knl) @@ -1615,6 +1623,10 @@ def get_synchronization_map(knl, subgroup_size=None): """ + if not knl.options.ignore_boostable_into: + raise LoopyError("Kernel '%s': Using operation counting requires the option " + "ignore_boostable_into to be set." % knl.name) + from loopy.preprocess import preprocess_kernel, infer_unknown_types from loopy.schedule import (EnterLoop, LeaveLoop, Barrier, CallKernel, ReturnFromKernel, RunInstruction) diff --git a/loopy/transform/iname.py b/loopy/transform/iname.py index 2347cef3c04d2a44cef91782700e097a20e19712..743aba5b71f6b7ed59152030a686f6604063f3fe 100644 --- a/loopy/transform/iname.py +++ b/loopy/transform/iname.py @@ -956,25 +956,35 @@ def get_iname_duplication_options(knl, use_boostable_into=False): Use :func:`has_schedulable_iname_nesting` to decide whether an iname needs to be duplicated in a given kernel. """ + from loopy.kernel.data import ConcurrentTag + + concurrent_inames = set( + iname + for iname in knl.all_inames() + if isinstance(knl.iname_to_tag.get(iname), ConcurrentTag)) + # First we extract the minimal necessary information from the kernel if use_boostable_into: insn_iname_sets = ( - frozenset(insn.within_inames.union( - insn.boostable_into if insn.boostable_into is not None - else frozenset([])) + frozenset( + (insn.within_inames + | insn.boostable_into if insn.boostable_into is not None + else frozenset([])) + - concurrent_inames for insn in knl.instructions) - frozenset([frozenset([])])) else: insn_iname_sets = ( - frozenset(insn.within_inames for insn in knl.instructions) + frozenset( + insn.within_inames - concurrent_inames + for insn in knl.instructions) - frozenset([frozenset([])])) # Get the duplication options as a tuple of iname and a set for iname, insns in _get_iname_duplication_options(insn_iname_sets): # Check whether this iname has a parallel tag and discard it if so - from loopy.kernel.data import ConcurrentTag if (iname in knl.iname_to_tag and isinstance(knl.iname_to_tag[iname], ConcurrentTag)): continue diff --git a/loopy/version.py b/loopy/version.py index 2f29e806edd571fc2fc59f603337eefdfc1b2dd4..2f5006be32999362b87e0a17ec90337137463262 100644 --- a/loopy/version.py +++ b/loopy/version.py @@ -56,12 +56,14 @@ DATA_MODEL_VERSION = "%s-islpy%s-%s-v0" % (VERSION_TEXT, _islpy_version, _git_re FALLBACK_LANGUAGE_VERSION = (2017, 2, 1) -MOST_RECENT_LANGUAGE_VERSION = (2018, 1) +MOST_RECENT_LANGUAGE_VERSION = (2018, 2) +LOOPY_USE_LANGUAGE_VERSION_2018_2 = (2018, 2) LOOPY_USE_LANGUAGE_VERSION_2018_1 = (2018, 1) LOOPY_USE_LANGUAGE_VERSION_2017_2_1 = (2017, 2, 1) LANGUAGE_VERSION_SYMBOLS = [ + "LOOPY_USE_LANGUAGE_VERSION_2018_2", "LOOPY_USE_LANGUAGE_VERSION_2018_1", "LOOPY_USE_LANGUAGE_VERSION_2017_2_1", ] @@ -95,7 +97,7 @@ will (indefinitely) default to language version 2017.2.1. If passing a language version to :func:`make_kernel` is impractical, you may also import one of the ``LOOPY_USE_LANGUAGE_VERSION_...`` symbols given below using:: - from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 + from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 in the global namespace of the function calling :func:`make_kernel`. If *lang_version* in that call is not explicitly given, this value will be used. @@ -116,6 +118,10 @@ will work hard to avoid backward-incompatible language changes.) History of Language Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. data:: LOOPY_USE_LANGUAGE_VERSION_2018_2 + + :attr:`loopy.Options.ignore_boostable_into` is turned on by default. + .. data:: LOOPY_USE_LANGUAGE_VERSION_2018_1 :attr:`loopy.Options.enforce_variable_access_ordered` diff --git a/test/test_apps.py b/test/test_apps.py index 279ea4d4a9fdd2198872278cae730d9ef9b92548..ee3d4ff442aef8f65f9589d673473b39a4ced1f7 100644 --- a/test/test_apps.py +++ b/test/test_apps.py @@ -49,7 +49,7 @@ __all__ = [ ] -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa: F401 +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa: F401 # {{{ convolutions diff --git a/test/test_c_execution.py b/test/test_c_execution.py index 01a2cb94f1434fd838c582a20be72ae88bfdf371..c355893e4c08f405c6a09cca43849489c145bc4d 100644 --- a/test/test_c_execution.py +++ b/test/test_c_execution.py @@ -40,7 +40,7 @@ else: faulthandler.enable() -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_c_target(): diff --git a/test/test_dg.py b/test/test_dg.py index c8623f78d3ae6220c0e06eb240a4a527b9c48d34..8de742f27b40f4fd1c79abf001598cd1191d9a9d 100644 --- a/test/test_dg.py +++ b/test/test_dg.py @@ -34,7 +34,7 @@ from pyopencl.tools import ( # noqa pytest_generate_tests_for_pyopencl as pytest_generate_tests) -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_dg_volume(ctx_factory): diff --git a/test/test_diff.py b/test/test_diff.py index 054d81f52f4931d8d401667a3eab3e963ce1c458..b735ab17a716c84bfa52df7f73476b4c575cda0f 100644 --- a/test/test_diff.py +++ b/test/test_diff.py @@ -48,7 +48,7 @@ __all__ = [ ] -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_diff(ctx_factory): diff --git a/test/test_domain.py b/test/test_domain.py index 20614d510134e2938624a367148d0fe8ade93b1e..ebfde850907d68bebf06076fbf1c87d8bb093f71 100644 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -52,7 +52,7 @@ __all__ = [ ] -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_assume(ctx_factory): diff --git a/test/test_linalg.py b/test/test_linalg.py index 7db6c390f074fc6940f1b6a121cdd3d75bd3002d..093fcbf243a66c05070828e5f5c9b7409f610560 100644 --- a/test/test_linalg.py +++ b/test/test_linalg.py @@ -62,7 +62,7 @@ def check_float4(result, ref_result): ref_result[comp], result[comp], rtol=1e-3, atol=1e-3), None -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_axpy(ctx_factory): diff --git a/test/test_loopy.py b/test/test_loopy.py index ef1f491d2a5e4d3fb724a69bd9c833adb6f74dcb..7a6b8c8a6b21bc30f5f0146b2c8b2cb78c57f5b4 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -52,7 +52,7 @@ __all__ = [ ] -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_globals_decl_once_with_multi_subprogram(ctx_factory): diff --git a/test/test_misc.py b/test/test_misc.py index c67c664055eae5a50f3487227c46331d6b4708a9..05df0317a6a39823dc8ac0c6a51d992336bb81d1 100644 --- a/test/test_misc.py +++ b/test/test_misc.py @@ -32,7 +32,7 @@ import logging logger = logging.getLogger(__name__) -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_compute_sccs(): diff --git a/test/test_nbody.py b/test/test_nbody.py index d1a708f723794eacd4807e159cfe23b59cacaa59..5b36ed4163c650317d8656883eeda599a3c21faa 100644 --- a/test/test_nbody.py +++ b/test/test_nbody.py @@ -34,7 +34,7 @@ import logging logger = logging.getLogger(__name__) -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_nbody(ctx_factory): diff --git a/test/test_numa_diff.py b/test/test_numa_diff.py index 7479b849b3149b0b7095f1328ad5576d6f39fbde..be07b6c3132af1b2d0546ef8ffcae828e8f1fec9 100644 --- a/test/test_numa_diff.py +++ b/test/test_numa_diff.py @@ -44,7 +44,7 @@ __all__ = [ ] -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa @pytest.mark.parametrize("Nq", [7]) diff --git a/test/test_reduction.py b/test/test_reduction.py index 866ae9f588cb149312307e771fffc9010ea1ead8..81de627d8da82148c722719ed21561d544984409 100644 --- a/test/test_reduction.py +++ b/test/test_reduction.py @@ -49,7 +49,7 @@ __all__ = [ ] -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_nonsense_reduction(ctx_factory): diff --git a/test/test_scan.py b/test/test_scan.py index c45afd0d6ecad2ddf0d07a358ad2a55620f9d1d0..505967523af6865e6f83d14d21ae2d7388a680d3 100644 --- a/test/test_scan.py +++ b/test/test_scan.py @@ -56,7 +56,7 @@ __all__ = [ # - scan(a) + scan(b) # - test for badly tagged inames -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa @pytest.mark.parametrize("n", [1, 2, 3, 16]) diff --git a/test/test_sem_reagan.py b/test/test_sem_reagan.py index 450ddeba9bafe3c522a75df6d766a041ec6dd956..e724a65dfb6d370996e7457dcfc3a2d361bbc12e 100644 --- a/test/test_sem_reagan.py +++ b/test/test_sem_reagan.py @@ -31,7 +31,7 @@ from pyopencl.tools import ( # noqa pytest_generate_tests_for_pyopencl as pytest_generate_tests) -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_tim2d(ctx_factory): diff --git a/test/test_statistics.py b/test/test_statistics.py index e42c43f60179321114fb695978cc1c91f182e8ee..51319bdcf6e9a61850298608b0e373632870940b 100644 --- a/test/test_statistics.py +++ b/test/test_statistics.py @@ -36,7 +36,7 @@ from loopy.statistics import CountGranularity as CG from pymbolic.primitives import Variable -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_op_counter_basic(): diff --git a/test/test_target.py b/test/test_target.py index 89d72c0ac53d69a0b925f9ac448875886dd0f318..eb94bdc814dde96e17bdf8524ad9671dcaf34dd9 100644 --- a/test/test_target.py +++ b/test/test_target.py @@ -52,7 +52,7 @@ __all__ = [ ] -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_ispc_target(occa_mode=False): diff --git a/test/test_transform.py b/test/test_transform.py index 2f98fe34d20bdd07a0af40ae18402aa26b1165d5..210984512f5a5e4077530d805abf19d1387c6c1a 100644 --- a/test/test_transform.py +++ b/test/test_transform.py @@ -49,7 +49,7 @@ __all__ = [ ] -from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_1 # noqa +from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa def test_chunk_iname(ctx_factory):