From d85c9ddd23653d43710354a19e5eeec610e8ea94 Mon Sep 17 00:00:00 2001 From: Fabio Luporini Date: Thu, 1 Oct 2026 16:45:44 +0100 Subject: [PATCH] compiler: Make par-tile unboundedness customisable --- devito/core/gpu.py | 3 ++- tests/test_gpu_openacc.py | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/devito/core/gpu.py b/devito/core/gpu.py index 536a06422e..e76cc9a467 100644 --- a/devito/core/gpu.py +++ b/devito/core/gpu.py @@ -41,6 +41,7 @@ class DeviceOperatorMixin: # Overrides the default values in the main Operator class BLOCK_LEVELS = 0 CIRE_BLOCK_TEMPS = False + PAR_TILE_UNBOUND = True MPI_MODES = (True, 'basic',) GPU_FIT = 'all-fallback' @@ -91,7 +92,7 @@ def _normalize_kwargs(cls, **kwargs): o['par-tile'] = ParTile(oo.pop('par-tile', False), default=(32, 4, 4), sparse=oo.pop('par-tile-sparse', None), reduce=oo.pop('par-tile-reduce', None), - unbound=True) + unbound=cls.PAR_TILE_UNBOUND) o['par-collapse-ncores'] = 1 # Always collapse (meaningful if `par-tile=False`) o['par-collapse-work'] = 1 # Always collapse (meaningful if `par-tile=False`) o['par-chunk-nonaffine'] = oo.pop('par-chunk-nonaffine', cls.PAR_CHUNK_NONAFFINE) diff --git a/tests/test_gpu_openacc.py b/tests/test_gpu_openacc.py index 2dba097684..fe43d46494 100644 --- a/tests/test_gpu_openacc.py +++ b/tests/test_gpu_openacc.py @@ -144,7 +144,11 @@ def test_multiple_tile_sizes(self, par_tile): assert trees[3][1].pragmas[0].ccode.value ==\ f'acc parallel loop {sclause} present(src,src_gp,src_wx,src_wy,src_wz,u)' - def test_short_multi_tile_keeps_outer_dim_blocked(self): + @pytest.mark.parametrize('par_tile', [ + ((32, 4), (16, 4)), + ((32, 4, 4), (16, 4)), + ]) + def test_short_multi_tile_keeps_outer_dim_blocked(self, par_tile): """ A multi `par-tile` entry shorter than the nest it lands on must not cost the outermost Dimension its BlockDimension: on a device, dropping it @@ -158,9 +162,7 @@ def test_short_multi_tile_keeps_outer_dim_blocked(self): eqns = [Eq(u.forward, u.dx), Eq(v.forward, u.forward.dx)] - # The second entry is 2D, while the nest it lands on is 3D - par_tile = ((32, 4, 4), (16, 4)) - + # OpenACC retains full blocking for short multi entries op = Operator(eqns, platform='nvidiaX', language='openacc', opt=( 'advanced',