Separated expert, non-expert typed APIs.

Details:
- Split existing typed APIs into two subsets of interfaces: one for use
  with expert parameters, such as the cntx_t*, and one without. This
  separation was already in place for the object APIs, and after this
  commit the typed and object APIs will have similar expert and non-
  expert APIs. The expert functions will be suffixed with "_ex" just as
  is the case for expert interfaces in the object APIs.
- Updated internal invocations of typed APIs (functions such as
  bli_?setm() and bli_?scalv()) throughout BLIS to reflect use of the
  new explictly expert APIs.
- Updated example code in examples/tapi to reflect the existence (and
  usage) of non-expert APIs.
- Bumped the major soname version number in 'so_version'. While code
  compiled against a previous version/commit will likely still work
  (since the old typed function symbol names still exist in the new API,
  just with one less function argument) the semantics of the function
  have changed if the cntx_t* parameter the application passes in is
  non-NULL. For example, calling bli_daxpyv() with a non-NULL context
  does not behave the same way now as it did before; before, the
  context would be used in the computation, and now the context would
  be ignored since the interace for that function no longer expects a
  context argument.
This commit is contained in:
Field G. Van Zee
2018-07-06 19:14:02 -05:00
parent 331694e524
commit e88aedae73
128 changed files with 2006 additions and 818 deletions

View File

@@ -36,12 +36,16 @@
#include "bli_l1f_ft.h"
// Prototype object APIs with and without contexts.
// Prototype object APIs (expert and non-expert).
#include "bli_oapi_w_cntx.h"
#include "bli_l1f_oapi.h"
#include "bli_oapi_wo_cntx.h"
#include "bli_l1f_oapi.h"
// Prototype typed APIs (expert and non-expert).
#include "bli_tapi_w_cntx.h"
#include "bli_l1f_tapi.h"
#include "bli_tapi_wo_cntx.h"
#include "bli_l1f_tapi.h"
// Reference kernel headers

View File

