Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions devito/passes/clusters/buffering.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,12 @@
accesses = chain(*[c.scope[v.f] for c in v.clusters])
index_mapper = {i: mds[(v.xd, i)] for i in v.indices}
for a in accesses:
subs[a.access] = b.indexed[[index_mapper.get(i, i) for i in a]]
indices = [index_mapper.get(i, i) for i in a]
try:
indices = b._buffer_indices(indices)
except AttributeError:
pass

Check failure on line 183 in devito/passes/clusters/buffering.py

View workflow job for this annotation

GitHub Actions / Lint the codebase

ruff (suppressible-exception)

devito/passes/clusters/buffering.py:180:17: suppressible-exception: Use `contextlib.suppress(AttributeError)` instead of `try`-`except`-`pass` help: Replace `try`-`except`-`pass` with `with contextlib.suppress(AttributeError): ...`
subs[a.access] = b.indexed[indices]

processed = []
for c in clusters:
Expand Down Expand Up @@ -431,7 +436,7 @@
buffer, = buffers
xd = buffer.indices[dim]
# The new buffer is derived from `buffer`, so it inherits its padding policy
extra_kwargs = {'is_autopaddable': buffer.is_autopaddable}
extra_kwargs = {'is_autopaddable': buffer.is_autopaddable, 'buffer': buffer}
else:
size = infer_buffer_size(f, dim, clusters)

Expand Down Expand Up @@ -459,6 +464,7 @@
dimensions[dimensions.index(dim)] = xd

# Finally create the actual buffer
## Better refactor: stash callback on original `f`

Check failure on line 467 in devito/passes/clusters/buffering.py

View workflow job for this annotation

GitHub Actions / Lint the codebase

ruff (multiple-leading-hashes-for-block-comment)

devito/passes/clusters/buffering.py:467:9: multiple-leading-hashes-for-block-comment: Too many leading `#` before block comment help: Remove leading `#`
cls = callback or Array
name = sregistry.make_name(prefix=f'{f.name}b')
mapper[f] = cls(name=name, dimensions=dimensions, dtype=f.dtype,
Expand Down
Loading