SparsePartitioner

#include <popsparse/SparsePartitioner.hpp>

Translation and encoding of sparsity information for a fully connected layer.

namespace popsparse

Support for sparse matrices.

namespace dynamic

Support for dynamic sparse matrices.

template<typename T>
class Partitioner
#include <SparsePartitioner.hpp>

Class to translate and encode sparsity information for a fully connected layer.

See createFullyConnectedWeights() for details of the options.

Public Functions

inline const PartitionerImpl &getImpl() const
Partitioner(const FullyConnectedParams &params, const poplar::Type &dataType, const poplar::Target &target, const poplar::OptionFlags &options, PlanningCache *cache = {}, std::string name = "")
Partitioner(const MatMulParams &params, const poplar::Type &dataType, const poplar::Target &target, const poplar::OptionFlags &options, PlanningCache *cache = {}, std::string name = "")
~Partitioner()
SparsityDataImpl<T> createSparsityDataImpl(const CSCMatrix<T> &matrix_) const

Create implementation sparsity representation for a compressed sparse columns (CSC) matrix.

SparsityDataImpl<T> createSparsityDataImpl(const CSRMatrix<T> &matrix_) const

Creates implementation sparsity representation for a compressed sparse rows (CSR) matrix.

SparsityDataImpl<T> createSparsityDataImpl(const COOMatrix<T> &matrix_) const

Creates implementation sparsity representation for a coordinate (COO) format matrix.

COOMatrix<T> sparsityDataImplToCOOMatrix(const SparsityDataImpl<T> &sparsityDataImpl) const

Create a coordinate (COO) representation matrix from implementation sparsity representation.

The COO entries are ordered by row first, and then columns.

CSRMatrix<T> sparsityDataImplToCSRMatrix(const SparsityDataImpl<T> &sparsityDataImpl) const

Create compressed sparse rows (CSR) representation from implementation sparsity representation.

CSCMatrix<T> sparsityDataImplToCSCMatrix(const SparsityDataImpl<T> &sparsityDataImpl) const

Create compressed sparse columns (CSC) representation from implementation sparsity representation.

std::array<std::vector<std::size_t>, 3> getPlanPartitions(void) const

Fetch the partitions in X, Y and Z to reveal the plan.

std::size_t getmetaInfoBucketElements(void) const

Fetch the number of elements in a meta info bucket.

Private Members

std::string name
std::unique_ptr<PartitionerImpl> impl
template<typename T>
struct SparsityDataImpl
#include <SparsePartitioner.hpp>

Encoding of sparsity representation.

Public Members

std::vector<std::size_t> metaInfo

Meta information representing sparsity for each tile.

std::vector<T> nzValues

The non-zero values of the sparse matrix.

namespace static_
template<typename T>
class Partitioner

Public Functions

inline const PartitionerImpl &getImpl() const
Partitioner(const MatMulParams &params, const poplar::Type &dataType, const poplar::Target &target, const poplar::OptionFlags &options, PlanningCache *cache = {}, std::string name = "")

Construct Partitioner for a matrix multiplication.

params The matrix multiplication params. The parameters must be correctly created for the operation. i.e. sparse * dense, or dense * sparse. dataType The imput data type target A reference to the target for which the matmul is created. The target must outlive any use of the class object. options Implementation options for the matrix multiplication. cache Optional pointer to planning cache to use. Must outlive the use of the class object.

~Partitioner()
SparsityDataImpl<T> createSparsityDataImpl(const CSCMatrix<T> &matrix) const

Create implementation sparsity representation for a compressed sparse columns (CSC) matrix.

SparsityDataImpl<T> createSparsityDataImpl(const CSRMatrix<T> &matrix) const

Creates implementation sparsity representation for a compressed sparse rows (CSR) matrix.

SparsityDataImpl<T> createSparsityDataImpl(const COOMatrix<T> &matrix) const

Creates implementation sparsity representation for a coordinate (COO) format matrix.

COOMatrix<T> sparsityDataImplToCOOMatrix(const SparsityDataImpl<T> &sparsityDataImpl) const

Create a coordinate (COO) representation matrix from implementation sparsity representation.

The COO entries are ordered by row first, and then columns.

CSRMatrix<T> sparsityDataImplToCSRMatrix(const SparsityDataImpl<T> &sparsityDataImpl) const

Create compressed sparse rows (CSR) representation from implementation sparsity representation.

CSCMatrix<T> sparsityDataImplToCSCMatrix(const SparsityDataImpl<T> &sparsityDataImpl) const

Create compressed sparse columns (CSC) representation from implementation sparsity representation.

Private Members

std::string name
std::unique_ptr<PartitionerImpl> impl
template<typename T>
struct SparsityDataImpl
#include <SparsePartitioner.hpp>

Encoding of sparsity representation.

Public Functions

inline SparsityDataImpl(std::vector<T> nzValues)

Public Members

std::vector<T> nzValues

The non-zero values of the sparse matrix in an order required by the device compute graph.