|
BeBOP Optimized Sparse Kernel Interface Library
1.0.1h
|
Conversion between CSR and SPARSITY-style BCSR (i.e., register blocking) format. More...
#include <assert.h>#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <oski/config.h>#include <oski/common.h>#include <oski/modloader.h>#include <oski/matrix.h>#include <oski/CSR/format.h>#include <oski/CSR/module.h>#include <oski/BCSR/format.h>#include <oski/BCSR/module.h>#include <oski/xforms_internal.h>Functions | |
| static int | ConvertFullBlocksFromCSR (const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_index_t base, oski_index_t m, oski_index_t n, oski_index_t r, oski_index_t c, oski_index_t **p_bptr, oski_index_t **p_bind, oski_value_t **p_bval) |
Given an CSR matrix , convert the first rows into BCSR format. | |
| static int | ConvertFromCSR (oski_matBCSR_t *A, oski_index_t r, oski_index_t c, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_index_t m, oski_index_t n, oski_index_t base) |
| Convert from full CSR to BCSR. | |
| static int | ExpandSymm (const oski_matCSR_t *mat, const oski_matcommon_t *props, oski_matCSR_t **p_mat_full) |
| void * | oski_CreateMatReprFromCSR (const oski_matCSR_t *mat, const oski_matcommon_t *props,...) |
| Method: Instantiate from an existing CSR representation. | |
| static void | CopyOne (const oski_matBCSR_t *A, oski_matCSR_t *B, oski_index_t i0) |
| static int | ConvertToCSR (const oski_matBCSR_t *A, const oski_matcommon_t *props, oski_matCSR_t *B) |
| oski_matCSR_t * | oski_ConvertMatReprToCSR (const void *mat, const oski_matcommon_t *props) |
| Method: Convert to CSR format. | |
| void * | oski_CopyMatRepr (const void *mat, const oski_matcommon_t *props) |
| Method: Duplicate a matrix representation. | |
| void | oski_DestroyMatRepr (void *mat) |
| Method: Destroy matrix type-specific representation. | |
| int | oski_CreateLuaMatReprFromCSR (lua_State *L) |
| The BCSR implementation expects the following arguments on the stack: | |
Conversion between CSR and SPARSITY-style BCSR (i.e., register blocking) format.
| static int ConvertFromCSR | ( | oski_matBCSR_t * | A, |
| oski_index_t | r, | ||
| oski_index_t | c, | ||
| const oski_index_t * | ptr, | ||
| const oski_index_t * | ind, | ||
| const oski_value_t * | val, | ||
| oski_index_t | m, | ||
| oski_index_t | n, | ||
| oski_index_t | base | ||
| ) | [static] |
Convert from full CSR to BCSR.
References tagBebop_matBCSR_t::bind, tagBebop_matBCSR_t::bptr, tagBebop_matBCSR_t::bval, tagBebop_matBCSR_t::col_block_size, ConvertFullBlocksFromCSR(), ERR_OUT_OF_MEMORY, INT_CEIL_DIV, tagBebop_matBCSR_t::leftover, tagBebop_matBCSR_t::num_block_cols, tagBebop_matBCSR_t::num_block_rows, tagBebop_matBCSR_t::num_rows_leftover, OSKI_ERR, oski_Free, oski_Malloc, and tagBebop_matBCSR_t::row_block_size.
Referenced by oski_CreateMatReprFromCSR().
| static int ConvertFullBlocksFromCSR | ( | const oski_index_t * | ptr, |
| const oski_index_t * | ind, | ||
| const oski_value_t * | val, | ||
| oski_index_t | base, | ||
| oski_index_t | m, | ||
| oski_index_t | n, | ||
| oski_index_t | r, | ||
| oski_index_t | c, | ||
| oski_index_t ** | p_bptr, | ||
| oski_index_t ** | p_bind, | ||
| oski_value_t ** | p_bval | ||
| ) | [static] |
Given an
CSR matrix
, convert the first
rows into
BCSR format.
If the converted matrix has
blocks, this implementation executes in
time, but requires
auxiliary storage space to store a dense copy of one block row.
This long procedure is divided into two phases:
This routine assumes the CSR matrix uses full storage, but otherwise is flexible with regard to the following variations:
| [in] | ptr | CSR row pointers. |
| [in] | ind | CSR column indices. |
| [in] | val | CSR explicitly stored values. |
| [in] | base | Index base (0-based or 1-based) |
| [in] | m | Logical number of matrix rows |
| [in] | n | Logical number of matrix columns |
| [in] | r | Desired row block size |
| [in] | c | Desired column block size |
| [in,out] | p_bptr | Used to return the BCSR block row pointers. Must not equal NULL. |
| [in,out] | p_bind | Used to return the BCSR block column indices. Must not equal NULL. |
| [in,out] | p_bval | Used to return the explicitly stored blocks. Must not equal NULL. |
References ERR_BAD_ARG, ERR_OUT_OF_MEMORY, oski_CopyMem, oski_Free, oski_FreeAll(), oski_Malloc, oski_MultiMalloc(), oski_ZeroMem(), VAL_ASSIGN, and VAL_INC.
Referenced by ConvertFromCSR().
| int oski_CreateLuaMatReprFromCSR | ( | lua_State * | L | ) |
The BCSR implementation expects the following arguments on the stack:
Matrix-type specific method to convert from a CSR matrix, with arguments passed on the Lua stack.
1.7.6.1