Issue 174429
Summary [Support][SLP] Support for fractional InstructionCost
Labels new issue
Assignees bababuck
Reporter bababuck
    When requesting cost information from `TargetTransformInfo` in the vectorizers, particular SLP, we request reciprocal throughput (`TCK_RecipThroughput`). However, `InstructionCost` only supports integer cost amounts, which doesn't align with reciprocal throughput on high performance machines which have a reciprocal throughput of less than 1 for many scalar instructions. As a result, we end up estimating the reciprocal throughput as 1, but this leads to large inaccuracies for large vector instructions. For instance, even if the reciprocal throughput for an add instruction should be `1/4`, we estimate the cost as `1`. So the scalar cost for a 16 element vector is estimated as `1 x 16 = 16`, even though it should be `1/4 x 16 = 4`.

To address this, a couple options could be to:
- Update `InstructionCost` to support fractional values (I threw together a quick implementation of this that I can push if interested.)
- Update `InstructionCost` to be backed by a floating point type
- Update `TargetTransformInfo` cost functions to accept a vector of scalars
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to