[PATCH] D107753: [IRBuilder][NFC] Clarify docs on fadd/fmul reductions

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 9 04:12:41 PDT 2021


frasercrmck created this revision.
frasercrmck added reviewers: aemerson, craig.topper, rengolin, RKSimon.
frasercrmck requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch aims to clear up any confusion in documentation for the
fadd/fmul reduction creation APIs with regards to the sequential and
unordered variations without changing the APIs themselves.

The scalar accumulator value isn't only used for sequential reduction
intrinsics so the impliciation to the contrary was dropped. Then I
thought it useful to make clear that the API always creates a sequential
reduction. And lastly a note to users on how it is possible to transform
the resulting reduction into an unordered one.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107753

Files:
  llvm/include/llvm/IR/IRBuilder.h


Index: llvm/include/llvm/IR/IRBuilder.h
===================================================================
--- llvm/include/llvm/IR/IRBuilder.h
+++ llvm/include/llvm/IR/IRBuilder.h
@@ -697,12 +697,16 @@
       MDNode *TBAAStructTag = nullptr, MDNode *ScopeTag = nullptr,
       MDNode *NoAliasTag = nullptr);
 
-  /// Create a vector fadd reduction intrinsic of the source vector.
-  /// The first parameter is a scalar accumulator value for ordered reductions.
+  /// Create a sequential vector fadd reduction intrinsic of the source vector.
+  /// The first parameter is a scalar accumulator value. An unordered reduction
+  /// can be created by adding the reassoc fast-math flag to the resulting
+  /// sequential reduction.
   CallInst *CreateFAddReduce(Value *Acc, Value *Src);
 
-  /// Create a vector fmul reduction intrinsic of the source vector.
-  /// The first parameter is a scalar accumulator value for ordered reductions.
+  /// Create a sequential vector fmul reduction intrinsic of the source vector.
+  /// The first parameter is a scalar accumulator value. An unordered reduction
+  /// can be created by adding the reassoc fast-math flag to the resulting
+  /// sequential reduction.
   CallInst *CreateFMulReduce(Value *Acc, Value *Src);
 
   /// Create a vector int add reduction intrinsic of the source vector.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107753.365146.patch
Type: text/x-patch
Size: 1335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210809/8d8c45f7/attachment.bin>


More information about the llvm-commits mailing list