@@ -50,12 +50,12 @@ void PASTEMAC(opname,EX_SUF) \
obj_t* x, \
obj_t* y, \
obj_t* z \
BLIS_OAPI_CNTX_PARAM \
BLIS_OAPI_EX_PARAMS \
) \
{ \
bli_init_once(); \
\
BLIS_OAPI_CNTX_DECL \
BLIS_OAPI_EX_DECLS \
\
num_t dt = bli_obj_dt( x ); \
\
@@ -91,7 +91,7 @@ void PASTEMAC(opname,EX_SUF) \
bli_call_ft_12 \
( \
dt, \
opname, \
PASTECH(opname,BLIS_TAPI_EX_SUF), \
conjx, \
conjy, \
n, \
@@ -116,12 +116,12 @@ void PASTEMAC(opname,EX_SUF) \
obj_t* a, \
obj_t* x, \
obj_t* y \
BLIS_OAPI_CNTX_PARAM \
BLIS_OAPI_EX_PARAMS \
) \
{ \
bli_init_once(); \
\
BLIS_OAPI_CNTX_DECL \
BLIS_OAPI_EX_DECLS \
\
num_t dt = bli_obj_dt( x ); \
\
@@ -157,7 +157,7 @@ void PASTEMAC(opname,EX_SUF) \
bli_call_ft_13 \
( \
dt, \
opname, \
PASTECH(opname,BLIS_TAPI_EX_SUF), \
conja, \
conjx, \
m, \
@@ -184,12 +184,12 @@ void PASTEMAC(opname,EX_SUF) \
obj_t* y, \
obj_t* rho, \
obj_t* z \
BLIS_OAPI_CNTX_PARAM \
BLIS_OAPI_EX_PARAMS \
) \
{ \
bli_init_once(); \
\
BLIS_OAPI_CNTX_DECL \
BLIS_OAPI_EX_DECLS \
\
num_t dt = bli_obj_dt( x ); \
\
@@ -222,7 +222,7 @@ void PASTEMAC(opname,EX_SUF) \
bli_call_ft_13 \
( \
dt, \
opname, \
PASTECH(opname,BLIS_TAPI_EX_SUF), \
conjxt, \
conjx, \
conjy, \
@@ -252,12 +252,12 @@ void PASTEMAC(opname,EX_SUF) \
obj_t* beta, \
obj_t* y, \
obj_t* z \
BLIS_OAPI_CNTX_PARAM \
BLIS_OAPI_EX_PARAMS \
) \
{ \
bli_init_once(); \
\
BLIS_OAPI_CNTX_DECL \
BLIS_OAPI_EX_DECLS \
\
num_t dt = bli_obj_dt( x ); \
\
@@ -304,7 +304,7 @@ void PASTEMAC(opname,EX_SUF) \
bli_call_ft_20 \
( \
dt, \
opname, \
PASTECH(opname,BLIS_TAPI_EX_SUF), \
conjat, \
conja, \
conjw, \
@@ -335,12 +335,12 @@ void PASTEMAC(opname,EX_SUF) \
obj_t* x, \
obj_t* beta, \
obj_t* y \
BLIS_OAPI_CNTX_PARAM \
BLIS_OAPI_EX_PARAMS \
) \
{ \
bli_init_once(); \
\
BLIS_OAPI_CNTX_DECL \
BLIS_OAPI_EX_DECLS \
\
num_t dt = bli_obj_dt( x ); \
\
@@ -381,7 +381,7 @@ void PASTEMAC(opname,EX_SUF) \
bli_call_ft_14 \
( \
dt, \
opname, \
PASTECH(opname,BLIS_TAPI_EX_SUF), \
conjat, \
conjx, \
m, \

View File

@@ -47,7 +47,7 @@ void PASTEMAC(opname,EX_SUF) \
obj_t* x, \
obj_t* y, \
obj_t* z \
BLIS_OAPI_CNTX_PARAM \
BLIS_OAPI_EX_PARAMS \
);
GENTPROT( axpy2v )
@@ -62,7 +62,7 @@ void PASTEMAC(opname,EX_SUF) \
obj_t* a, \
obj_t* x, \
obj_t* y \
BLIS_OAPI_CNTX_PARAM \
BLIS_OAPI_EX_PARAMS \
);
GENTPROT( axpyf )
@@ -79,7 +79,7 @@ void PASTEMAC(opname,EX_SUF) \
obj_t* y, \
obj_t* rho, \
obj_t* z \
BLIS_OAPI_CNTX_PARAM \
BLIS_OAPI_EX_PARAMS \
);
GENTPROT( dotaxpyv )
@@ -98,7 +98,7 @@ void PASTEMAC(opname,EX_SUF) \
obj_t* beta, \
obj_t* y, \
obj_t* z \
BLIS_OAPI_CNTX_PARAM \
BLIS_OAPI_EX_PARAMS \
);
GENTPROT( dotxaxpyf )
@@ -114,7 +114,7 @@ void PASTEMAC(opname,EX_SUF) \
obj_t* x, \
obj_t* beta, \
obj_t* y \
BLIS_OAPI_CNTX_PARAM \
BLIS_OAPI_EX_PARAMS \
);
GENTPROT( dotxf )

View File

@@ -35,7 +35,7 @@
#include "blis.h"
// Include cpp macros that instantiate the API definition templates as
// context-aware.
// having expert parameters.
#include "bli_oapi_w_cntx.h"
// Define the macro protecting the object API definitions.

View File

@@ -35,7 +35,7 @@
#include "blis.h"
// Include cpp macros that instantiate the API definition templates as
// context-less.
// omitting expert parameters.
#include "bli_oapi_wo_cntx.h"
// Define the macro protecting the object API definitions.

View File

@@ -32,7 +32,9 @@
*/
#include "blis.h"
// Guard the function definitions so that they are only compiled when
// #included from files that define the typed API macros.
#ifdef BLIS_ENABLE_TAPI
//
// Define BLAS-like interfaces with typed operands.
@@ -41,7 +43,7 @@
#undef GENTFUNC
#define GENTFUNC( ctype, ch, opname, kerid ) \
\
void PASTEMAC(ch,opname) \
void PASTEMAC2(ch,opname,EX_SUF) \
( \
conj_t conjx, \
conj_t conjy, \
@@ -50,11 +52,13 @@ void PASTEMAC(ch,opname) \
ctype* alphay, \
ctype* x, inc_t incx, \
ctype* y, inc_t incy, \
ctype* z, inc_t incz, \
cntx_t* cntx \
ctype* z, inc_t incz \
BLIS_TAPI_EX_PARAMS \
) \
{ \
bli_init_once(); \
\
BLIS_TAPI_EX_DECLS \
\
const num_t dt = PASTEMAC(ch,type); \
\
@@ -83,7 +87,7 @@ INSERT_GENTFUNC_BASIC( axpy2v, BLIS_AXPY2V_KER )
#undef GENTFUNC
#define GENTFUNC( ctype, ch, opname, kerid ) \
\
void PASTEMAC(ch,opname) \
void PASTEMAC2(ch,opname,EX_SUF) \
( \
conj_t conja, \
conj_t conjx, \
@@ -92,11 +96,13 @@ void PASTEMAC(ch,opname) \
ctype* alpha, \
ctype* a, inc_t inca, inc_t lda, \
ctype* x, inc_t incx, \
ctype* y, inc_t incy, \
cntx_t* cntx \
ctype* y, inc_t incy \
BLIS_TAPI_EX_PARAMS \
) \
{ \
bli_init_once(); \
\
BLIS_TAPI_EX_DECLS \
\
const num_t dt = PASTEMAC(ch,type); \
\
@@ -125,7 +131,7 @@ INSERT_GENTFUNC_BASIC( axpyf, BLIS_AXPYF_KER )
#undef GENTFUNC
#define GENTFUNC( ctype, ch, opname, kerid ) \
\
void PASTEMAC(ch,opname) \
void PASTEMAC2(ch,opname,EX_SUF) \
( \
conj_t conjxt, \
conj_t conjx, \
@@ -135,11 +141,13 @@ void PASTEMAC(ch,opname) \
ctype* x, inc_t incx, \
ctype* y, inc_t incy, \
ctype* rho, \
ctype* z, inc_t incz, \
cntx_t* cntx \
ctype* z, inc_t incz \
BLIS_TAPI_EX_PARAMS \
) \
{ \
bli_init_once(); \
\
BLIS_TAPI_EX_DECLS \
\
const num_t dt = PASTEMAC(ch,type); \
\
@@ -169,7 +177,7 @@ INSERT_GENTFUNC_BASIC( dotaxpyv, BLIS_DOTAXPYV_KER )
#undef GENTFUNC
#define GENTFUNC( ctype, ch, opname, kerid ) \
\
void PASTEMAC(ch,opname) \
void PASTEMAC2(ch,opname,EX_SUF) \
( \
conj_t conjat, \
conj_t conja, \
@@ -183,11 +191,13 @@ void PASTEMAC(ch,opname) \
ctype* x, inc_t incx, \
ctype* beta, \
ctype* y, inc_t incy, \
ctype* z, inc_t incz, \
cntx_t* cntx \
ctype* z, inc_t incz \
BLIS_TAPI_EX_PARAMS \
) \
{ \
bli_init_once(); \
\
BLIS_TAPI_EX_DECLS \
\
const num_t dt = PASTEMAC(ch,type); \
\
@@ -221,7 +231,7 @@ INSERT_GENTFUNC_BASIC( dotxaxpyf, BLIS_DOTXAXPYF_KER )
#undef GENTFUNC
#define GENTFUNC( ctype, ch, opname, kerid ) \
\
void PASTEMAC(ch,opname) \
void PASTEMAC2(ch,opname,EX_SUF) \
( \
conj_t conjat, \
conj_t conjx, \
@@ -231,11 +241,13 @@ void PASTEMAC(ch,opname) \
ctype* a, inc_t inca, inc_t lda, \
ctype* x, inc_t incx, \
ctype* beta, \
ctype* y, inc_t incy, \
cntx_t* cntx \
ctype* y, inc_t incy \
BLIS_TAPI_EX_PARAMS \
) \
{ \
bli_init_once(); \
\
BLIS_TAPI_EX_DECLS \
\
const num_t dt = PASTEMAC(ch,type); \
\
@@ -261,3 +273,6 @@ void PASTEMAC(ch,opname) \
INSERT_GENTFUNC_BASIC( dotxf, BLIS_DOTXF_KER )
#endif

View File

@@ -34,25 +34,107 @@
//
// Generate prototypes for level-1f operations.
// Prototype BLAS-like interfaces with typed operands.
//
#undef axpy2v_ker_name
#define axpy2v_ker_name axpy2v
#undef GENTPROT
#define GENTPROT( ctype, ch, opname ) \
\
void PASTEMAC2(ch,opname,EX_SUF) \
( \
conj_t conjx, \
conj_t conjy, \
dim_t n, \
ctype* alphax, \
ctype* alphay, \
ctype* x, inc_t incx, \
ctype* y, inc_t incy, \
ctype* z, inc_t incz \
BLIS_TAPI_EX_PARAMS \
);
#undef dotaxpyv_ker_name
#define dotaxpyv_ker_name dotaxpyv
INSERT_GENTPROT_BASIC0( axpy2v )
#undef axpyf_ker_name
#define axpyf_ker_name axpyf
#undef dotxf_ker_name
#define dotxf_ker_name dotxf
#undef GENTPROT
#define GENTPROT( ctype, ch, opname ) \
\
void PASTEMAC2(ch,opname,EX_SUF) \
( \
conj_t conja, \
conj_t conjx, \
dim_t m, \
dim_t b_n, \
ctype* alpha, \
ctype* a, inc_t inca, inc_t lda, \
ctype* x, inc_t incx, \
ctype* y, inc_t incy \
BLIS_TAPI_EX_PARAMS \
);
#undef dotxaxpyf_ker_name
#define dotxaxpyf_ker_name dotxaxpyf
INSERT_GENTPROT_BASIC0( axpyf )
// Include the level-1f kernel API template.
#include "bli_l1f_ker.h"
#undef GENTPROT
#define GENTPROT( ctype, ch, opname ) \
\
void PASTEMAC2(ch,opname,EX_SUF) \
( \
conj_t conjxt, \
conj_t conjx, \
conj_t conjy, \
dim_t n, \
ctype* alpha, \
ctype* x, inc_t incx, \
ctype* y, inc_t incy, \
ctype* rho, \
ctype* z, inc_t incz \
BLIS_TAPI_EX_PARAMS \
);
INSERT_GENTPROT_BASIC0( dotaxpyv )
#undef GENTPROT
#define GENTPROT( ctype, ch, opname ) \
\
void PASTEMAC2(ch,opname,EX_SUF) \
( \
conj_t conjat, \
conj_t conja, \
conj_t conjw, \
conj_t conjx, \
dim_t m, \
dim_t b_n, \
ctype* alpha, \
ctype* a, inc_t inca, inc_t lda, \
ctype* w, inc_t incw, \
ctype* x, inc_t incx, \
ctype* beta, \
ctype* y, inc_t incy, \
ctype* z, inc_t incz \
BLIS_TAPI_EX_PARAMS \
);
INSERT_GENTPROT_BASIC0( dotxaxpyf )
#undef GENTPROT
#define GENTPROT( ctype, ch, opname ) \
\
void PASTEMAC2(ch,opname,EX_SUF) \
( \
conj_t conjat, \
conj_t conjx, \
dim_t m, \
dim_t b_n, \
ctype* alpha, \
ctype* a, inc_t inca, inc_t lda, \
ctype* x, inc_t incx, \
ctype* beta, \
ctype* y, inc_t incy \
BLIS_TAPI_EX_PARAMS \
);
INSERT_GENTPROT_BASIC0( dotxf )

View File

@@ -0,0 +1,46 @@
/*
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 of The University of Texas at Austin 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"
// Include cpp macros that instantiate the API definition templates as
// having expert parameters.
#include "bli_tapi_w_cntx.h"
// Define the macro protecting the typed API definitions.
#define BLIS_ENABLE_TAPI
// Include the typed API definitions here.
#include "bli_l1f_tapi.c"

View File

@@ -0,0 +1,46 @@
/*
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 of The University of Texas at Austin 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"
// Include cpp macros that instantiate the API definition templates as
// omitting expert parameters.
#include "bli_tapi_wo_cntx.h"
// Define the macro protecting the typed API definitions.
#define BLIS_ENABLE_TAPI
// Include the typed API definitions here.
#include "bli_l1f_tapi.c"