Skip to content

Commit bd2ae95

Browse files
committed
Aspects order shouldn't matter
1 parent 7d7fd45 commit bd2ae95

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

llvm/test/tools/sycl-post-link/device-code-split/per-aspect-split-2.ll

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@
1212
; CHECK-TABLE-NEXT: _0.sym
1313
; CHECK-TABLE-NEXT: _1.sym
1414
; CHECK-TABLE-NEXT: _2.sym
15-
; CHECK-TABLE-NEXT: _3.sym
1615
; CHECK-TABLE-EMPTY:
1716

18-
; CHECK-M0-SYMS: kernel2
19-
; CHECK-M1-SYMS: kernel3
20-
; CHECK-M2-SYMS: kernel0
21-
; CHECK-M3-SYMS: kernel1
17+
; CHECK-M0-SYMS: kernel3
18+
; CHECK-M0-SYMS-EMPTY:
19+
20+
; CHECK-M1-SYMS: kernel0
21+
; CHECK-M1-SYMS-EMPTY:
22+
23+
; CHECK-M2-SYMS: kernel1
24+
; CHECK-M2-SYMS: kernel2
25+
; CHECK-M2-SYMS-EMPTY:
2226

2327
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
2428
target triple = "spir64-unknown-linux"

llvm/tools/sycl-post-link/ModuleSplitter.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,10 @@ namespace {
767767
//
768768
// It has extra methods to be useable as a key in llvm::DenseMap.
769769
struct UsedOptionalFeatures {
770+
SmallVector<int, 4> Aspects;
771+
// TODO: extend this further with reqd-sub-group-size, reqd-work-group-size,
772+
// double-grf and other properties
773+
770774
UsedOptionalFeatures() = default;
771775

772776
UsedOptionalFeatures(const Function *F) {
@@ -779,9 +783,9 @@ namespace {
779783
};
780784

781785
for (size_t I = 0, E = MDN->getNumOperands(); I < E; ++I) {
782-
Aspects.insert(ExtractIntegerFromMDNodeOperand(MDN, I));
786+
Aspects.push_back(ExtractIntegerFromMDNodeOperand(MDN, I));
783787
}
784-
788+
llvm::sort(Aspects);
785789
}
786790

787791
llvm::hash_code AspectsHash =
@@ -800,10 +804,6 @@ namespace {
800804
return Ret;
801805
}
802806

803-
SmallSet<int, 4> Aspects;
804-
// TODO: extend this further with reqd-sub-group-size, reqd-work-group-size,
805-
// double-grf and other properties
806-
807807
static UsedOptionalFeatures getTombstone() {
808808
UsedOptionalFeatures Ret;
809809
Ret.IsTombstoneKey = true;
@@ -831,9 +831,10 @@ namespace {
831831
if (Aspects.size() != Other.Aspects.size())
832832
return false;
833833

834-
if (!llvm::all_of(Other.Aspects,
835-
[&](int Aspect) { return Aspects.contains(Aspect); }))
836-
return false;
834+
for (size_t I = 0, E = Aspects.size(); I != E; ++I) {
835+
if (Aspects[I] != Other.Aspects[I])
836+
return false;
837+
}
837838

838839
return IsEmpty == Other.IsEmpty;
839840
}

0 commit comments

Comments
 (0)