tenstorrent / tt-metal

:metal: TT-NN operator library, and TT-Metalium low level kernel programming model.
Apache License 2.0
471 stars 74 forks source link

[Bug Report] Use after move in run_operation.cpp #15073

Open marty1885 opened 1 hour ago

marty1885 commented 1 hour ago

Describe the bug This is a bug discovered by clang-analyzer following a long discussion on discord. In run_operation.cpp. The operation object is moved before calling operation.compute_output_shapes(). Causing a UB. I am not sure weather if it is causing any actual trouble now, but probably worth fixing.

Due to the nature of non-const functions. I am unable to fix myself as I lack the low level understanding of how this part of program works.

To Reproduce

In ttnn/cpp/ttnn/run_operation.cpp, line 372-374 and 437-437

Image

Image

Expected behavior Should not trigger UB.

Screenshots If applicable, add screenshots to help explain your problem.

Please complete the following environment information:

Additional context Add any other context about the problem here.

ayerofieiev-tt commented 1 hour ago

Thank you! On it!

jvasilje commented 1 hour ago

Thanks @ayerofieiev-tt ! <3

ayerofieiev-tt commented 11 minutes ago

Fixing this specific issue.

Then we should enable the clang-tidy check and fixing any issue that it surfaces. https://github.com/tenstorrent/tt-metal/blob/008c50a744ab398526f12992f9f4902283f9215a/.clang-tidy#L28

CC @blozano-tt @afuller-TT