[llvm] [LoopVectorizer] Add support for partial reductions (PR #92418)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 05:24:04 PST 2024


================
@@ -210,6 +211,17 @@ typedef TargetTransformInfo TTI;
 /// for IR-level transformations.
 class TargetTransformInfo {
 public:
+  enum PartialReductionExtendKind { PR_None, PR_SignExtend, PR_ZeroExtend };
+
+  static PartialReductionExtendKind
+  getPartialReductionExtendKind(Instruction *I) {
----------------
huntergr-arm wrote:

You can move the definition to `TargetTransformInfo.cpp`, or make it a part of the per-target `TargetTransformInfo::Concept` in case we want to use this as a cheap method of rejecting certain extensions for a given target. (e.g. if we extend it to support fp converts in future, maybe some targets only support integer and return an Unsupported extend kind to stop processing quickly).

The former approach is probably easier to land for now, but we will want to find ways of reducing overhead in checking.

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


More information about the llvm-commits mailing list