[PATCH] D88525: BPF: use Source instead of ILP scheduler for selection dag

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 14:30:00 PDT 2020


yonghong-song added a comment.

In D88525#2304656 <https://reviews.llvm.org/D88525#2304656>, @ast wrote:

> looks like x86 64-bit is ILP, so it's not niche. 
> Looks like Source gets the least amount of testing (judging by archs that use it).
> RegPressure is probably 2nd most used after ILP.
> It feels that we should fix it inside ILP instead.

The default for x86 is Source.  See

  ScheduleDAGSDNodes* createDefaultScheduler(SelectionDAGISel *IS,
                                             CodeGenOpt::Level OptLevel) {
    const TargetLowering *TLI = IS->TLI;
    const TargetSubtargetInfo &ST = IS->MF->getSubtarget();
  
    // Try first to see if the Target has its own way of selecting a scheduler
    if (auto *SchedulerCtor = ST.getDAGScheduler(OptLevel)) {
      return SchedulerCtor(IS, OptLevel);
    }
    
    if (OptLevel == CodeGenOpt::None ||
        (ST.enableMachineScheduler() && ST.enableMachineSchedDefaultSched()) ||
        TLI->getSchedulingPreference() == Sched::Source)
      return createSourceListDAGScheduler(IS, OptLevel);
    if (TLI->getSchedulingPreference() == Sched::RegPressure)
      return createBURRListDAGScheduler(IS, OptLevel);
    if (TLI->getSchedulingPreference() == Sched::Hybrid)
      return createHybridListDAGScheduler(IS, OptLevel);
    if (TLI->getSchedulingPreference() == Sched::VLIW)
      return createVLIWDAGScheduler(IS, OptLevel);
    assert(TLI->getSchedulingPreference() == Sched::ILP &&
           "Unknown sched type!");
    return createILPListDAGScheduler(IS, OptLevel);
  }

If ST.enableMachineScheduler() && ST.enableMachineSchedDefaultSched()
is true, it does not matter whether what target specifies SchedulingPreference,
it will use Source. For x86, it has enableMachineScheduler() and somehow
enableMachineSchedDefaultSched() is true, hence Source...

But this is only the default Subtarget scheduler, it is possible other
subtarget may use different schedulers, e.g., ILP.

Anyway, there is a discussion in https://bugs.llvm.org/show_bug.cgi?id=47591.
Possibly there is a real bug in selection dag. It would be the best the bug can
be fixed there.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88525/new/

https://reviews.llvm.org/D88525



More information about the llvm-commits mailing list