[PATCH] D146198: [RISCV] Make ResourceCycles relevant to LMUL
Wang Pengcheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 19 23:33:51 PDT 2023
pcwang-thead added a comment.
In D146198#4202168 <https://reviews.llvm.org/D146198#4202168>, @michaelmaitland wrote:
>> If there are some microarchitectures that can't be modeled, just add a new subroutine to upstream if approved.
>
> Does this mean that subtarget routines must be added to the RISCVScheduleV file since the following function needs to know about the custom subroutine to do its isa checks:
>
> // Helper class for generating a list of resource cycles of different LMULs.
> class ResourceCycles<list<ResourceCycle> resourceCycles, string mx> {
>
> I am concerned that the `RISCVScheduleV` file will take on bloat due to holding subtarget related routines if this is the case.
Yes. So I posted this patch here just to discuss how we should handle this.
For example, solutions may be:
1. Add routines to `RISCVScheduleV.td` just as what I have done.
2. Extend `TableGen` to support pass functions:
// Supposes that we have a Function class to present a function object that its parameters are function parameters.
class TargetSubroutine<int base, string mx> : Function;
// Then. Supposes that we have a new bang operator to apply this function to input parameters and the result is `ret`.
class ResourceCycles<list<TargetSubroutine> subroutines, int base, string mx> {
list<int> value = !foreach(subroutine, subroutines,
!apply(subroutine, base, mx)
);
}
// In SchedXXX.td, we can define our own routines.
class Multiplier<int base, string mx>:TargetSubroutine {
// We return an int value calculated from mx.
int ret = !mul(base, multiplier<mx>.value);
}
3. Some templates are flexible to specify cycles according to LMULs (I haven't figured out one...).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146198/new/
https://reviews.llvm.org/D146198
More information about the llvm-commits
mailing list