The expected use case is for frontends to insert this into
shaders that are to be run under a debugger. The shader can
then be resumed or single stepped from the point of the call
under debugger control.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/IR/IntrinsicsAMDGPU.td | ||
---|---|---|
1288 | Yes, as far as the generated code is concerned. It doesn't really know that it'll be stopped in the debugger for a while, and we definitely want it to function correctly if/when the debugger resumes it. |
The expected use case is for frontends to insert this into
shaders that are to be run under a debugger. The shader can
then be resumed or single stepped from the point of the call
under debugger control.
Please check with the AMDGPU debugger team before making these assumptions:-) It turns out that the debugger did recently add support for tracking the wave halt state independent of the breakpoint state so this is fine. However, using this does not notify the debugger. A better alternative is to use the llvm.debug intrinsic that will notify the debugger when executed, and also halt the wave for the debugger to resume.
It looks like llvm.debugtrap is only supported on HSA?
that will notify the debugger when executed, and also halt the wave for the debugger to resume.
Right, I realise that llvm.debugtrap/s_trap is a more normal way of breaking into a debugger. But there is more than one debugger, and more than one way of debugging things, and for cases where you want to halt the program and attach a debugger after the fact, llvm.amdgcn.s.sethalt/s_sethalt seems like a useful thing.
What other debuggers do you have in mind? There is the rocgdb and the UMR hardware debugger. Do you know of others for AMDGPU? If non-HSA targets would like to support a debugger it would make sense that the also add support for llvm.debugtrap as well:-)
Also, does this patch account for the hardware hazard that you must not have an s_endpgm following an s_halt on asics that do not support it? One approach to avoid the hazard is to always put a s_nop after an s_halt.
Windbg and umr.
If non-HSA targets would like to support a debugger it would make sense that the also add support for llvm.debugtrap as well:-)
Makes sense to me. It seems like the lowering of llvm.debugtrap to s_trap is deliberately restricted to HSA, but I don't know the history of that.
Also, does this patch account for the hardware hazard that you must not have an s_endpgm following an s_halt on asics that do not support it? One approach to avoid the hazard is to always put a s_nop after an s_halt.
No I was not aware of that. I'll see what I can do...
Is this really willreturn?