|
10 | 10 | // buffer accesses (IGBA). The outcome of the analysis is stored in a magic |
11 | 11 | // variable for the chipStar runtime: |
12 | 12 | // |
13 | | -// uint8_t __chip_module_may_have_IGBAs = <result>; |
| 13 | +// uint8_t __chip_module_has_no_IGBAs = <result>; |
14 | 14 | // |
15 | | -// Where the result is one if the are potential IGBAs and otherwise zero. |
| 15 | +// Where the result is one if the are no potential IGBAs and otherwise it is |
| 16 | +// zero. |
16 | 17 | // |
17 | | -// If there would be an IGPA in the module, there has to to be a load instruction |
18 | | -// with a pointer operand which is either loaded from memory or crafted from an |
19 | | -// integer (which OTOH is loaded from somewhere else). The analysis is very |
20 | | -// simple and naive: we look for pointer load and inttoptr instructions in the |
21 | | -// whole module. If we see any, we conclude there are potential IGBAs. Downsides |
22 | | -// of this are that |
| 18 | +// If there would be an IGPA in the module, there has to to be a load |
| 19 | +// instruction with a pointer operand which is either loaded from memory or |
| 20 | +// crafted from an integer (which OTOH is loaded from somewhere else). The |
| 21 | +// analysis is very simple and naive: we look for pointer load and inttoptr |
| 22 | +// instructions in the whole module. If we see any, we conclude there are |
| 23 | +// potential IGBAs. Downsides of this are that |
23 | 24 | // |
24 | | -// * may-have-IGBAs flag is raised even tough only one kernel has IGBAs an |
| 25 | +// * may-have-IGBAs is concluded even tough only one kernel has IGBAs an |
25 | 26 | // others don't |
26 | 27 | // |
27 | | -// * unoptimized modules (-O0) will likely raise may-have-IGBAs flag. |
| 28 | +// * unoptimized modules (-O0) will likely likely result in may-have-IGBAs |
| 29 | +// * conclusion |
28 | 30 | // |
29 | 31 | // The motivation for this analysis is to reduce clSetKernelExecInfo() calls in |
30 | 32 | // the OpenCL backend. |
@@ -58,15 +60,15 @@ static bool hasPotentialIGBAs(Module &M) { |
58 | 60 | } |
59 | 61 |
|
60 | 62 | static bool detectIGBAs(Module &M) { |
61 | | - constexpr auto *MagicVarName = "__chip_module_may_have_IGBAs"; |
| 63 | + constexpr auto *MagicVarName = "__chip_module_has_no_IGBAs"; |
62 | 64 |
|
63 | 65 | if (M.getGlobalVariable(MagicVarName)) |
64 | 66 | return false; // Bail out: the module has already been processed. |
65 | 67 |
|
66 | 68 | bool Result = hasPotentialIGBAs(M); |
67 | 69 | LLVM_DEBUG(dbgs() << "Has IGBAs: " << Result << "\n"); |
68 | 70 |
|
69 | | - auto *Init = ConstantInt::get(IntegerType::get(M.getContext(), 8), Result); |
| 71 | + auto *Init = ConstantInt::get(IntegerType::get(M.getContext(), 8), !Result); |
70 | 72 | (void)new GlobalVariable( |
71 | 73 | M, Init->getType(), true, |
72 | 74 | // Mark the GV as external for keeping it alive at least until the |
|
0 commit comments