-
Notifications
You must be signed in to change notification settings - Fork 828
Implement DebugBreak and IsDebuggerPresent #8106
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
base: main
Are you sure you want to change the base?
Conversation
|
✅ With the latest revision this PR passed the Python code formatter. |
tools/clang/test/HLSLFileCheckLit/hlsl/intrinsics/basic/isdebugerpresent.hlsl
Outdated
Show resolved
Hide resolved
| break; | ||
| case hlsl::IntrinsicOp::IOP_DebugBreak: | ||
| retVal = spvBuilder.createNonSemanticDebugBreakExtInst(srcLoc); | ||
| break; |
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.
Is the ordering of the cases arbitrary?
tex3d
left a comment
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.
In intrinsic tests, we should add run lines and checks for -fcgl and -ast-dump. We also need lowering tests (dxilgen pass).
As pointed out in another comment, the opcodes should be in the IR checks, and updated when we move the ops to release. We should include the full arg list in those CHECKs (to verify all expected arguments - just the opcode in this case).
tools/clang/test/CodeGenSPIRV/intrinsics.isdebugerpresent.error.hlsl
Outdated
Show resolved
Hide resolved
tex3d
left a comment
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.
LGTM!
Add
DebugBreak()anddx::IsDebuggerPresent()intrinsics for shader debuggingDescription
This PR adds two new intrinsics for shader debugging in experimental Shader Model 6.10:
DebugBreak()- Triggers a breakpoint if a debugger is attacheddx::IsDebuggerPresent()- Returnstrueif a debugger is attachedChanges
HLSL Intrinsic Definitions:
DebugBreak()to the baseIntrinsicsnamespace ingen_intrin_main.txtIsDebuggerPresent()to theDxIntrinsicsnamespaceDXIL Operations:
DebugBreakandIsDebuggerPresentDXIL opcodes inhctdb.pyDebugBreak: void return, no overloadIsDebuggerPresent: i1 (bool) return, no overloadCode Generation:
HLOperationLower.cppLICOMPTYPE_BOOLhandling inSemaHLSL.cppfordx::namespace intrinsic type resolutionSPIR-V Support:
DebugBreak()emitsNonSemantic.DebugBreakextended instructionSPV_KHR_non_semantic_infoextension enablement inCapabilityVisitor.cppdx::IsDebuggerPresent()produces an error (no Vulkan equivalent)Tests:
debugbreak.hlsl- DXIL codegen testdebugbreak_sm69_error.hlsl- Shader model version error testisdebugerpresent.hlsl- DXIL codegen testintrinsics.debugbreak.hlsl- SPIR-V codegen testintrinsics.isdebugerpresent.error.hlsl- SPIR-V unsupported error testRelated
https://github.com/microsoft/hlsl-specs/blob/main/proposals/0039-debugbreak.md