24 #ifndef TVM_TOPI_CONTRIB_CUBLAS_H_
25 #define TVM_TOPI_CONTRIB_CUBLAS_H_
35 using 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<Buffer> ins, ffi::Array<Buffer> 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<Buffer> ins, ffi::Array<Buffer> 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(int64_t value, Span span=Span())
Construct a scalar int32 constant.
Definition: expr.h:402
Tensor structure representing a possible input, or intermediate computation result.
Definition: tensor.h:100
Managed reference to StringImmNode.
Definition: expr.h:69
Helpers for using external functions.
Tensor expression language DSL.
Definition: extracted_task.h:32
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: analyzer.h:40
Operation node can generate one or multiple Tensors.