-
Notifications
You must be signed in to change notification settings - Fork 125
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
Incorrect differentiation of loop conditions in reverse mode #746
Comments
Hello, I would like to take this issue as it seem to be a simple one for a first contribution 🙂 |
Please go ahead! |
I could not run Clad on my machine as it crashed when building the project.. As for the issue, I looked into the code and I had a few questions about the topic :
|
Clang-17 fails to compile provided code:
|
How would the error: |
@wymux clang++-11 -std=c++11 -I /path/to/clad/include -fplugin=/path/to/build/lib/clad.so <your source code>.cpp |
Hey @KronoCode are you still working on this issue? |
Hi @parth-07!
Do you mean:
If yes, I tested the example locally and it run as expected when I compiled with clang-17. clang-14 and 15 failed to compile the code correctly. So maybe we should focus on the differences between these versions and the internal compilation errors? I am curious to know if this is indeed a problem or only occurred to me. |
Hi @kchristin22 I meant the first snippet only -- that is mentioned in the issue description.
Just to clarify, do you mean clang-14 and clang-15 failed to differentiate the code in the 2nd snippet? If so, can you please open an issue for this? |
It was actually a false alarm, clang-15 did fine, sorry for that. The 1st snippet (the one denoted in the issue description) fails at these lines which seem to be in reverse order and should not compile:
I'm not familiar with how the AST nodes are being handled though to give extra input : ( |
Practically, this is the GSoC project to go at the AST level and sometime even below. |
Currently loop conditions are not differentiated in reverse mode. This change differentiates the loop condition expression.
Currently loop conditions are not differentiated in reverse mode. This change differentiates the loop condition expression.
Currently loop conditions are not differentiated in reverse mode. This change differentiates the loop condition expression.
Currently loop conditions are not differentiated in reverse mode. This change differentiates the loop condition expression.
Currently loop conditions are not differentiated in reverse mode. This change differentiates the loop condition expression.
This change differentiates the loop condition expression. Additionaly if in forward pass a loop terminates pre-maturely due to break stmt. The reverse pass should start differentiation with break statment and not the loop condition differentiation. This change keeps track of whether the break was called in forward pass and based on that in reverse mode it is decided whether the loop differentiation is skipped for the first iteration or not.
This change differentiates the loop condition expression. Additionaly if in forward pass a loop terminates pre-maturely due to break stmt. The reverse pass should start differentiation with break statment and not the loop condition differentiation. This change keeps track of whether the break was called in forward pass and based on that in reverse mode it is decided whether the loop differentiation is skipped for the first iteration or not.
This change differentiates the loop condition expression. Additionaly if in forward pass a loop terminates pre-maturely due to break stmt. The reverse pass should start differentiation with break statment and not the loop condition differentiation. This change keeps track of whether the break was called in forward pass and based on that in reverse mode it is decided whether the loop differentiation is skipped for the first iteration or not.
This change differentiates the loop condition expression. Additionaly if in forward pass a loop terminates pre-maturely due to break stmt. The reverse pass should start differentiation with break statment and not the loop condition differentiation. This change keeps track of whether the break was called in forward pass and based on that in reverse mode it is decided whether the loop differentiation is skipped for the first iteration or not.
This change differentiates the loop condition expression. Additionaly if in forward pass a loop terminates pre-maturely due to break stmt. The reverse pass should start differentiation with break statment and not the loop condition differentiation. This change keeps track of whether the break was called in forward pass and based on that in reverse mode it is decided whether the loop differentiation is skipped for the first iteration or not.
This change differentiates the loop condition expression. Additionaly if in forward pass a loop terminates pre-maturely due to break stmt. The reverse pass should start differentiation with break statment and not the loop condition differentiation. This change keeps track of whether the break was called in forward pass and based on that in reverse mode it is decided whether the loop differentiation is skipped for the first iteration or not.
This change differentiates the loop condition expression. Additionaly if in forward pass a loop terminates pre-maturely due to break stmt. The reverse pass should start differentiation with break statment and not the loop condition differentiation. This change keeps track of whether the break was called in forward pass and based on that in reverse mode it is decided whether the loop differentiation is skipped for the first iteration or not.
This change differentiates the loop condition expression. Additionaly if in forward pass a loop terminates pre-maturely due to break stmt. The reverse pass should start differentiation with break statment and not the loop condition differentiation. This change keeps track of whether the break was called in forward pass and based on that in reverse mode it is decided whether the loop differentiation is skipped for the first iteration or not.
This change differentiates the loop condition expression. Additionaly if in forward pass a loop terminates pre-maturely due to break stmt. The reverse pass should start differentiation with break statment and not the loop condition differentiation. This change keeps track of whether the break was called in forward pass and based on that in reverse mode it is decided whether the loop differentiation is skipped for the first iteration or not.
This change differentiates the loop condition expression. Additionaly if in forward pass a loop terminates pre-maturely due to break stmt. The reverse pass should start differentiation with break statment and not the loop condition differentiation. This change keeps track of whether the break was called in forward pass and based on that in reverse mode it is decided whether the loop differentiation is skipped for the first iteration or not.
Loop conditions are incorrectly differentiated in the reverse mode.
Reproducible example:
Output:
di: 0
dj: 0
Expected output:
di: 5
dj: 3
The text was updated successfully, but these errors were encountered: