This repository was archived by the owner on Jan 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 43
43
#include < string>
44
44
#include < utility>
45
45
#include < vector>
46
+ #include " llvm/IR/Function.h"
47
+ #include " llvm/IR/Module.h"
46
48
47
49
#define DEBUG_TYPE " block-freq"
48
50
@@ -1144,6 +1146,23 @@ template <class BT> void BlockFrequencyInfoImpl<BT>::computeMassInLoops() {
1144
1146
}
1145
1147
}
1146
1148
1149
+ // lld: OpenMP offloading outer loop
1150
+ namespace bfi_detail {
1151
+ template <class FT >
1152
+ void changeLoopScale (ScaledNumber<uint64_t > *Scale, const FT *F) {}
1153
+ template <>
1154
+ inline void changeLoopScale<Function>(ScaledNumber<uint64_t > *Scale,
1155
+ const Function *F) {
1156
+ auto *M = F->getParent ();
1157
+ std::string TT = M->getTargetTriple ();
1158
+ if (TT.find (" cuda" ) != std::string::npos) {
1159
+ dbgs () << " change loop scale from " << *Scale << " to " ;
1160
+ *Scale = ScaledNumber<uint64_t >(1 , 0 ).inverse ();
1161
+ dbgs () << *Scale << " \n " ;
1162
+ }
1163
+ }
1164
+ } // namespace bfi_detail
1165
+
1147
1166
template <class BT >
1148
1167
bool BlockFrequencyInfoImpl<BT>::computeMassInLoop(LoopData &Loop) {
1149
1168
// Compute mass in loop.
@@ -1214,6 +1233,9 @@ bool BlockFrequencyInfoImpl<BT>::computeMassInLoop(LoopData &Loop) {
1214
1233
}
1215
1234
1216
1235
computeLoopScale (Loop);
1236
+ // lld: OpenMP offloading outer loop
1237
+ if (&Loop == &(*Loops.begin ()))
1238
+ bfi_detail::changeLoopScale (&(Loop.Scale ), F);
1217
1239
packageLoop (Loop);
1218
1240
return true ;
1219
1241
}
You can’t perform that action at this time.
0 commit comments