Skip to content

Commit 79f133f

Browse files
committed
Remove convergence
I thought we had already discussed and done this...
1 parent f842b61 commit 79f133f

1 file changed

Lines changed: 11 additions & 29 deletions

File tree

proposals/0039-debugbreak.md

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ bool dx::IsDebuggingEnabled(); // Query if debugging is enabled (DirectX only).
5858
```hlsl
5959
[numthreads(8,1,1)]
6060
void main(uint GI : SV_GroupIndex) {
61-
// Conditional expensive debug checks
61+
// Conditional expensive debug checks
6262
if (dx::IsDebuggingEnabled()) {
63-
// Expensive validation only when debugging
64-
ValidateComplexInvariants();
65-
}
66-
67-
// Manual breakpoint for debugging specific conditions
68-
if (someRareCondition) {
69-
DebugBreak();
70-
}
63+
// Expensive validation only when debugging
64+
ValidateComplexInvariants();
65+
}
66+
67+
// Manual breakpoint for debugging specific conditions
68+
if (someRareCondition) {
69+
DebugBreak();
70+
}
7171
}
7272
```
7373

@@ -122,12 +122,10 @@ This change introduces two new DXIL operations:
122122
```llvm
123123
declare void @dx.op.debugBreak(
124124
immarg i32 ; opcode
125-
) convergent
125+
)
126126
```
127127

128-
Triggers a debugger breakpoint. Must be treated as `convergent` to prevent code
129-
motion. Should not be marked `readonly` or `readnone`. If debugging is not
130-
enabled, this is a no-op.
128+
Triggers a debugger breakpoint. If debugging is not enabled, this is a no-op.
131129

132130
#### `dx.op.IsDebuggingEnabled`
133131

@@ -140,14 +138,6 @@ declare i1 @dx.op.IsDebuggingEnabled(
140138
Returns `true` (1) if debugging is enabled, `false` (0) otherwise. Marked
141139
`readonly` as it only queries state.
142140

143-
### Convergence Requirements
144-
145-
`debugBreak` operations must be treated as `convergent` to prevent
146-
code motion that could change their observable behavior:
147-
- `debugBreak`: Must break at the exact location specified by the programmer
148-
149-
These operations should not be hoisted, sunk, or duplicated by optimizers.
150-
151141
### Shader Model Requirements
152142

153143
These instructions will only be valid in Shader Model 6.10 or later.
@@ -195,17 +185,9 @@ No SPIR-V lowering is defined for `dx::IsDebuggingEnabled()`.
195185

196186
- Confirm validation accepts the new operations in SM 6.10+
197187
- Confirm validation rejects operations in earlier shader models
198-
- Verify convergence requirements are properly validated
199188

200189
### Execution Testing
201190

202191
- Test `DebugBreak()` triggers breakpoint when debugging is enabled
203192
- Test `DebugBreak()` is no-op when debugging is not enabled
204193
- Test `dx::IsDebuggingEnabled()` returns correct value based on runtime state
205-
206-
## Open Questions
207-
208-
* Consider introducing the `convergent` attribute to DXIL.
209-
* This should be "cheap" and would potentially address pre-existing bugs.
210-
* This would preserve the requirement that these operations not be moved
211-
during optimization in the final DXIL.

0 commit comments

Comments
 (0)