Skip to content

Commit 1594632

Browse files
committed
[Matrix][IR] Cap stride bitwidth at 64
1 parent a42546e commit 1594632

File tree

5 files changed

+38
-346
lines changed

5 files changed

+38
-346
lines changed

llvm/docs/LangRef.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21062,11 +21062,12 @@ integer element type.
2106221062

2106321063
Syntax:
2106421064
"""""""
21065-
This is an overloaded intrinsic.
21065+
This is an overloaded intrinsic. You can use ``llvm.matrix.column.major.load``
21066+
to load any vector type with a stride of any bitwidth up to 64.
2106621067

2106721068
::
2106821069

21069-
declare vectorty @llvm.matrix.column.major.load.*(
21070+
declare <4 x i32> @llvm.matrix.column.major.load.v4i32.i64(
2107021071
ptrty %Ptr, i64 %Stride, i1 <IsVolatile>, i32 <Rows>, i32 <Cols>)
2107121072

2107221073
Overview:
@@ -21086,9 +21087,9 @@ Arguments:
2108621087

2108721088
The first argument ``%Ptr`` is a pointer type to the returned vector type, and
2108821089
corresponds to the start address to load from. The second argument ``%Stride``
21089-
is a positive, constant integer with ``%Stride >= <Rows>``. ``%Stride`` is used
21090-
to compute the column memory addresses. I.e., for a column ``C``, its start
21091-
memory addresses is calculated with ``%Ptr + C * %Stride``. The third Argument
21090+
is a positive integer for which ``%Stride >= <Rows>``. ``%Stride`` is used to
21091+
compute the column memory addresses. I.e., for a column ``C``, its start memory
21092+
addresses is calculated with ``%Ptr + C * %Stride``. The third Argument
2109221093
``<IsVolatile>`` is a boolean value. The fourth and fifth arguments,
2109321094
``<Rows>`` and ``<Cols>``, correspond to the number of rows and columns,
2109421095
respectively, and must be positive, constant integers. The returned vector must
@@ -21103,11 +21104,14 @@ The :ref:`align <attr_align>` parameter attribute can be provided for the
2110321104

2110421105
Syntax:
2110521106
"""""""
21107+
This is an overloaded intrinsic. ``llvm.matrix.column.major.store`` to store
21108+
any vector type with a stride of any bitwidth up to 64.
2110621109

2110721110
::
2110821111

21109-
declare void @llvm.matrix.column.major.store.*(
21110-
vectorty %In, ptrty %Ptr, i64 %Stride, i1 <IsVolatile>, i32 <Rows>, i32 <Cols>)
21112+
declare void @llvm.matrix.column.major.store.v4i32.i64(
21113+
<4 x i32> %In, ptrty %Ptr, i64 %Stride, i1 <IsVolatile>, i32 <Rows>,
21114+
i32 <Cols>)
2111121115

2111221116
Overview:
2111321117
"""""""""
@@ -21127,7 +21131,7 @@ Arguments:
2112721131
The first argument ``%In`` is a vector that corresponds to a ``<Rows> x
2112821132
<Cols>`` matrix to be stored to memory. The second argument ``%Ptr`` is a
2112921133
pointer to the vector type of ``%In``, and is the start address of the matrix
21130-
in memory. The third argument ``%Stride`` is a positive, constant integer with
21134+
in memory. The third argument ``%Stride`` is a positive, integer for which
2113121135
``%Stride >= <Rows>``. ``%Stride`` is used to compute the column memory
2113221136
addresses. I.e., for a column ``C``, its start memory addresses is calculated
2113321137
with ``%Ptr + C * %Stride``. The fourth argument ``<IsVolatile>`` is a boolean

llvm/lib/IR/Verifier.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6479,9 +6479,12 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
64796479
NumRows->getZExtValue() * NumColumns->getZExtValue(),
64806480
"Result of a matrix operation does not fit in the returned vector!");
64816481

6482-
if (Stride)
6482+
if (Stride) {
6483+
Check(Stride->getBitWidth() <= 64, "Stride bitwidth cannot exceed 64!",
6484+
IF);
64836485
Check(Stride->getZExtValue() >= NumRows->getZExtValue(),
64846486
"Stride must be greater or equal than the number of rows!", IF);
6487+
}
64856488

64866489
break;
64876490
}

0 commit comments

Comments
 (0)