-
Notifications
You must be signed in to change notification settings - Fork 6
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
Try lowering aten.nll_loss_forward
to ttnn.moreh_nll_loss
#676
base: main
Are you sure you want to change the base?
Conversation
I followed the troubleshooting steps in https://github.com/tenstorrent/pytorch2.0_ttnn/blob/main/docs/ProblemSolving.md, but I don't know what it implies.
|
This issue look identical to tenstorrent/tt-metal#9681, even down to the same line in Pytorch. This was fixed in tt-metal. We might need the same for moreh ops. |
I forgot how to dig into this kind of error: ``` FAILED tests/lowering/misc/test_nll_loss.py::test_nll_loss[input_shape0-True-mean--100] - torch._dynamo.exc.BackendCompilerFailed: backend='ttnn_backend' raised: FAILED tests/lowering/misc/test_nll_loss.py::test_nll_loss[input_shape1-False-mean--100] - torch._dynamo.exc.BackendCompilerFailed: backend='ttnn_backend' raised: ```
…or PyTorch FX decorator (cf. tenstorrent/tt-metal#9681)
1. Isn't the default divisor 1? 2. We arrive at a segfault ``` tests/lowering/misc/test_nll_loss.py Fatal Python error: Segmentation fault Thread 0x00007f1a8a7e4700 (most recent call first): File "/usr/lib/python3.8/threading.py", line 306 in wait File "/usr/lib/python3.8/threading.py", line 558 in wait File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/tqdm/_monitor.py", line 60 in run File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap Current thread 0x00007f1ba3a19740 (most recent call first): File "/home/jdh8/tt-metal/ttnn/ttnn/decorators.py", line 329 in __call__ File "/home/jdh8/tt-metal/ttnn/ttnn/operations/core.py", line 233 in from_torch File "/home/jdh8/tt-metal/ttnn/ttnn/decorators.py", line 329 in __call__ File "<eval_with_key>.15", line 8 in forward File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1520 in _call_impl File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1511 in _wrapped_call_impl File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/fx/graph_module.py", line 304 in __call__ File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/fx/graph_module.py", line 738 in call_wrapped File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/utils.py", line 81 in g File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/jit_compile_runtime_wrappers.py", line 118 in rng_functionalization_wrapper File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/utils.py", line 105 in call_func_at_runtime_with_args File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/runtime_wrappers.py", line 94 in runtime_wrapper File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/utils.py", line 81 in g File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/aot_autograd.py", line 901 in forward File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_dynamo/external_utils.py", line 17 in inner File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_dynamo/eval_frame.py", line 489 in _fn File "/home/jdh8/pytorch2.0_ttnn/tests/lowering/misc/test_nll_loss.py", line 13 in forward File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1520 in _call_impl File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1511 in _wrapped_call_impl File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_dynamo/eval_frame.py", line 489 in _fn File "/home/jdh8/pytorch2.0_ttnn/tests/lowering/misc/test_nll_loss.py", line 39 in test_nll_loss File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/python.py", line 195 in pytest_pyfunc_call File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_callers.py", line 103 in _multicall File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_manager.py", line 120 in _hookexec File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 513 in __call__ File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/python.py", line 1789 in runtest File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 167 in pytest_runtest_call File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_callers.py", line 103 in _multicall File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_manager.py", line 120 in _hookexec File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 513 in __call__ File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 260 in <lambda> File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 339 in from_call File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 259 in call_runtest_hook File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 220 in call_and_report File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 131 in runtestprotocol File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 112 in pytest_runtest_protocol File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_callers.py", line 103 in _multicall File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_manager.py", line 120 in _hookexec File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 513 in __call__ File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/main.py", line 349 in pytest_runtestloop File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_callers.py", line 103 in _multicall File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_manager.py", line 120 in _hookexec File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 513 in __call__ File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/main.py", line 324 in _main File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/main.py", line 270 in wrap_session File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/main.py", line 317 in pytest_cmdline_main File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_callers.py", line 103 in _multicall File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_manager.py", line 120 in _hookexec File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 513 in __call__ File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 167 in main File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 190 in console_main File "/home/jdh8/tt-metal/python_env/bin/pytest", line 8 in <module> Segmentation fault (core dumped) ```
@@ -192,12 +192,12 @@ def is_tt_compute(node) -> bool: | |||
ttnn.zeros_like, | |||
ttnn.mean, | |||
ttnn.moreh_cumsum, | |||
ttnn.moreh_nll_loss, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Using ttnn.moreh_*
wrappers work!
input, target, weight, reduction, ignore_index = args | ||
args = input, target, ("none", "mean", "sum")[reduction] | ||
kwargs = { | ||
"divisor_tensor": torch.tensor([0], dtype=get_dtype(input)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Isn't the default divisor 1?
- We arrive at a segfault (even after I tried 1 instead of 0)
tests/lowering/misc/test_nll_loss.py Fatal Python error: Segmentation fault
Thread 0x00007f1a8a7e4700 (most recent call first):
File "/usr/lib/python3.8/threading.py", line 306 in wait
File "/usr/lib/python3.8/threading.py", line 558 in wait
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/tqdm/_monitor.py", line 60 in run
File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner
File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap
Current thread 0x00007f1ba3a19740 (most recent call first):
File "/home/jdh8/tt-metal/ttnn/ttnn/decorators.py", line 329 in __call__
File "/home/jdh8/tt-metal/ttnn/ttnn/operations/core.py", line 233 in from_torch
File "/home/jdh8/tt-metal/ttnn/ttnn/decorators.py", line 329 in __call__
File "<eval_with_key>.15", line 8 in forward
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1520 in _call_impl
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1511 in _wrapped_call_impl
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/fx/graph_module.py", line 304 in __call__
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/fx/graph_module.py", line 738 in call_wrapped
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/utils.py", line 81 in g
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/jit_compile_runtime_wrappers.py", line 118 in rng_functionalization_wrapper
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/utils.py", line 105 in call_func_at_runtime_with_args
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/runtime_wrappers.py", line 94 in runtime_wrapper
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/utils.py", line 81 in g
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_functorch/aot_autograd.py", line 901 in forward
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_dynamo/external_utils.py", line 17 in inner
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_dynamo/eval_frame.py", line 489 in _fn
File "/home/jdh8/pytorch2.0_ttnn/tests/lowering/misc/test_nll_loss.py", line 13 in forward
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1520 in _call_impl
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1511 in _wrapped_call_impl
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/torch/_dynamo/eval_frame.py", line 489 in _fn
File "/home/jdh8/pytorch2.0_ttnn/tests/lowering/misc/test_nll_loss.py", line 39 in test_nll_loss
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/python.py", line 195 in pytest_pyfunc_call
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_callers.py", line 103 in _multicall
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 513 in __call__
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/python.py", line 1789 in runtest
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 167 in pytest_runtest_call
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_callers.py", line 103 in _multicall
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 513 in __call__
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 260 in <lambda>
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 339 in from_call
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 259 in call_runtest_hook
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 220 in call_and_report
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 131 in runtestprotocol
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/runner.py", line 112 in pytest_runtest_protocol
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_callers.py", line 103 in _multicall
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 513 in __call__
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/main.py", line 349 in pytest_runtestloop
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_callers.py", line 103 in _multicall
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 513 in __call__
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/main.py", line 324 in _main
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/main.py", line 270 in wrap_session
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/main.py", line 317 in pytest_cmdline_main
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_callers.py", line 103 in _multicall
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/pluggy/_hooks.py", line 513 in __call__
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 167 in main
File "/home/jdh8/tt-metal/python_env/lib/python3.8/site-packages/_pytest/config/__init__.py", line 190 in console_main
File "/home/jdh8/tt-metal/python_env/bin/pytest", line 8 in <module>
Segmentation fault (core dumped)
aten.nll_loss_forward
to ttnn.operations.moreh.nll_loss
aten.nll_loss_forward
to ttnn.moreh_nll_loss
Ticket
Problem description
I forgot how to dig into this kind of error:
What's changed
Describe the approach used to solve the problem.
Summarize the changes made and their impact