Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add mem unexpected behaviour #162

Closed
NeuralCoder3 opened this issue Dec 9, 2022 · 2 comments
Closed

Add mem unexpected behaviour #162

NeuralCoder3 opened this issue Dec 9, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@NeuralCoder3
Copy link
Collaborator

NeuralCoder3 commented Dec 9, 2022

The add_mem phase behaves differently, depending on surrounding externals.
Even if these externals are never called and to not interfere with the functions.
Example: https://github.com/NeuralCoder3/thorin2/blob/ho_codegen/lit/mem/add_top_mem.thorin
Example2: https://github.com/NeuralCoder3/thorin2/blob/ho_codegen/lit/mem/add_top_mem2.thorin

In add_top_mem, the call remains f (⊤:%mem.M, argc_1111242, return_1111250).
In add_top_mem, the call is changed to f (_1113823, argc_1113827, return_1113835).

The only difference between the two examples are the externals g and h (h seems to be the important one).

It seems like mems in application argument position are sometimes taken in consideration as current memory.
However, we should only consider vars and application results.

@NeuralCoder3 NeuralCoder3 added the bug Something isn't working label Dec 9, 2022
@NeuralCoder3
Copy link
Collaborator Author

One problem was that the else case where mem as result from any operation is registered in val2mem.
I think we do not need this case.

But this does not explain why other externals influence the result.

@NeuralCoder3
Copy link
Collaborator Author

The behavior was probably caused due to the sharing of the two ⊤:%mem.M instances.
The fix is in the ho_codegen branch (the only place where it is currently needed) and will be merged with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant