[llvm] [CodeGen][MISched] Handle empty sized resource usage. (PR #75951)

Francesco Petrogalli via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 07:56:39 PST 2024


fpetrogalli wrote:

> > It seems to me that, if a resource is required to be available, it means that the instruction needs to use it? Why not just mark it for at least 1 cycle usage?
> 
> Hi @fpetrogalli I have just run spec2006 comparing scheduler that uses `ReleaseAtCycle = [0]` scheduler that uses `sed ReleaseAtCycle = [0]/ReleaseAtCycle = [1]` on one of our downstream scheduler model. Unfortunately I am seeing significant regressions on spec2006 with the change. I am also skeptical about making this chance since it will force all other scheduler models that use this to retune their model.
> 

I am not surprised by this result. You are marking that cycle as using the resource, therefore there are less empty spaces that can be filled. 

It is clear that specifying a resource that have zero usage has a meaning in the scheduler, and this information is used to produce better schedules. I do not know where this logic is in the scheduler, I just find it wrong that such logic is taken all the way down to the resource tracking algorithm, because there is nothing (no interval) to track.

> As a result, I am in favor of this patch instead of a patch that imposes a `ReleaseAtCycle > 0` requirement. WDYT?

Yeah, restructuring the way the "resource used for 0 cycles" is used in the scheduler seems to be a piece of major rework, which is likely not to be worth the effort. At the end of the day, scheduling is not an exact science :)

However, please;

1. add a comment explaining that adding a 0-cycle resource does not make much sense in the resource segment, and the it is there just to fulfil some extra logic of the scheduler
2. please take care of the extra `|| CutOff == 0` condition, as I think it is not necessary (I might be wrong)

https://github.com/llvm/llvm-project/pull/75951


More information about the llvm-commits mailing list