This is an archive of the discontinued LLVM Phabricator instance.

Move the Target way of overriding DAG Scheduler to a target hook
ClosedPublic

Authored by mehdi_amini on Jul 27 2015, 1:47 PM.

Details

Summary

The previous way of overriding it was relying on calling "setDefault"
on the global registry, which implies global mutable state.

Diff Detail

Event Timeline

mehdi_amini retitled this revision from to Move the Target way of overriding DAG Scheduler to a target hook.
mehdi_amini updated this object.
mehdi_amini added reviewers: echristo, atrick.
mehdi_amini added a subscriber: llvm-commits.
atrick edited edge metadata.Jul 27 2015, 3:43 PM

Thanks for fixing this. I don't know why it was written the way it was. Do you need to add a subtarget hook here though? The idea of this code is for the command line to override the target prefs. There's already a get/seSchedulingPreference hook in TargetLowering that comes into play when the default command line option is used.

It seems that the DAGLinearizer can't be selected by the get/setSchedulingPreference (see ScheduleDAGSDNodes* createDefaultScheduler).

Like if there are two levels:

  1. getDefault was used to select the method to create the scheduler
  2. if the default was not changed (createDefaultScheduler), then a combination of OptLevel, enableMachineScheduler(), and getSchedulingPreference() are used to select one among SourceListDAGScheduler, BURRListDAGScheduler, HybridListDAGScheduler, VLIWDAGScheduler, and ILPListDAGScheduler.
mehdi_amini edited edge metadata.

Update after a discussion with Andy, plays better with command line argument.

(I didn't get originally the purpose of the registry)

Let's see what Eric has to say about including TargetSelectionDAGInfo.h from TargetSubtargetInfo.h. I'm not sure that's the right layering.

Otherwise LGTM. Thanks.

When you push this, please send a note to llvm-dev telling people that their out of tree targets should not use the SchedulerRegistry to select a selection DAG scheduler. They should use your hook. It's not a big deal because we don't want people using SelectionDAG scheduler heuristics anyway, but it is a courtesy.

The out-of-tree targets that are using setDefault() right now will necessarily notice when they won't build anymore since setDefault() is deleted ;)
(but OK I'll send an email)

Remove useless includes (remaining from the first version of the patch)

atrick accepted this revision.Jul 27 2015, 11:06 PM
atrick edited edge metadata.

LGTM. Thanks again.

This revision is now accepted and ready to land.Jul 27 2015, 11:06 PM
mehdi_amini closed this revision.Jul 27 2015, 11:18 PM

landed r243388

echristo edited edge metadata.Jul 28 2015, 8:13 AM

Looks fine to me (realize you've already committed, but you mentioned my name).

-eric