1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
|
Description: Fix errors from bad git update
Author: Alastair McKinstry <mckinstry@debian.org>
Last-Updated: 2025-10-15
Bug-Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1117981
Forwarded: not-needed
--- a/loki/transformations/array_indexing/tests/test_vector_notation.py
+++ b/loki/transformations/array_indexing/tests/test_vector_notation.py
@@ -52,15 +52,6 @@
assert len(loops) == 4
assert loops[0].variable == 'i_ret1_1'
-<<<<<<< HEAD
- assert loops[0].bounds.children == (1, 'param1', 1) if frontend != OMNI else (1, 3, 1)
- assert loops[1].variable == 'i_ret1_0'
- assert loops[1].bounds.children == (1, 'param1', 1) if frontend != OMNI else (1, 3, 1)
- assert loops[2].variable == 'i_ret2_1'
- assert loops[2].bounds.children == (1, 'param2', 1) if frontend != OMNI else (1, 5, 1)
- assert loops[3].variable == 'i_ret2_0'
- assert loops[3].bounds.children == (1, 'param1', 1) if frontend != OMNI else (1, 3, 1)
-=======
assert loops[0].bounds == '1:param1' if frontend != OMNI else '1:3:1'
assert loops[1].variable == 'i_ret1_0'
assert loops[1].bounds == '1:param1' if frontend != OMNI else '1:3:1'
@@ -68,7 +59,6 @@
assert loops[2].bounds == '1:param2' if frontend != OMNI else '1:5:1'
assert loops[3].variable == 'i_ret2_0'
assert loops[3].bounds == '1:param1' if frontend != OMNI else '1:3:1'
->>>>>>> upstream/0.3.4
assert len(arrays) == 2
assert arrays[0].dimensions == ('i_ret1_0', 'i_ret1_1')
@@ -162,38 +152,6 @@
loops = FindNodes(ir.Loop).visit(routine.body)
arrays = [var for var in FindVariables(unique=False).visit(routine.body) if isinstance(var, sym.Array)]
assert len(loops) == 21
-<<<<<<< HEAD
- assert loops[0].variable == 'i_tmp_dummy_1' and loops[0].bounds.children == (0, 4, None)
- assert loops[1].variable == 'jl' and loops[1].bounds.children == (1, 'n', 1)
- assert loops[2].variable == 'jl' and loops[2].bounds.children == (1, 'n', 1)
- assert loops[3].variable == 'jm' and loops[3].bounds.children == (1, 'm', 1)
- assert loops[4].variable == 'jl' and loops[4].bounds.children == (1, 'n', 1)
- assert loops[5].variable == 'jl' and loops[5].bounds.children == (1, 'n', 1)
- assert loops[6].variable == 'jm' and loops[6].bounds.children == (1, 'm', 1)
- assert loops[7].variable == 'jk' and loops[7].bounds.children == (1, 'l', 1)
- assert loops[8].variable == 'jl' and loops[8].bounds.children == (1, 'n', 1)
- assert loops[9].variable == 'jk' and loops[9].bounds.children == (1, 'l', 1)
- assert loops[10].variable == 'jl'
- if kidia_loop:
- assert loops[10].bounds.children == ('kidia', 'kfdia', None)
- else:
- assert loops[10].bounds.children == (1, 'n', None)
- assert loops[11].variable == 'jm' and loops[11].bounds.children == (1, 'm', None)
- assert loops[12].variable == 'jm' and loops[12].bounds.children == (1, 'm', None)
- assert loops[13].variable == 'jl' and loops[13].bounds.children == (1, 'n', None)
- assert loops[14].variable == 'jk' and loops[14].bounds.children == (1, 'l', None)
- assert loops[15].variable == 'jk' and loops[15].bounds.children == (1, 'l', None)
- assert loops[16].variable == 'jl' and loops[16].bounds.children == (1, 'n', 1)
- assert loops[17].variable == 'jm' and loops[17].bounds.children == (1, 'm', None)
- assert loops[18].variable == 'jl' and loops[18].bounds.children == (1, 'n', None)
- assert loops[19].variable == 'jl' and loops[19].bounds.children == (1, 'n', 1)
- if kidia_loop:
- assert loops[20].variable == 'jl'
- assert loops[20].bounds.children == ('kidia', 'kfdia', None)
- else:
- assert loops[20].variable == 'i_vector_2_0'
- assert loops[20].bounds.children == ('kidia', 'kfdia', None)
-=======
assert loops[0].variable == 'i_tmp_dummy_1' and loops[0].bounds == '0:4'
assert loops[1].variable == 'jl' and loops[1].bounds == '1:n'
assert loops[2].variable == 'jl' and loops[2].bounds == '1:n'
@@ -224,7 +182,6 @@
else:
assert loops[20].variable == 'i_vector_2_0'
assert loops[20].bounds == 'kidia:kfdia'
->>>>>>> upstream/0.3.4
assert len(arrays) == 17
assert arrays[0].name.lower() == 'tmp_dummy' and arrays[0].dimensions == ('jl', 'i_tmp_dummy_1')
@@ -359,8 +316,6 @@
assert (b_test == b_ref).all()
builder.clean()
-<<<<<<< HEAD
-=======
@pytest.mark.parametrize('frontend', available_frontends())
@@ -523,4 +478,3 @@
assert assigns[0] in loops[0].body
assert assigns[1] in loops[1].body
assert conds[0] in loops[2].body
->>>>>>> upstream/0.3.4
--- a/loki/transformations/array_indexing/vector_notation.py
+++ b/loki/transformations/array_indexing/vector_notation.py
@@ -111,63 +111,6 @@
"""
Resolve implicit vector notation by inserting explicit loops
"""
-<<<<<<< HEAD
- loop_map = {}
- index_vars = set()
- vmap = {}
- # find available loops and create map {(lower, upper, step): loop_variable}
- loops = FindNodes(Loop).visit(routine.body)
- loop_map = {(loop.bounds.lower, loop.bounds.upper, loop.bounds.step or 1):
- loop.variable for loop in loops}
- for stmt in FindNodes(Assignment).visit(routine.body):
- # Loop over all variables and replace them with loop indices
- vdims = []
- shape_index_map = {}
- index_range_map = {}
- for v in FindVariables(unique=False).visit(stmt):
- if not isinstance(v, sym.Array):
- continue
-
- # Skip if the entire array is used implicitly
- if not v.dimensions:
- continue
-
- ivar_basename = f'i_{stmt.lhs.basename}'
- for i, dim, s in zip(count(), v.dimensions, as_tuple(v.shape)):
- if isinstance(dim, sym.RangeIndex):
- # use the shape for e.g., `ARR(:)`, but use the dimension for e.g., `ARR(2:5)`
- _s = dim if dim.lower is not None else s
- # create tuple to test whether an appropriate loop is already available
- test_range = (sym.IntLiteral(1), _s, 1) if not isinstance(_s, sym.RangeIndex)\
- else (_s.lower, _s.upper, 1)
- # actually test for it
- if test_range in loop_map:
- # Use index variable of available matching loop
- ivar = loop_map[test_range]
- else:
- # Create new index variable
- vtype = SymbolAttributes(BasicType.INTEGER)
- ivar = sym.Variable(name=f'{ivar_basename}_{i}', type=vtype, scope=routine)
- shape_index_map[(i, s)] = ivar
- index_range_map[ivar] = _s
-
- if ivar not in vdims:
- vdims.append(ivar)
-
- # Add index variable to range replacement
- new_dims = as_tuple(shape_index_map.get((i, s), d)
- for i, d, s in zip(count(), v.dimensions, as_tuple(v.shape)))
- vmap[v] = v.clone(dimensions=new_dims)
-
- index_vars.update(list(vdims))
-
- # Recursively build new loop nest over all implicit dims
- if len(vdims) > 0:
- loop = None
- body = stmt
- for ivar in vdims:
- irange = index_range_map[ivar]
-=======
# Find loops and map their range to the loop index variable
loop_map = {
@@ -379,24 +322,10 @@
loop = None
body = stmt
for ivar, irange in index_range_map.items():
->>>>>>> upstream/0.3.4
if isinstance(irange, sym.RangeIndex):
bounds = sym.LoopRange(irange.children)
else:
bounds = sym.LoopRange((sym.Literal(1), irange, sym.Literal(1)))
-<<<<<<< HEAD
- loop = Loop(variable=ivar, body=as_tuple(body), bounds=bounds)
- body = loop
-
- loop_map[stmt] = loop
-
- if len(loop_map) > 0:
- routine.body = Transformer(loop_map).visit(routine.body)
- routine.variables += tuple(set(index_vars))
-
- # Apply variable substitution
- routine.body = SubstituteExpressions(vmap).visit(routine.body)
-=======
loop = ir.Loop(variable=ivar, body=as_tuple(body), bounds=bounds)
body = loop
@@ -449,4 +378,3 @@
return loop
return masked
->>>>>>> upstream/0.3.4
--- a/loki/transformations/field_api.py
+++ b/loki/transformations/field_api.py
@@ -363,46 +363,15 @@
kwarguments=kwargs)
-<<<<<<< HEAD
-def field_get_host_data(field_ptr, host_ptr, transfer_type: FieldAPITransferType, scope: Scope):
- """
- Utility function to generate a :any:`CallStatement` corresponding to a Field API
- ``GET_HOST_DATA`` call.
-=======
def field_sync_device(field_ptr, transfer_type: FieldAPITransferType, scope: Scope,
queue=None, blk_bounds=None, offset=None):
"""
Utility function to generate a :any:`CallStatement` corresponding to a Field API
``SYNC_DEVICE`` call.
->>>>>>> upstream/0.3.4
Parameters
----------
field_ptr: pointer to field object
-<<<<<<< HEAD
- Pointer to the field to call ``GET_HOST_DATA`` from.
- host_ptr: :any:`Array`
- Host pointer array
- transfer_type: :any:`FieldAPITransferType`
- Field API transfer type to determine which ``GET_HOST_DATA`` method to call.
- scope: :any:`Scope`
- Scope of the created :any:`CallStatement`
- """
- if not isinstance(transfer_type, FieldAPITransferType):
- raise TypeError(f"transfer_type must be of type FieldAPITransferType, but is of type {type(transfer_type)}")
- if transfer_type == FieldAPITransferType.READ_ONLY:
- suffix = 'RDONLY'
- elif transfer_type == FieldAPITransferType.READ_WRITE:
- suffix = 'RDWR'
- else:
- suffix = ''
- procedure_name = 'GET_HOST_DATA_' + suffix
- return ir.CallStatement(name=sym.ProcedureSymbol(procedure_name, parent=field_ptr, scope=scope),
- arguments=(host_ptr.clone(dimensions=None),), )
-
-
-def field_sync_host(field_ptr, scope):
-=======
Pointer to the field to call ``SYNC_HOST`` from.
transfer_type: :any:`FieldAPITransferType`
Field API transfer type to determine which ``SYNC_DEVICE`` method to call.
@@ -422,7 +391,6 @@
def field_sync_host(field_ptr, transfer_type: FieldAPITransferType, scope: Scope,
queue=None, blk_bounds=None, offset=None):
->>>>>>> upstream/0.3.4
"""
Utility function to generate a :any:`CallStatement` corresponding to a Field API
``SYNC_HOST`` call.
@@ -483,24 +451,6 @@
return ir.CallStatement(name=sym.ProcedureSymbol(procedure_name, parent=field_ptr, scope=scope), arguments=())
-<<<<<<< HEAD
-def field_delete_device_data(field_ptr, scope):
- """
- Utility unction to generate a :any:`CallStatement` corresponding to a Field API
- `DELETE_DEVICE_DATA` call.
-
- Parameters
- ----------
- field_ptr: pointer to field object
- Pointer to the field to call ``DELETE_DEVICE_DATA`` from.
- scope: :any:`Scope`
- Scope of the created :any:`CallStatement`
- """
-
- procedure_name = 'DELETE_DEVICE_DATA'
- return ir.CallStatement(name=sym.ProcedureSymbol(procedure_name, parent=field_ptr, scope=scope), arguments=())
-=======
def field_wait_for_async_queue(queue, scope: Scope):
return ir.CallStatement(name=sym.ProcedureSymbol('WAIT_FOR_ASYNC_QUEUE', scope=scope),
arguments=(queue,))
->>>>>>> upstream/0.3.4
|