diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05b2e323793ee19e202f6e89425e26f5f9fb2582..a389fd5e75b34ace3f065ad908a39f1c8cef1ff2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,18 @@ jobs: curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project-within-miniconda.sh . ./build-and-test-py-project-within-miniconda.sh + pytest_no_arg_check: + name: Conda Pytest without arg check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: "Main Script" + run: | + CONDA_ENVIRONMENT=.test-conda-env-py3.yml + curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project-within-miniconda.sh + export _LOOPY_SKIP_ARG_CHECKS=1 + . ./build-and-test-py-project-within-miniconda.sh + pytest_twice: name: Conda Pytest Twice (for cache behavior) runs-on: ubuntu-latest diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f0e9aa0e593784742a9c2587c6e037f0b111d127..4886d47d90bbdf4659b1f5b3fab1b9ca90470f24 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,24 @@ Python 3 POCL: reports: junit: test/pytest.xml +Python 3 POCL without arg check: + script: + - export PY_EXE=python3 + - export PYOPENCL_TEST=portable:pthread + - export EXTRA_INSTALL="pybind11 numpy mako" + - export LOOPY_NO_CACHE=1 + - export _LOOPY_SKIP_ARG_CHECKS=1 + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh + - ". ./build-and-test-py-project.sh" + tags: + - python3 + - pocl + except: + - tags + artifacts: + reports: + junit: test/pytest.xml + Python 3 Intel: script: - export PY_EXE=python3 diff --git a/loopy/options.py b/loopy/options.py index 46ff37947b66c02e3751a815ab660d9807e86724..45eb3eb63014ad48d0b3b42045c96913bc515c2c 100644 --- a/loopy/options.py +++ b/loopy/options.py @@ -23,6 +23,7 @@ THE SOFTWARE. from pytools import ImmutableRecord import re +import os ALLOW_TERMINAL_COLORS = True @@ -210,7 +211,14 @@ class Options(ImmutableRecord): trace_assignments=kwargs.get("trace_assignments", False), trace_assignment_values=kwargs.get("trace_assignment_values", False), - skip_arg_checks=kwargs.get("skip_arg_checks", sys.flags.optimize), + skip_arg_checks=kwargs.get("skip_arg_checks", + sys.flags.optimize + # Not considered a documented env var: Only used to test + # the skip_arg_checks branch during CI, which can't use + # python -O. + # + # Considered enabled if non-empty. + or bool(os.environ.get("_LOOPY_SKIP_ARG_CHECKS"))), no_numpy=kwargs.get("no_numpy", False), cl_exec_manage_array_events=kwargs.get("no_numpy", True), return_dict=kwargs.get("return_dict", False), diff --git a/loopy/target/execution.py b/loopy/target/execution.py index 74887155b920e6d514df673c1ed8897486a4f81f..2970fe0401d25928665e85cd3866cc0051f58bc9 100644 --- a/loopy/target/execution.py +++ b/loopy/target/execution.py @@ -293,8 +293,9 @@ class ExecutionWrapperGeneratorBase: % (stride_impl_axis, impl_array_name)) gen("del _lpy_remdr") else: - gen("%s = _lpy_offset // %d" - % (arg.name, base_arg.dtype.itemsize)) + gen("%s = %s.strides[%d] // %d" + % (arg.name, impl_array_name, stride_impl_axis, + base_arg.dtype.itemsize)) gen("# }}}") gen("") diff --git a/test/test_loopy.py b/test/test_loopy.py index be595aaa5d837abcf9ff189c415e73f7393b78df..692ea1aa1e56d84a30eea514b6d25fb780b9777f 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -2825,6 +2825,9 @@ def test_shape_mismatch_check(ctx_factory): a = np.random.rand(10, 10).astype(np.float32) b = np.random.rand(10).astype(np.float32) + if prg.options.skip_arg_checks: + pytest.skip("args checks disabled, cannot check") + with pytest.raises(TypeError, match="strides mismatch"): prg(queue, a=a, b=b)