Skip to content

Commit 0a0c23b

Browse files
committed
[OpenMPOpt][FIX] Properly track changes to NestedParallelism
If we update the state, or indicate a pessimistic fixpoint, we need to consider NestedParallelism too. Fixes part of #66708 That said, the reproducer still needs malloc which we don't support on AMD GPU. Will be added later.
1 parent 3b5d59a commit 0a0c23b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@ struct KernelInfoState : AbstractState {
733733
SPMDCompatibilityTracker.indicatePessimisticFixpoint();
734734
ReachedKnownParallelRegions.indicatePessimisticFixpoint();
735735
ReachedUnknownParallelRegions.indicatePessimisticFixpoint();
736+
NestedParallelism = true;
736737
return ChangeStatus::CHANGED;
737738
}
738739

@@ -762,6 +763,8 @@ struct KernelInfoState : AbstractState {
762763
return false;
763764
if (ParallelLevels != RHS.ParallelLevels)
764765
return false;
766+
if (NestedParallelism != RHS.NestedParallelism)
767+
return false;
765768
return true;
766769
}
767770

@@ -3580,7 +3583,8 @@ struct AAKernelInfo : public StateWrapper<KernelInfoState, AbstractAttribute> {
35803583
", #ParLevels: " +
35813584
(ParallelLevels.isValidState()
35823585
? std::to_string(ParallelLevels.size())
3583-
: "<invalid>");
3586+
: "<invalid>") +
3587+
", NestedPar: " + (NestedParallelism ? "yes" : "no");
35843588
}
35853589

35863590
/// Create an abstract attribute biew for the position \p IRP.

llvm/test/Transforms/OpenMP/parallel_level_fold.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ target triple = "nvptx64"
1414
; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = external global i16
1515
; CHECK: @[[NONE_SPMD_KERNEL_ENVIRONMENT:[a-zA-Z0-9_$"\\.-]+]] = local_unnamed_addr constant [[STRUCT_KERNELENVIRONMENTTY:%.*]] { [[STRUCT_CONFIGURATIONENVIRONMENTTY:%.*]] { i8 0, i8 0, i8 1 }, ptr null, ptr null }
1616
; CHECK: @[[SPMD_KERNEL_ENVIRONMENT:[a-zA-Z0-9_$"\\.-]+]] = local_unnamed_addr constant [[STRUCT_KERNELENVIRONMENTTY:%.*]] { [[STRUCT_CONFIGURATIONENVIRONMENTTY:%.*]] { i8 0, i8 0, i8 2 }, ptr null, ptr null }
17-
; CHECK: @[[PARALLEL_KERNEL_ENVIRONMENT:[a-zA-Z0-9_$"\\.-]+]] = local_unnamed_addr constant [[STRUCT_KERNELENVIRONMENTTY:%.*]] { [[STRUCT_CONFIGURATIONENVIRONMENTTY:%.*]] { i8 0, i8 0, i8 2 }, ptr null, ptr null }
17+
; CHECK: @[[PARALLEL_KERNEL_ENVIRONMENT:[a-zA-Z0-9_$"\\.-]+]] = local_unnamed_addr constant [[STRUCT_KERNELENVIRONMENTTY:%.*]] { [[STRUCT_CONFIGURATIONENVIRONMENTTY:%.*]] { i8 0, i8 1, i8 2 }, ptr null, ptr null }
1818
;.
1919
define weak void @none_spmd() "kernel" {
2020
; CHECK-LABEL: define {{[^@]+}}@none_spmd

0 commit comments

Comments
 (0)