[PIX] Instrument DebugBreak() calls for PIX#8349
[PIX] Instrument DebugBreak() calls for PIX#8349henchhinglimbu wants to merge 2 commits intomicrosoft:mainfrom
Conversation
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
|
@microsoft-github-policy-service agree company="Microsoft" |
| for (auto UI = DebugBreakFunc->use_begin(); | ||
| UI != DebugBreakFunc->use_end();) { | ||
| auto &Use = *UI++; | ||
| DebugBreakCalls.push_back(cast<CallInst>(Use.getUser())); | ||
| } |
There was a problem hiding this comment.
I have a few issues with this loop (excessive autos, not storing the "end" iterator, unnecessary *UI++ pattern when it's all const).
Would something like this work instead (untested suggestion)?
| for (auto UI = DebugBreakFunc->use_begin(); | |
| UI != DebugBreakFunc->use_end();) { | |
| auto &Use = *UI++; | |
| DebugBreakCalls.push_back(cast<CallInst>(Use.getUser())); | |
| } | |
| for (const Use &U: DebugBreakFunc->uses()) | |
| DebugBreakCalls.push_back(cast<CallInst>(U.getUser())); |
| if (!PixUAVResource) { | ||
| PixUAVResource = | ||
| PIXPassHelpers::CreateGlobalUAVResource(DM, 0, "PixUAVResource"); | ||
| } |
There was a problem hiding this comment.
| if (!PixUAVResource) { | |
| PixUAVResource = | |
| PIXPassHelpers::CreateGlobalUAVResource(DM, 0, "PixUAVResource"); | |
| } | |
| if (!PixUAVResource) | |
| PixUAVResource = | |
| PIXPassHelpers::CreateGlobalUAVResource(DM, 0, "PixUAVResource"); |
LLVM coding conventions omit braces for single statement bodies.
|
|
||
| uint32_t InstructionNumber = 0; | ||
| if (!pix_dxil::PixDxilInstNum::FromInst(CI, &InstructionNumber)) { | ||
| DXASSERT_NOMSG(false); |
There was a problem hiding this comment.
What does it mean if this assert fires?
|
|
||
| // Remove the now-unused dx.op.debugBreak function declaration so the | ||
| // DebugBreak operation is fully eliminated from the module. | ||
| if (DebugBreakFunc->use_empty()) |
There was a problem hiding this comment.
If there are still uses of this, does this mean that something actually went wrong with our attempt to remove all uses? Is this something we'd want to know about via an assert or failure condition/
Changes:
DebugBreak()calls with UAV atomic writes so PIX can detect hit locations without halting execution.Testing:
dxcompiler,ClangHLSLTests, andcheck-allcheck-allpassed locallyCo-authored-by: Copilot 223556219+Copilot@users.noreply.github.com