Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Substitution of DataSymbols is buggy when multiple symbols with the same name are present #2511

Open
EdCaunt opened this issue Jan 7, 2025 · 0 comments

Comments

@EdCaunt
Copy link
Contributor

EdCaunt commented Jan 7, 2025

MFE:

from devito.types.basic import DataSymbol
s0 = DataSymbol(name='s')
s1 = DataSymbol(name='s')

s2 = s0._rebuild(name='s2')
s3 = s1._rebuild(name='s3')

# Causes s1 to be incorrectly substituted
# mapper = {s0: s2, s1: s3}
# Causes s0 to be incorrectly substituted
mapper = {s1: s3, s0: s2}

print(s0.subs(mapper))
print(mapper[s0])

print(s1.subs(mapper))
print(mapper[s1])

Returns

s3
s2
s3
s3

rather than

s2
s2
s3
s3

This line is a potential culprit for this behaviour. #2510 features a workaround in the context of concretisation.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant