24#ifndef TVM_TOPI_CONTRIB_CUBLAS_H_
25#define TVM_TOPI_CONTRIB_CUBLAS_H_
35using namespace topi::detail;
47 auto n = transa ? lhs->shape[1] : lhs->shape[0];
48 auto m = transb ? rhs->shape[0] : rhs->shape[1];
51 {{n, m}}, {lhs->GetDataType()}, {lhs, rhs},
52 [&](ffi::Array<TensorVar> ins, ffi::Array<TensorVar> outs) {
53 return call_packed({
StringImm(
"tvm.contrib.cublas.matmul"), pack_buffer(ins[0]),
54 pack_buffer(ins[1]), pack_buffer(outs[0]),
IntImm::Int32(transa),
72 auto b = lhs->shape[0];
73 auto n = transa ? lhs->shape[2] : lhs->shape[1];
74 auto m = transb ? rhs->shape[1] : rhs->shape[2];
77 {{b, n, m}}, {lhs->GetDataType()}, {lhs, rhs},
78 [&](ffi::Array<TensorVar> ins, ffi::Array<TensorVar> outs) {
79 return call_packed({
StringImm(
"tvm.contrib.cublas.batch_matmul"), pack_buffer(ins[0]),
80 pack_buffer(ins[1]), pack_buffer(outs[0]),
IntImm::Int32(transa),
static IntImm Int32(ffi::BigInt value, Location loc=UnknownLoc())
Construct a scalar int32 constant.
Definition expr.h:181
Managed reference to a string literal.
Definition expr.h:99
Tensor structure representing a possible input, or intermediate computation result.
Definition tensor.h:111
Helpers for using external functions.
Tensor expression language DSL.
Definition extracted_task.h:33
Tensor cublas_matmul(const Tensor &lhs, const Tensor &rhs, bool transa, bool transb)
Create an op that multiplies lhs and rhs with cuBLAS.
Definition cublas.h:46
Tensor cublas_batch_matmul(const Tensor &lhs, const Tensor &rhs, bool transa, bool transb)
Create an op that multiplies batch matrices lhs and rhs with cuBLAS.
Definition cublas.h:71
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23
Operation node can generate one or multiple Tensors.