6#ifndef POPSPARSE_BLOCK_SPARSE_MATMUL_H
7#define POPSPARSE_BLOCK_SPARSE_MATMUL_H
11#include <poplar/Graph.hpp>
14namespace experimental {
76 const std::array<int, 3> &blockSize,
77 const std::vector<unsigned char> &rhsSparsity,
80 unsigned numGroupsIn = 1);
120 const std::array<int, 3> &blockSize,
121 const std::vector<unsigned char> &resSparsity,
125 unsigned numGroupsIn = 1);
131 std::unique_ptr<BSMatMulImpl> impl;
poplar::Tensor createBSMatMulInputLHS(poplar::Graph &graph, const BSMatMulParams &bsMatMul, const poplar::DebugContext &debugContext, const poplar::OptionFlags &options={})
Create a tensor for use as the left operand of block-sparse matrix multiplication.
poplar::Tensor bsMatMul(poplar::Graph &graph, const BSMatMulParams &bsMatMulParams, poplar::program::Sequence &prog, const poplar::Tensor &lhsMatrix, const poplar::Tensor &rhsMatrix, const poplar::OptionFlags &options={}, const poplar::DebugContext &debugContext={})
This function multiplies the left-hand matrix by the right-hand matrix.
poplar::Tensor createBSMatMulInputRHS(poplar::Graph &graph, const BSMatMulParams &bsMatMul, const poplar::DebugContext &debugContext, const poplar::OptionFlags &options={})
Create a tensor for use as the right operand of block-sparse matrix multiplication.
SubBlockMask
Define the sparsity mask inside a block.
Definition: BlockSparse.hpp:26
DebugContext gathers the common external parameters of the context of an operation.
Definition: DebugContext.hpp:221
This class represents a graph program to be executed on the IPU.
Definition: Graph.hpp:52
A set of option/value string flags to be used in various APIs.
Definition: OptionFlags.hpp:24
A reference to a subset of tensor elements.
Definition: Tensor.hpp:38
Class representing device data types.
Definition: Type.hpp:42
Program that executes a sequence of programs.
Definition: Program.hpp:77
This class supports block-sparse matrix multiplication.
Definition: BlockSparseMatMul.hpp:30
BSMatMulParams(const std::array< int, 3 > &dim, const std::array< int, 3 > &blockSize, const std::vector< unsigned char > &resSparsity, poplar::Type inDataType, poplar::Type outDataType, poplar::Type partialDataType, SubBlockMask subBlockMask=SubBlockMask::None, unsigned numGroupsIn=1)
This constructor is for a dense matrix multiplying a dense matrix.
BSMatMulParams(const std::array< int, 3 > &dim, const std::array< int, 3 > &blockSize, const std::vector< unsigned char > &rhsSparsity, bool rhsNeedTranspose, poplar::Type inDataType, poplar::Type outDataType, poplar::Type partialDataType, unsigned numGroupsIn=1)
This constructor is for a dense matrix (left side) multiplying a sparse matrix (right side).
Support for sparse matrices.
Definition: codelets.hpp:8