Skip to content

Commit cfb6724

Browse files
committed
compiler: Add _mem_shared_dynamic
1 parent 1fe09ba commit cfb6724

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

devito/ir/iet/visitors.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,12 @@ def _gen_value(self, obj, mode=1, masked=()):
244244

245245
if (obj._mem_stack or obj._mem_constant) and mode == 1:
246246
strtype = obj._C_typedata
247-
strshape = ''.join('[%s]' % ccode(i) for i in obj.symbolic_shape)
247+
if obj._mem_shared_dynamic:
248+
strshape = '[]'
249+
strshape += ''.join('[%s]' % ccode(i)
250+
for i in obj.symbolic_shape[1:])
251+
else:
252+
strshape = ''.join('[%s]' % ccode(i) for i in obj.symbolic_shape)
248253
else:
249254
strtype = ctypes_to_cstr(obj._C_ctype)
250255
strshape = ''

devito/types/basic.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CodeSymbol:
4242
* "liveness": `_mem_external`, `_mem_internal_eager`, `_mem_internal_lazy`
4343
* "space": `_mem_local`, `_mem_mapped`, `_mem_host`
4444
* "scope": `_mem_stack`, `_mem_heap`, `_mem_global`, `_mem_shared`,
45-
`_mem_constant`
45+
`_mem_shared_dynamic`, `_mem_constant`
4646
4747
For example, an object that is `<_mem_internal_lazy, _mem_local, _mem_heap>`
4848
is allocated within the Operator entry point, on either the host or device
@@ -211,6 +211,20 @@ def _mem_shared(self):
211211
"""
212212
return False
213213

214+
@property
215+
def _mem_shared_dynamic(self):
216+
"""
217+
True if the associated data is allocated in so called shared memory,
218+
and such shared memory isn't statically available in the local memory
219+
address space, False otherwise.
220+
221+
Notes
222+
-----
223+
This property doesn't say anything about the actual allocation strategy,
224+
which therefore may be either static or dynamic.
225+
"""
226+
return False
227+
214228

215229
class Basic(CodeSymbol):
216230

0 commit comments

Comments
 (0)