gemm_bias
Computes a matrix-matrix product using general integer matrices with bias.
Description
The
gemm_bias
routines compute a scalar-matrix-matrix product and add
the result to a scalar-matrix product, using general integer matrices with biases/offsets.
The operation is defined as:
where:
- op(X) is one of op(X) =X, or op(X) =XT, or op(X) =XH
- alphaandbetaare scalars
- A_offsetismxkmatrix with every element equal to the valueao
- B_offsetiskxnmatrix with every element equal to the valuebo
- A,B, andCare matrices
- op(A) ismxk, op(B) iskxn, andCismxn
gemm_bias
supports the following precisions:Ts | Ta | Tb | Tc |
---|---|---|---|
float | std::uint8_t | std::uint8_t | std::int32_t |
float | std::int8_t | std::uint8_t | std::int32_t |
float | std::uint8_t | std::int8_t | std::int32_t |
float | std::int8_t | std::int8_t | std::int32_t |
gemm_bias (Buffer Version)
Syntax
namespace oneapi::mkl::blas::column_major {
void gemm_bias(sycl::queue &queue,
oneapi::mkl::transpose transa,
oneapi::mkl::transpose transb,
oneapi::mkl::offset offsetc,
std::int64_t m,
std::int64_t n,
std::int64_t k,
Ts alpha,
sycl::buffer<Ta,1> &a,
std::int64_t lda,
Ta ao,
sycl::buffer<Tb,1> &b,
std::int64_t ldb,
Tb bo,
Ts beta,
sycl::buffer<Tc,1> &c,
std::int64_t ldc,
sycl::buffer<Tc,1> &co)
}
namespace oneapi::mkl::blas::row_major {
void gemm_bias(sycl::queue &queue,
oneapi::mkl::transpose transa,
oneapi::mkl::transpose transb,
oneapi::mkl::offset offsetc,
std::int64_t m,
std::int64_t n,
std::int64_t k,
Ts alpha,
sycl::buffer<Ta,1> &a,
std::int64_t lda,
Ta ao,
sycl::buffer<Tb,1> &b,
std::int64_t ldb,
Tb bo,
Ts beta,
sycl::buffer<Tc,1> &c,
std::int64_t ldc,
sycl::buffer<Tc,1> &co)
}
Input Parameters
- queue
- The queue where the routine should be executed.
- transa
- transb
- offsetc
- Specifies the form ofC_offsetused in the matrix multiplication. See Data Types for more details.
- m
- Number of rows of matrix op(A) and matrixC. Must be at least zero.
- n
- Number of columns of matrix op(B) and matrixC. Must be at least zero.
- k
- Number of columns of matrix op(A) and rows of matrix op(B). Must be at least zero.
- alpha
- Scaling factor for matrix-matrix product.
- a
- Buffer holding input matrixA. See Matrix Storage for more details.transa=transpose::nontranstransa=transpose::transortrans=transpose::conjtransColumn majorAismxkmatrix. Size of arrayamust be at leastlda*kAiskxmmatrix. Size of arrayamust be at leastlda*mRow majorAismxkmatrix. Size of arrayamust be at leastlda*mAiskxmmatrix. Size of arrayamust be at leastlda*k
- lda
- Leading dimension of matrixA. Must be positive.transa=transpose::nontranstransa=transpose::transortrans=transpose::conjtransColumn majorMust be at leastmMust be at leastkRow majorMust be at leastkMust be at leastm
- ao
- Specifies the scalar offset value for matrixA.
- b
- Buffer holding input matrixB. See Matrix Storage for more details.transb=transpose::nontranstransb=transpose::transortrans=transpose::conjtransColumn majorBiskxnmatrix. Size of arraybmust be at leastldb*nBisnxkmatrix. Size of arraybmust be at leastldb*kRow majorBiskxnmatrix. Size of arraybmust be at leastldb*kBisnxkmatrix. Size of arraybmust be at leastldb*n
- ldb
- Leading dimension of matrixB. Must be positive.transb=transpose::nontranstransb=transpose::transortrans=transpose::conjtransColumn majorMust be at leastkMust be at leastnRow majorMust be at leastnMust be at leastk
- bo
- Specifies the scalar offset value for matrixB.
- beta
- Scaling factor for matrixC.
- c
- Buffer holding input/output matrixC. See Matrix Storage for more details.Column majorCismxnmatrix. Size of arraycmust be at leastldc*nRow majorCismxnmatrix. Size of arraycmust be at leastldc*m
- ldc
- Leading dimension of matrixC. Must be positive.Column majorMust be at leastmRow majorMust be at leastn
- co
- Buffer holding the offset values for matrixC.Ifoffset_type = offset::fix, size ofcoarray must be at least 1.Ifoffset_type = offset::col, size ofcoarray must be at leastmax(1,m).Ifoffset_type = offset::row, size ofcoarray must be at leastmax(1,n).See Data Types for more details.
Output Parameters
- c
- Output buffer overwritten byalpha* (op(A) -A_offset) * (op(B) -B_offset) +beta*C+C_offset.
If
beta
= 0, matrix C
does not need to be initialized before calling gemm_bias
. gemm_bias (USM Version)
Syntax
namespace oneapi::mkl::blas::column_major {
sycl::event gemm_bias(sycl::queue &queue,
oneapi::mkl::transpose transa,
oneapi::mkl::transpose transb,
oneapi::mkl::offset offsetc,
std::int64_t m,
std::int64_t n,
std::int64_t k,
Ts alpha,
const Ta *a,
std::int64_t lda,
Ta ao,
const Tb *b,
std::int64_t ldb,
Tb bo,
Ts beta,
Tc *c,
std::int64_t ldc,
const Tc *co,
const std::vector<sycl::event> &dependencies = {})
}
namespace oneapi::mkl::blas::row_major {
sycl::event gemm_bias(sycl::queue &queue,
oneapi::mkl::transpose transa,
oneapi::mkl::transpose transb,
oneapi::mkl::offset offsetc,
std::int64_t m,
std::int64_t n,
std::int64_t k,
Ts alpha,
const Ta *a,
std::int64_t lda,
Ta ao,
const Tb *b,
std::int64_t ldb,
Tb bo,
Ts beta,
Tc *c,
std::int64_t ldc,
const Tc *co,
const std::vector<sycl::event> &dependencies = {})
}
Input Parameters
- queue
- The queue where the routine should be executed.
- transa
- transb
- offsetc
- Specifies the form ofC_offsetused in the matrix multiplication. See Data Types for more details.
- m
- Number of rows of matrix op(A) and matrixC. Must be at least zero.
- n
- Number of columns of matrix op(B) and matrixC. Must be at least zero.
- k
- Number of columns of matrix op(A) and rows of matrix op(B). Must be at least zero.
- alpha
- Scaling factor for matrix-matrix product.
- a
- Pointer to input matrixA. See Matrix Storage for more details.transa=transpose::nontranstransa=transpose::transortrans=transpose::conjtransColumn majorAismxkmatrix. Size of arrayamust be at leastlda*kAiskxmmatrix. Size of arrayamust be at leastlda*mRow majorAismxkmatrix. Size of arrayamust be at leastlda*mAiskxmmatrix. Size of arrayamust be at leastlda*k
- lda
- Leading dimension of matrixA. Must be positive.transa=transpose::nontranstransa=transpose::transortrans=transpose::conjtransColumn majorMust be at leastmMust be at leastkRow majorMust be at leastkMust be at leastm
- ao
- Specifies the scalar offset value for matrixA.
- b
- Pointer to input matrixB. See Matrix Storage for more details.transb=transpose::nontranstransb=transpose::transortrans=transpose::conjtransColumn majorBiskxnmatrix. Size of arraybmust be at leastldb*nBisnxkmatrix. Size of arraybmust be at leastldb*kRow majorBiskxnmatrix. Size of arraybmust be at leastldb*kBisnxkmatrix. Size of arraybmust be at leastldb*n
- ldb
- Leading dimension of matrixB. Must be positive.transb=transpose::nontranstransb=transpose::transortrans=transpose::conjtransColumn majorMust be at leastkMust be at leastnRow majorMust be at leastnMust be at leastk
- bo
- Specifies the scalar offset value for matrixB.
- beta
- Scaling factor for matrixC.
- c
- Pointer to input/output matrixC. See Matrix Storage for more details.Column majorCismxnmatrix. Size of arraycmust be at leastldc*nRow majorCismxnmatrix. Size of arraycmust be at leastldc*m
- ldc
- Leading dimension of matrixC. Must be positive.Column majorMust be at leastmRow majorMust be at leastn
- co
- Pointer to array holding offset values for matrixC.Ifoffset_type = offset::fix, size ofcoarray must be at least 1.Ifoffset_type = offset::col, size ofcoarray must be at leastmax(1,m).Ifoffset_type = offset::row, size ofcoarray must be at leastmax(1,n).See Data Types for more details.
- dependencies
- List of events to wait for before starting computation, if any. If omitted, defaults to no dependencies.
Output Parameters
- c
- Pointer to output matrixCoverwritten byalpha* (op(A) -A_offset) * (op(B) -B_offset) +beta*C+C_offset.
If
beta
= 0, matrix C
does not need to be initialized before calling gemm_bias
. Return Values
Output event to wait on to ensure computation is complete.