I want to step into the linear function using VS Code's step-in , but it skips automatically when I click "step into". Could anyone help me with this?
I used DEBUG=1 when compiling PyTorch.
I can't step into the linear function using either python launch or gdb attach.
However, strangely, if I set a breakpoint on the line const KernelFunction& kernel = op.operatorDef_->op.lookup(dispatchKeySet); in the directory /home/sss/WORK/PYTORCH/pytorch/aten/src/ATen/core/dispatch/Dispatcher.h, I can step into or enter that line.
It doesn't work without the breakpoint. Is this normal? Is there any way to solve this?
my test code:
import torch
import torch.nn.functional as F
x = torch.tensor([[1.0, 2.0]]).to('cuda')
weight = torch.tensor([[0.5, 0.5], [0.5, 0.5]]).to('cuda')
y = F.linear(x, weight)
My launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "/home/sss/WORK/PYTORCH/test.py",
"console": "integratedTerminal",
"justMyCode": false ,
},
{
"name": "(gdb) Attach to Process",
"type": "cppdbg",
"request": "attach",
"program": "/home/sss/WORK/VLLM/vllm/.venv/bin/python",
"processId": "${command:pickProcess}",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
],
"compounds": [
{
"name": "Python + C++ (Attach)",
"configurations": ["Python: Current File", "(gdb) Attach to Process"]
}
]
}