[llvm] aef3992 - [IRBuilder][NFC] Clarify docs on fadd/fmul reductions

Fraser Cormack via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 10 02:48:10 PDT 2021


Author: Fraser Cormack
Date: 2021-08-10T10:38:40+01:00
New Revision: aef39925214c1212ca28e0ea7893cd5f82fafab7

URL: https://github.com/llvm/llvm-project/commit/aef39925214c1212ca28e0ea7893cd5f82fafab7
DIFF: https://github.com/llvm/llvm-project/commit/aef39925214c1212ca28e0ea7893cd5f82fafab7.diff

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

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.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D107753

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 8998ad0f94a9..8f57d47eda89 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -697,12 +697,16 @@ class IRBuilderBase {
       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.


        


More information about the llvm-commits mailing list