[llvm] 90e2919 - [LangRef] Fix description of shape args for matrix.multiply.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 03:26:14 PDT 2020


Author: Braedy Kuzma
Date: 2020-06-03T11:25:44+01:00
New Revision: 90e291912ac7e3caf9251969a5c47310c6aa01ff

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

LOG: [LangRef] Fix description of shape args for matrix.multiply.

Currently all code instances within the matrix lowering pass consider
matrix A to be MxN and B to be NxK, producing C which is MxK. Anyone
interacting with this API after reading the docs but without reading the pass
would expect A: MxK, B: KxN, and C: MxN. These changes bring the documentation
in line with the implementation.

One point of concern with this, the original signature as described in the docs
may be better or at least more expected. The interface as it was written
reflected other common matrix multiplication interfaces such as BLAS'[1], where
the matrices are MxK, KxN, MxN respectively. Choosing to honor this requires
changing code and tests instead, but should be mostly just renaming of variables.

Patch by Braedy Kuzma <braedy at ualberta.ca>

[1] http://www.netlib.org/lapack/explore-html/db/dc9/group__single__blas__level3_gafe51bacb54592ff5de056acabd83c260.html#gafe51bacb54592ff5de056acabd83c260

Reviewers: anemet, LuoYuanke, nicolasvasilache, fhahn

Reviewed By: fhahn

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

Added: 
    

Modified: 
    llvm/docs/LangRef.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index db19c649c2fc..5ffe8260c42e 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -15402,21 +15402,23 @@ Syntax:
 
 ::
 
-      declare vectorty @llvm.matrix.multiply.*(vectorty %A, vectorty %B, i32 <M>, i32 <N>, i32 <K>)
+      declare vectorty @llvm.matrix.multiply.*(vectorty %A, vectorty %B, i32 <OuterRows>, i32 <Inner>, i32 <OuterColumns>)
 
 Overview:
 """""""""
 
-The '``llvm.matrix.multiply.*``' intrinsic treats %A as matrix with <M> rows and <K> columns, %B as
-matrix with <K> rows and <N> columns and multiplies them. The result matrix is returned embedded in the
+The '``llvm.matrix.multiply.*``' intrinsic treats %A as a matrix with <OuterRows>
+rows and <Inner> columns, %B as a matrix with <Inner> rows and <OuterColumns>
+columns and multiplies them. The result matrix is returned embedded in the
 result vector.
 
 Arguments:
 """"""""""
 
-The <M>, <N> and <K> arguments must be constant integers.  The vector argument %A
-must have <M> * <K> elements, %B must have <K> * <N> elements and the returned
-vector must have <M> * <N> elements.
+The <OuterRows>, <Inner> and <OuterColumns> arguments must be constant
+integers. The vector argument %A must have <OuterRows> * <Inner> elements, %B
+must have <Inner> * <OuterColumns> elements and the returned vector must have
+<OuterRows> * <OuterColumns> elements.
 
 
 '``llvm.matrix.columnwise.load.*``' Intrinsic


        


More information about the llvm-commits mailing list