(git:e7e05ae)
dbm_multiply.c File Reference
#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include "../offload/offload_runtime.h"
#include "dbm_hyperparams.h"
#include "dbm_library.h"
#include "dbm_multiply.h"
#include "dbm_multiply_comm.h"
#include "dbm_multiply_cpu.h"
#include "dbm_multiply_gpu.h"
#include "dbm_multiply_internal.h"

Go to the source code of this file.

Data Structures

struct  backend_context_t
 Private struct for storing the context of the multiplication backend. More...
 

Functions

static int imax (int x, int y)
 Returns the larger of two given integer (missing from the C standard). More...
 
static void min_max (int result[2], int value)
 Updates the min/max of a range of values (initially {INT_MAX, 0}). More...
 
static float * compute_rows_max_eps (const bool trans, const dbm_matrix_t *matrix, const double filter_eps)
 Private routine for computing the max filter threshold for each row. More...
 
static backend_context_tbackend_start (const dbm_matrix_t *matrix_c)
 Private routine for intializing the multiplication backend. More...
 
static void backend_upload_packs (const dbm_pack_t *pack_a, const dbm_pack_t *pack_b, backend_context_t *ctx)
 Private routine for handing newly arrived packs to the backend. More...
 
static void backend_process_batch (const int ntasks, dbm_task_t batch[ntasks], const int mnk_range[3][2], const double alpha, const dbm_pack_t *pack_a, const dbm_pack_t *pack_b, const int kshard, dbm_shard_t *shard_c, backend_context_t *ctx)
 Private routine for sending a batch to the multiplication backend. More...
 
static void backend_download_results (backend_context_t *ctx)
 Private routine for downloading results of the multiplication backend. More...
 
static void backend_stop (backend_context_t *ctx)
 Private routine for shutting down the multiplication backend. More...
 
static void multiply_packs (const bool transa, const bool transb, const double alpha, const dbm_pack_t *pack_a, const dbm_pack_t *pack_b, const dbm_matrix_t *matrix_a, const dbm_matrix_t *matrix_b, dbm_matrix_t *matrix_c, const bool retain_sparsity, const float *rows_max_eps, int64_t *flop, backend_context_t *ctx)
 Private routine for multipling two packs. More...
 
void dbm_multiply (const bool transa, const bool transb, const double alpha, const dbm_matrix_t *matrix_a, const dbm_matrix_t *matrix_b, const double beta, dbm_matrix_t *matrix_c, const bool retain_sparsity, const double filter_eps, int64_t *flop)
 Performs a multiplication of two dbm_matrix_t matrices. See dbm_matrix.h for details. More...
 

Function Documentation

◆ imax()

static int imax ( int  x,
int  y 
)
inlinestatic

Returns the larger of two given integer (missing from the C standard).

Author
Ole Schuett

Definition at line 26 of file dbm_multiply.c.

Here is the caller graph for this function:

◆ min_max()

static void min_max ( int  result[2],
int  value 
)
inlinestatic

Updates the min/max of a range of values (initially {INT_MAX, 0}).

Author
Hans Pabst

Definition at line 32 of file dbm_multiply.c.

◆ compute_rows_max_eps()

static float* compute_rows_max_eps ( const bool  trans,
const dbm_matrix_t matrix,
const double  filter_eps 
)
static

Private routine for computing the max filter threshold for each row.

Author
Ole Schuett

Definition at line 45 of file dbm_multiply.c.

Here is the call graph for this function:

◆ backend_start()

static backend_context_t* backend_start ( const dbm_matrix_t matrix_c)
static

Private routine for intializing the multiplication backend.

Author
Ole Schuett

Definition at line 92 of file dbm_multiply.c.

Here is the call graph for this function:

◆ backend_upload_packs()

static void backend_upload_packs ( const dbm_pack_t pack_a,
const dbm_pack_t pack_b,
backend_context_t ctx 
)
static

Private routine for handing newly arrived packs to the backend.

Author
Ole Schuett

Definition at line 109 of file dbm_multiply.c.

◆ backend_process_batch()

static void backend_process_batch ( const int  ntasks,
dbm_task_t  batch[ntasks],
const int  mnk_range[3][2],
const double  alpha,
const dbm_pack_t pack_a,
const dbm_pack_t pack_b,
const int  kshard,
dbm_shard_t shard_c,
backend_context_t ctx 
)
static

Private routine for sending a batch to the multiplication backend.

Author
Ole Schuett

Definition at line 126 of file dbm_multiply.c.

◆ backend_download_results()

static void backend_download_results ( backend_context_t ctx)
static

Private routine for downloading results of the multiplication backend.

Author
Ole Schuett

Definition at line 150 of file dbm_multiply.c.

◆ backend_stop()

static void backend_stop ( backend_context_t ctx)
static

Private routine for shutting down the multiplication backend.

Author
Ole Schuett

Definition at line 162 of file dbm_multiply.c.

◆ multiply_packs()

static void multiply_packs ( const bool  transa,
const bool  transb,
const double  alpha,
const dbm_pack_t pack_a,
const dbm_pack_t pack_b,
const dbm_matrix_t matrix_a,
const dbm_matrix_t matrix_b,
dbm_matrix_t matrix_c,
const bool  retain_sparsity,
const float *  rows_max_eps,
int64_t *  flop,
backend_context_t ctx 
)
static

Private routine for multipling two packs.

Author
Ole Schuett

Definition at line 173 of file dbm_multiply.c.

◆ dbm_multiply()

void dbm_multiply ( const bool  transa,
const bool  transb,
const double  alpha,
const dbm_matrix_t matrix_a,
const dbm_matrix_t matrix_b,
const double  beta,
dbm_matrix_t matrix_c,
const bool  retain_sparsity,
const double  filter_eps,
int64_t *  flop 
)

Performs a multiplication of two dbm_matrix_t matrices. See dbm_matrix.h for details.

Performs a multiplication of two dbm_matrix_t matrices, as C := alpha * op( A ) * op( B ) + beta * C.

Author
Ole Schuett

Definition at line 324 of file dbm_multiply.c.