Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement "sandwich product" matrix operations #798

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frame/1m/bli_l1m_ker_ft.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ typedef void (*PASTECH(opname,_ker_ft)) \

GENTDEF( packm )
GENTDEF( packm_cxk )
GENTDEF( packmd_cxk )
GENTDEF( unpackm_cxk )
GENTDEF( packm_cxc_diag )

Expand Down
15 changes: 15 additions & 0 deletions frame/1m/bli_l1m_ker_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@
void* p, inc_t ldp, \
const void* params \

#define packmd_cxk_params \
\
conj_t conja, \
pack_t schema, \
dim_t cdim, \
dim_t cdim_max, \
dim_t cdim_bcast, \
dim_t n, \
dim_t n_max, \
const void* kappa, \
const void* a, inc_t inca, inc_t lda, \
const void* d, inc_t incd, \
void* p, inc_t ldp, \
const void* params \


// unpackm_cxk kernel

Expand Down
1 change: 1 addition & 0 deletions frame/1m/bli_l1m_ker_prot.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void PASTEMAC(chx,chy,funcname) \
#define PACKM_DIAG_KER_PROT( ctype, ch, fn ) L1MTPROT( ctype, ch, fn, packm_cxc_diag );

#define PACKM_KER_PROT2( ctypex, ctypey, chx, chy, fn ) L1MTPROT2( ctypex, ctypey, chx, chy, fn, packm_cxk );
#define PACKMD_KER_PROT2( ctypex, ctypey, chx, chy, fn ) L1MTPROT2( ctypex, ctypey, chx, chy, fn, packmd_cxk );
#define UNPACKM_KER_PROT2( ctypex, ctypey, chx, chy, fn ) L1MTPROT2( ctypex, ctypey, chx, chy, fn, unpackm_cxk );
#define PACKM_DIAG_KER_PROT2( ctypex, ctypey, chx, chy, fn ) L1MTPROT2( ctypex, ctypey, chx, chy, fn, packm_cxc_diag );

Expand Down
1 change: 1 addition & 0 deletions frame/1m/packm/bli_packm.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "bli_packm_scalar.h"

#include "bli_packm_struc_cxk.h"
#include "bli_packmd_struc_cxk.h"

#include "bli_packm_blk_var1.h"

107 changes: 107 additions & 0 deletions frame/1m/packm/bli_packmd_struc_cxk.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*

BLIS
An object-based framework for developing high-performance BLAS-like
libraries.

Copyright (C) 2014, The University of Texas at Austin

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name(s) of the copyright holder(s) nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/

#include "blis.h"

#undef GENTFUNC2RO
#define GENTFUNC2RO( ctypec_r, ctype_c, ctypep_r, ctypep, chc_r, chc, chp_r, chp, varname ) \
GENTFUNC2RO_( ctypec_r, ctypec_r, ctypep_r, ctypep_r, chc_r, chc_r, chp_r, chp_r, varname ) \
GENTFUNC2RO_( ctypec_r, ctypec, ctypep_r, ctypep, chc_r, chc, chp_r, chp, varname )

#undef GENTFUNC2RO_
#define GENTFUNC2RO_( ctypec_r, ctype_c, ctypep_r, ctypep, chc_r, chc, chp_r, chp, varname ) \
\
void PASTEMAC(chc,chp,varname) \
( \
struc_t strucc, \
diag_t diagc, \
uplo_t uploc, \
conj_t conjc, \
pack_t schema, \
bool invdiag, \
dim_t panel_dim, \
dim_t panel_len, \
dim_t panel_dim_max, \
dim_t panel_len_max, \
dim_t panel_dim_off, \
dim_t panel_len_off, \
dim_t panel_bcast, \
const void* kappa, \
const void* c, inc_t incc, inc_t ldc, \
void* p, inc_t ldp, \
const void* params_, \
const cntx_t* cntx \
) \
{ \
num_t dt_c = PASTEMAC(chc,type); \
num_t dt_p = PASTEMAC(chp,type); \
dim_t dt_c_size = bli_dt_size( dt_c ); \
\
ukr_t cxk_ker_id = BLIS_PACKMD_KER; \
\
packmd_cxk_ker_ft f_cxk = bli_cntx_get_ukr2_dt( dt_c, dt_p, cxk_ker_id, cntx ); \
\
const gemmd_params* params = ( const gemmd_params* )params_; \
\
inc_t incd = params->incd; \
const char* d = ( const char* )params->d + panel_len_off*incd*dt_c_size; \
\
/* For general matrices, pack and return early */ \
if ( bli_is_general( strucc ) ) \
{ \
f_cxk \
( \
conjc, \
schema, \
panel_dim, \
panel_dim_max, \
panel_bcast, \
panel_len, \
panel_len_max, \
kappa, \
c, incc, ldc, \
d, incd, \
p, ldp, \
params, \
cntx \
); \
return; \
} \
\
bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED ); \
}

INSERT_GENTFUNC2RO( packmd_struc_cxk )
INSERT_GENTFUNC2RO_MIX_P( packmd_struc_cxk )

70 changes: 70 additions & 0 deletions frame/1m/packm/bli_packmd_struc_cxk.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*

BLIS
An object-based framework for developing high-performance BLAS-like
libraries.

Copyright (C) 2014, The University of Texas at Austin

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name(s) of the copyright holder(s) nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/


typedef struct gemmd_params
{
const void* d;
inc_t incd;
} gemmd_params;


#undef GENTPROT2
#define GENTPROT2( ctypec, ctypep, chc, chp, varname ) \
\
BLIS_EXPORT_BLIS void PASTEMAC(chc,chp,varname) \
( \
struc_t strucc, \
diag_t diagc, \
uplo_t uploc, \
conj_t conjc, \
pack_t schema, \
bool invdiag, \
dim_t panel_dim, \
dim_t panel_len, \
dim_t panel_dim_max, \
dim_t panel_len_max, \
dim_t panel_dim_off, \
dim_t panel_len_off, \
dim_t panel_bcast, \
const void* kappa, \
const void* c, inc_t incc, inc_t ldc, \
void* p, inc_t ldp, \
const void* params, \
const cntx_t* cntx \
);

INSERT_GENTPROT2_BASIC( packmd_struc_cxk )
INSERT_GENTPROT2_MIX_P( packmd_struc_cxk )

Loading