Open romerojosh opened 1 week ago
Thanks for reporting this @romerojosh, I'm surprised that we don't test in-place operations in our unit tests 😬
The problem started with a69d061f6a959307828acf239f73a58012e389bf according to git bisect
:
a69d061f6a959307828acf239f73a58012e389bf is the first bad commit
commit a69d061f6a959307828acf239f73a58012e389bf
Author: Zach Corse <zcorse@nvidia.com>
Date: Wed Sep 4 22:10:21 2024 -0700
Array in-place autodiff fixes
CHANGELOG.md | 1 +
warp/codegen.py | 63 +++++++++++++++++-
warp/native/array.h | 1 -
warp/tests/test_array.py | 168 +++++++++++++++++++++++++++++++++++++++++++++++
warp/types.py | 37 +++++++++++
5 files changed, 266 insertions(+), 4 deletions(-)
In this case, the new code added as part of a69d061 does nothing when the operation is a multiply or division: https://github.com/NVIDIA/warp/blob/1d9a0719d11b76162e84c32468081306603052f5/warp/codegen.py#L2579
For now I will restore the old behavior by adding a missing make_new_assign_statement()
and muting the warning unless the verbosity is turned on.
Bug Description
I have a program that works fine with Warp 1.3.1 and breaks with Warp 1.4.0+. I've found one kernel so far that leads to issues:
After some digging, I think the issue might stem from the line with in-place division:
If I look at the generated code, I find the following in 1.3.1 for that line:
while in 1.4.0, I see just a single load operation, which is clearly not right:
The output from 1.4.0 and 1.4.1 from compiling the program also prints a warning like:
which also indicates this in-place division might be causing issues.
As an additional experiment, I also changed the in place division line to:
and that fixes it with Warp 1.4.0+.
I don't care that my kernel is not differentiable, so it is a little alarming that the in-place division warning seems to just produce incorrect code. Is this expected and should this warning be fatal?
System Information
No response