Skip to content

[ScopeNestedCFG] Prevent blocks containing convergent instructions from being cloned#8142

Open
bob80905 wants to merge 4 commits intomicrosoft:mainfrom
bob80905:include_switch_fallthrough_nestedscopecfg
Open

[ScopeNestedCFG] Prevent blocks containing convergent instructions from being cloned#8142
bob80905 wants to merge 4 commits intomicrosoft:mainfrom
bob80905:include_switch_fallthrough_nestedscopecfg

Conversation

@bob80905
Copy link
Collaborator

@bob80905 bob80905 commented Feb 5, 2026

This PR modifies the ScopeNestedCFG pass to prevent blocks containing convergent instructions from being cloned.
Previously, blocks would be cloned by TransformAcyclicRegion and similar functions. There should be an exception when blocks contain wave ops.
Fixes #8141

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

✅ With the latest revision this PR passed the C/C++ code formatter.

Comment on lines 17 to 27

# Link against LLVMDXIL so that ScopeNestedCFG can use DxilUtil functions
target_link_libraries(DxilConvPasses
PRIVATE LLVMDXIL
)

target_include_directories(DxilConvPasses
PRIVATE
${DXC_SOURCE_DIR}/lib/DXIL
${DXC_SOURCE_DIR}/lib/IR
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are any of these changes necessary?

I don't see any obvious new external functions being called, so I'm not sure why a lib is being added. I don't see any new headers being included, so I don't understand why we need to add two directories to the include path.

for (Instruction &I : *BB) {
if (auto *CI = dyn_cast<CallInst>(&I)) {
Function *CF = CI->getCalledFunction();
if (CF && CF->hasFnAttribute(Attribute::AttrKind::Convergent))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably doesn't actually fix the issue because we currently strip convergent attributes off DXIL operations before emitting the final DXIL so we would also need a pass to restore the convergent attribute.

I'm not sure what utilities DXC has for identifying convergent DXIL ops in absence of the attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

[ScopeNestedCFG] Basic Blocks are cloned when containing convergent ops

3 participants