@@ -762,10 +762,14 @@ getDoubleGRFSplitter(ModuleDesc &&MD, bool EmitOnlyKernelsAsEntryPoints) {
762
762
}
763
763
764
764
namespace {
765
- struct KernelProperties {
766
- KernelProperties () = default ;
767
-
768
- KernelProperties (const Function *F) {
765
+ // Data structure, which represent a combination of all possible optional
766
+ // features used in a function.
767
+ //
768
+ // It has extra methods to be useable as a key in llvm::DenseMap.
769
+ struct UsedOptionalFeatures {
770
+ UsedOptionalFeatures () = default ;
771
+
772
+ UsedOptionalFeatures (const Function *F) {
769
773
if (const MDNode *MDN = F->getMetadata (" sycl_used_aspects" )) {
770
774
auto ExtractIntegerFromMDNodeOperand = [=](const MDNode *N,
771
775
unsigned OpNo) -> auto {
@@ -796,14 +800,14 @@ namespace {
796
800
// TODO: extend this further with reqd-sub-group-size, reqd-work-group-size,
797
801
// double-grf and other properties
798
802
799
- static KernelProperties getTombstone () {
800
- KernelProperties Ret;
803
+ static UsedOptionalFeatures getTombstone () {
804
+ UsedOptionalFeatures Ret;
801
805
Ret.IsTombstoneKey = true ;
802
806
return Ret;
803
807
}
804
808
805
- static KernelProperties getEmpty () {
806
- KernelProperties Ret;
809
+ static UsedOptionalFeatures getEmpty () {
810
+ UsedOptionalFeatures Ret;
807
811
Ret.IsEmpty = true ;
808
812
return Ret;
809
813
}
@@ -814,7 +818,7 @@ namespace {
814
818
bool IsEmpty = false ;
815
819
816
820
public:
817
- bool operator ==(const KernelProperties &Other) const {
821
+ bool operator ==(const UsedOptionalFeatures &Other) const {
818
822
// Tombstone does not compare equal to any other item
819
823
if (IsTombstoneKey || Other.IsTombstoneKey )
820
824
return false ;
@@ -836,21 +840,21 @@ namespace {
836
840
}
837
841
};
838
842
839
- struct KernelPropertiesAsKeyInfo {
840
- static inline KernelProperties getEmptyKey () {
841
- return KernelProperties ::getEmpty ();
843
+ struct UsedOptionalFeaturesAsKeyInfo {
844
+ static inline UsedOptionalFeatures getEmptyKey () {
845
+ return UsedOptionalFeatures ::getEmpty ();
842
846
}
843
847
844
- static inline KernelProperties getTombstoneKey () {
845
- return KernelProperties ::getTombstone ();
848
+ static inline UsedOptionalFeatures getTombstoneKey () {
849
+ return UsedOptionalFeatures ::getTombstone ();
846
850
}
847
851
848
- static unsigned getHashValue (const KernelProperties &Value) {
852
+ static unsigned getHashValue (const UsedOptionalFeatures &Value) {
849
853
return Value.hash ();
850
854
}
851
855
852
- static bool isEqual (const KernelProperties &LHS,
853
- const KernelProperties &RHS) {
856
+ static bool isEqual (const UsedOptionalFeatures &LHS,
857
+ const UsedOptionalFeatures &RHS) {
854
858
return LHS == RHS;
855
859
}
856
860
};
@@ -860,7 +864,7 @@ std::unique_ptr<ModuleSplitterBase>
860
864
getPropertiesBasedSplitter (ModuleDesc &&MD, bool EmitOnlyKernelsAsEntryPoints) {
861
865
EntryPointGroupVec Groups;
862
866
863
- DenseMap<KernelProperties , EntryPointSet, KernelPropertiesAsKeyInfo >
867
+ DenseMap<UsedOptionalFeatures , EntryPointSet, UsedOptionalFeaturesAsKeyInfo >
864
868
PropertiesToFunctionsMap;
865
869
866
870
Module &M = MD.getModule ();
@@ -872,7 +876,7 @@ getPropertiesBasedSplitter(ModuleDesc &&MD, bool EmitOnlyKernelsAsEntryPoints) {
872
876
continue ;
873
877
}
874
878
875
- auto Key = KernelProperties (&F);
879
+ auto Key = UsedOptionalFeatures (&F);
876
880
PropertiesToFunctionsMap[Key].insert (&F);
877
881
}
878
882
0 commit comments