This is an archive of the discontinued LLVM Phabricator instance.

[misched] Extend scheduler to handle unsupported features
ClosedPublic

Authored by sdardis on May 23 2016, 6:31 AM.

Details

Reviewers
MatzeB
Summary

Currently isComplete = 1 requires that every instruction must
be described, declared unsupported or marked as having no
scheduling information for a processor.

For some backends such as MIPS, this requirement entails
long regex lists of instructions that are unsupported.

This patch teaches Tablegen to skip over instructions that
are associated with unsupported feature when checking if the
scheduling model is complete.

Patch by Daniel Sanders

Modification for checking for the existence of the predicate
done by myself.

Diff Detail

Event Timeline

sdardis updated this revision to Diff 58089.May 23 2016, 6:31 AM
sdardis retitled this revision from to [misched] Extend scheduler to handle unsupported features.
sdardis updated this object.
sdardis set the repository for this revision to rL LLVM.
sdardis added subscribers: dsanders, llvm-commits.
sdardis added a subscriber: atrick.Jun 6 2016, 5:06 AM

Andy, would you be able to take a look at this or suggest someone who could?

Thanks,
Simon

This seems like a useful thing to have, but I have some comments.

include/llvm/Target/TargetSchedule.td
425

Needs a comment describing what this class is for.

426

What exactly is Predicates? The name 'Predicates' and the comment for UnsupportedFeaturesDefs which says "unsupported feature combinations" suggests a list of some kind, but isUnsupported looks through each element of the Predicates list of an instruction and compares its name against this Predicates string, which would mean that Predicates is actually just a single predicate name, and collectProcUnsupportedFeatures also looks like it expects it to be a single predicate name.

Either way, perhaps also change to a list<Predicate> or Predicate (depending on if this is meant to be a list or not) instead of a string, as that way you can remove the code in collectProcUnsupportedFeatures that checks if it's a predicate that exists.

Matthias investigated this very recently, I think he should make a decision on the patch.

MatzeB edited edge metadata.Jun 16 2016, 3:12 PM

This is a nice addition.

As John Brawn already said the additions to TargetSchedule.td need to be better documented (describe the behaviour and ideally also show a short example). Why wasn't this added as a list<Predicate> UnsupportedPredicates; field to SchedMachineModel? Defining unrelated UnsupportedFeatures entities with a string seems odd.

lib/CodeGen/TargetSchedule.cpp
215 ↗(On Diff #58089)

Just commit this unrelated trivial change independently of this patch/review.

utils/TableGen/CodeGenSchedule.cpp
842–844

You can use a range based for here.

sdardis updated this revision to Diff 61538.Jun 22 2016, 6:18 AM
sdardis edited edge metadata.
sdardis removed rL LLVM as the repository for this revision.

Added documentation.
Reworked UnsupportedFeature class into a list of predicates as a member of SchedMachineModel. This massively simplified collectProcUnsupportedFeatures().
Added a note to checkCompleteness() for this feature.

MatzeB accepted this revision.Jun 22 2016, 10:56 AM
MatzeB edited edge metadata.

Thanks, LGTM

This revision is now accepted and ready to land.Jun 22 2016, 10:56 AM
sdardis closed this revision.Jun 23 2016, 2:29 AM

Thanks for the review, committed as rL273551.