@@ -291,22 +291,26 @@ enum KernelMapEntryScope {
291
291
Scope_Global // single entry in the map for all kernels
292
292
};
293
293
294
- static KernelMapEntryScope selectDeviceCodeSplitModeAutomatically (Module &M) {
294
+ static KernelMapEntryScope selectDeviceCodeSplitScopeAutomatically (Module &M) {
295
295
// Here we can employ various heuristics to decide which way to split kernels
296
296
// is the best in each particular situation.
297
297
// At the moment, we assume that per-kernel split is the best way of splitting
298
298
// device code and it can be always selected unless there are functions marked
299
299
// with [[intel::device_indirectly_callable]] attribute, because it instructs
300
300
// us to make this function available to the whole program as it was compiled
301
301
// as a single module.
302
- bool HasDeviceIndirectlyCallable = false ;
302
+ if (IROutputOnly) {
303
+ // We allow enabling auto split mode even in presence of -ir-output-only
304
+ // flag, but in this case we are limited by it so we can't do any split at
305
+ // all.
306
+ return Scope_Global;
307
+ }
308
+
303
309
for (auto &F : M.functions ()) {
304
310
if (F.hasFnAttribute (" referenced-indirectly" ))
305
- HasDeviceIndirectlyCallable = true ;
311
+ return Scope_Global ;
306
312
}
307
313
308
- if (HasDeviceIndirectlyCallable)
309
- return Scope_Global;
310
314
return Scope_PerModule;
311
315
}
312
316
@@ -645,9 +649,9 @@ int main(int argc, char **argv) {
645
649
errs () << " no actions specified; try --help for usage info\n " ;
646
650
return 1 ;
647
651
}
648
- if (IROutputOnly && DoSplit) {
649
- errs () << " error: -" << SplitMode.ArgStr << " can't be used with - "
650
- << IROutputOnly.ArgStr << " \n " ;
652
+ if (IROutputOnly && ( DoSplit && SplitMode != SPLIT_AUTO) ) {
653
+ errs () << " error: -" << SplitMode.ArgStr << " = " << SplitMode. ValueStr
654
+ << " can't be used with - " << IROutputOnly.ArgStr << " \n " ;
651
655
return 1 ;
652
656
}
653
657
if (IROutputOnly && DoSymGen) {
@@ -679,7 +683,7 @@ int main(int argc, char **argv) {
679
683
KernelMapEntryScope Scope = Scope_Global;
680
684
if (DoSplit) {
681
685
if (SplitMode == SPLIT_AUTO)
682
- Scope = selectDeviceCodeSplitModeAutomatically (*MPtr);
686
+ Scope = selectDeviceCodeSplitScopeAutomatically (*MPtr);
683
687
else
684
688
Scope =
685
689
SplitMode == SPLIT_PER_KERNEL ? Scope_PerKernel : Scope_PerModule;
0 commit comments