This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Add new SISched policy to reduce register usage
Needs ReviewPublic

Authored by axeldavy on Feb 18 2017, 1:24 PM.

Details

Reviewers
tstellar
arsenm
Summary

See patch for a description of the algorithm.

When the VGPR or SGPR usage reaches a threshold (200 and 70),
the policy is triggered.

I'm open to suggestions for other ways of setting these thresholds.

Diff Detail

Repository
rL LLVM

Event Timeline

axeldavy created this revision.Feb 18 2017, 1:24 PM
axeldavy added a project: Restricted Project.Feb 18 2017, 2:32 PM
axeldavy added a subscriber: llvm-commits.
arsenm added inline comments.Feb 21 2017, 3:58 PM
lib/Target/AMDGPU/SIMachineScheduler.cpp
1526

.count()

1709

I think most of these are candidates for SmallSet/DenseSet etc.

1747

This whole function is long and repetitive. Can you refactor this into something more readable?

1802

Don't need struct or {}

1807

Doing a lot of repeat map lookups. Use the returned iterator of find

2129

This whole part looks like it can be factored into its own debug dump function

axeldavy updated this revision to Diff 90744.Mar 6 2017, 2:19 PM
axeldavy updated this revision to Diff 91786.Mar 14 2017, 3:43 PM

Remove an useless "enum"

axeldavy updated this revision to Diff 92689.Mar 22 2017, 12:52 PM

Use more references.

t-tye added a subscriber: t-tye.Mar 22 2017, 6:38 PM
tony-tye removed a subscriber: tony-tye.Mar 22 2017, 6:48 PM

Sorry but I give up reviewing this. Your code looks like after "inline all" pass. Can you refactor common parts into functions with meaningfull names?

lib/Target/AMDGPU/SIMachineScheduler.cpp
1801

do not need a constructor here, default would do just what you've written

1951

in such cases its better to revert the condition and do a continue rather than having huge indented {}

To ease rebasing, I'll move this patch to after the patch adding support for subreg lane tracking.

lib/Target/AMDGPU/SIMachineScheduler.cpp
1801

DenseMap has only an explicit constructor.
The compiler is very unhappy if I don't define the constructor of the structure, which calls the explicit constructor of the DenseMap.

vpykhtin added inline comments.Mar 31 2017, 3:24 AM
lib/Target/AMDGPU/SIMachineScheduler.cpp
2140

SmallPtrSet is designed for pointer types but used for unsigned type, gcc complains, try consider SmallDenseSet.

arsenm resigned from this revision.Feb 21 2019, 7:01 PM