mirror of
https://github.com/amd/blis.git
synced 2026-04-20 07:38:53 +00:00
Implemented amax operation and related changes.
Details: - Implemented amax operation in BLIS. - Activated BLAS2BLIS routine mapping for new amax BLIS implementation. - Added integer support to [f]printv, [f]printm. - Added integer support to level-0 copys macros. - Updated printing of configuration information in test suite driver. - Comment changes to _config.h files. - Added comments to bla_dot.c to reminder reader what sdsdot()/dsdot() are used for.
This commit is contained in:
@@ -66,8 +66,8 @@
|
||||
// Alignment size used when allocating memory from operating system.
|
||||
#define BLIS_SYSTEM_MEM_ALIGN_SIZE 16
|
||||
|
||||
// Alignment size used when allocating contiguous memory from memory
|
||||
// allocator.
|
||||
// Alignment size used when sizing packed panels of contiguous memory
|
||||
// acquired from the contiguous memory allocator.
|
||||
#define BLIS_CONTIG_MEM_ALIGN_SIZE 16
|
||||
|
||||
// The number of MC x KC, KC x NC, and MC x NC blocks to reserve in the
|
||||
@@ -76,14 +76,14 @@
|
||||
#define BLIS_NUM_KC_X_NC_BLOCKS 1
|
||||
#define BLIS_NUM_MC_X_NC_BLOCKS 0
|
||||
|
||||
// The page size is used by the memory allocator so that static memory
|
||||
// can be allocated with alignment to the beginning of a page boundary.
|
||||
// The page size is used by the contiguous memory allocator to align each
|
||||
// allocatable block to the beginning of a page boundary.
|
||||
#define BLIS_PAGE_SIZE 4096
|
||||
|
||||
// The maximum preload byte offset is used to pad the end of any static
|
||||
// memory allocation request so that the micro-kernel can exceed the
|
||||
// bounds of the usable portion of a memory region without causing a
|
||||
// segmentation fault.
|
||||
// The maximum preload byte offset is used to pad the end of the contiguous
|
||||
// memory pools so that the micro-kernel, when computing with the end of the
|
||||
// last block, can exceed the bounds of the usable portion of the memory
|
||||
// region without causing a segmentation fault.
|
||||
#define BLIS_MAX_PRELOAD_BYTE_OFFSET 128
|
||||
|
||||
|
||||
|
||||
@@ -66,8 +66,8 @@
|
||||
// Alignment size used when allocating memory from operating system.
|
||||
#define BLIS_SYSTEM_MEM_ALIGN_SIZE 16
|
||||
|
||||
// Alignment size used when allocating contiguous memory from memory
|
||||
// allocator.
|
||||
// Alignment size used when sizing packed panels of contiguous memory
|
||||
// acquired from the contiguous memory allocator.
|
||||
#define BLIS_CONTIG_MEM_ALIGN_SIZE 16
|
||||
|
||||
// The number of MC x KC, KC x NC, and MC x NC blocks to reserve in the
|
||||
@@ -76,14 +76,14 @@
|
||||
#define BLIS_NUM_KC_X_NC_BLOCKS 1
|
||||
#define BLIS_NUM_MC_X_NC_BLOCKS 0
|
||||
|
||||
// The page size is used by the memory allocator so that static memory
|
||||
// can be allocated with alignment to the beginning of a page boundary.
|
||||
// The page size is used by the contiguous memory allocator to align each
|
||||
// allocatable block to the beginning of a page boundary.
|
||||
#define BLIS_PAGE_SIZE 4096
|
||||
|
||||
// The maximum preload byte offset is used to pad the end of any static
|
||||
// memory allocation request so that the micro-kernel can exceed the
|
||||
// bounds of the usable portion of a memory region without causing a
|
||||
// segmentation fault.
|
||||
// The maximum preload byte offset is used to pad the end of the contiguous
|
||||
// memory pools so that the micro-kernel, when computing with the end of the
|
||||
// last block, can exceed the bounds of the usable portion of the memory
|
||||
// region without causing a segmentation fault.
|
||||
#define BLIS_MAX_PRELOAD_BYTE_OFFSET 128
|
||||
|
||||
|
||||
|
||||
@@ -254,6 +254,27 @@ err_t bli_check_real_object( obj_t* a )
|
||||
return e_val;
|
||||
}
|
||||
|
||||
err_t bli_check_integer_datatype( num_t dt )
|
||||
{
|
||||
err_t e_val = BLIS_SUCCESS;
|
||||
|
||||
if ( dt != BLIS_INT )
|
||||
e_val = BLIS_EXPECTED_INTEGER_DATATYPE;
|
||||
|
||||
return e_val;
|
||||
}
|
||||
|
||||
err_t bli_check_integer_object( obj_t* a )
|
||||
{
|
||||
err_t e_val;
|
||||
num_t dt;
|
||||
|
||||
dt = bli_obj_datatype( *a );
|
||||
e_val = bli_check_integer_datatype( dt );
|
||||
|
||||
return e_val;
|
||||
}
|
||||
|
||||
err_t bli_check_consistent_datatypes( num_t dt_a, num_t dt_b )
|
||||
{
|
||||
err_t e_val = BLIS_SUCCESS;
|
||||
|
||||
@@ -55,6 +55,8 @@ err_t bli_check_floating_datatype( num_t dt );
|
||||
err_t bli_check_floating_object( obj_t* a );
|
||||
err_t bli_check_real_datatype( num_t dt );
|
||||
err_t bli_check_real_object( obj_t* a );
|
||||
err_t bli_check_integer_datatype( num_t dt );
|
||||
err_t bli_check_integer_object( obj_t* a );
|
||||
err_t bli_check_consistent_datatypes( num_t dt_a, num_t dt_b );
|
||||
err_t bli_check_consistent_object_datatypes( obj_t* a, obj_t* b );
|
||||
err_t bli_check_datatype_real_proj_of( num_t dt_c, num_t dt_r );
|
||||
|
||||
@@ -120,6 +120,8 @@ void bli_error_msgs_init( void )
|
||||
"Expected non-constant datatype value." );
|
||||
sprintf( bli_error_string_for_code(BLIS_EXPECTED_REAL_DATATYPE),
|
||||
"Expected real datatype value." );
|
||||
sprintf( bli_error_string_for_code(BLIS_EXPECTED_INTEGER_DATATYPE),
|
||||
"Expected integer datatype value." );
|
||||
sprintf( bli_error_string_for_code(BLIS_INCONSISTENT_DATATYPES),
|
||||
"Expected consistent datatypes (equal, or one being constant)." );
|
||||
sprintf( bli_error_string_for_code(BLIS_EXPECTED_REAL_PROJ_OF),
|
||||
|
||||
@@ -58,8 +58,14 @@ ftype_i PASTEF772(chi,chx,blasname)( \
|
||||
use positive increments instead. */ \
|
||||
bli_convert_blas_incv( n0, x, *incx, x0, incx0 ); \
|
||||
\
|
||||
bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED ); \
|
||||
index = 0; \
|
||||
/* Call BLIS interface. */ \
|
||||
PASTEMAC(chx,abmaxv)( n0, \
|
||||
x0, incx0, \
|
||||
&index ); \
|
||||
\
|
||||
/* Convert zero-based BLIS (C) index to one-based BLAS (Fortran)
|
||||
index. */ \
|
||||
index++; \
|
||||
\
|
||||
return index; \
|
||||
}
|
||||
|
||||
@@ -79,6 +79,8 @@ INSERT_GENTFUNCDOT_BLAS( dot, DOTV_KERNEL )
|
||||
|
||||
// -- "Black sheep" dot product function definitions --
|
||||
|
||||
// Input vectors stored in single precision, computed in double precision,
|
||||
// with result returned in single precision.
|
||||
float PASTEF77(sd,sdot)( fint* n,
|
||||
float* x, fint* incx,
|
||||
float* y, fint* incy
|
||||
@@ -89,6 +91,8 @@ float PASTEF77(sd,sdot)( fint* n,
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
// Input vectors stored in single precision, computed in double precision,
|
||||
// with result returned in double precision.
|
||||
double PASTEF77(d,sdot)( fint* n,
|
||||
float* x, fint* incx,
|
||||
float* y, fint* incy
|
||||
|
||||
@@ -51,6 +51,17 @@ arrayname[BLIS_NUM_FP_TYPES] = \
|
||||
PASTEMAC(z,op) \
|
||||
}
|
||||
|
||||
#define GENARRAY_I(arrayname,op) \
|
||||
\
|
||||
arrayname[BLIS_NUM_FP_TYPES+1] = \
|
||||
{ \
|
||||
PASTEMAC(s,op), \
|
||||
PASTEMAC(c,op), \
|
||||
PASTEMAC(d,op), \
|
||||
PASTEMAC(z,op), \
|
||||
PASTEMAC(i,op) \
|
||||
}
|
||||
|
||||
/*
|
||||
#define GENARRAYR(arrayname,op) \
|
||||
\
|
||||
|
||||
@@ -149,6 +149,29 @@ GENTFUNC( scomplex, c, tfuncname, varname ) \
|
||||
GENTFUNC( dcomplex, z, tfuncname, varname )
|
||||
|
||||
|
||||
// -- Basic one-operand macro with integer instance --
|
||||
|
||||
|
||||
#define INSERT_GENTFUNC_BASIC_I( tfuncname, varname ) \
|
||||
\
|
||||
GENTFUNC( float, s, tfuncname, varname ) \
|
||||
GENTFUNC( double, d, tfuncname, varname ) \
|
||||
GENTFUNC( scomplex, c, tfuncname, varname ) \
|
||||
GENTFUNC( dcomplex, z, tfuncname, varname ) \
|
||||
GENTFUNC( int, i, tfuncname, varname )
|
||||
|
||||
|
||||
// -- Basic one-operand with integer projection --
|
||||
|
||||
|
||||
#define INSERT_GENTFUNCI_BASIC( tfuncname, varname ) \
|
||||
\
|
||||
GENTFUNCI( float, int, s, i, tfuncname, varname ) \
|
||||
GENTFUNCI( double, int, d, i, tfuncname, varname ) \
|
||||
GENTFUNCI( scomplex, int, c, i, tfuncname, varname ) \
|
||||
GENTFUNCI( dcomplex, int, z, i, tfuncname, varname )
|
||||
|
||||
|
||||
// -- Basic one-operand with real projection --
|
||||
|
||||
|
||||
@@ -160,6 +183,16 @@ GENTFUNCR( scomplex, float, c, s, tfuncname, varname ) \
|
||||
GENTFUNCR( dcomplex, double, z, d, tfuncname, varname )
|
||||
|
||||
|
||||
// -- Basic one-operand with real and integer projections --
|
||||
|
||||
|
||||
#define INSERT_GENTFUNCRI_BASIC( tfuncname, varname ) \
|
||||
\
|
||||
GENTFUNCRI( float, float, int, s, s, i, tfuncname, varname ) \
|
||||
GENTFUNCRI( double, double, int, d, d, i, tfuncname, varname ) \
|
||||
GENTFUNCRI( scomplex, float, int, c, s, i, tfuncname, varname ) \
|
||||
GENTFUNCRI( dcomplex, double, int, z, d, i, tfuncname, varname )
|
||||
|
||||
|
||||
// -- Basic one-operand macro (with two auxiliary arguments) --
|
||||
|
||||
|
||||
@@ -148,15 +148,49 @@ GENTPROT( scomplex, c, funcname ) \
|
||||
GENTPROT( dcomplex, z, funcname )
|
||||
|
||||
|
||||
// -- Basic one-operand macro with integer instance --
|
||||
|
||||
|
||||
#define INSERT_GENTPROT_BASIC_I( funcname ) \
|
||||
\
|
||||
GENTPROT( float, s, funcname ) \
|
||||
GENTPROT( double, d, funcname ) \
|
||||
GENTPROT( scomplex, c, funcname ) \
|
||||
GENTPROT( dcomplex, z, funcname ) \
|
||||
GENTPROT( int, i, funcname )
|
||||
|
||||
|
||||
// -- Basic one-operand with integer projection --
|
||||
|
||||
|
||||
#define INSERT_GENTPROTI_BASIC( funcname ) \
|
||||
\
|
||||
GENTPROTI( float, int, s, i, funcname ) \
|
||||
GENTPROTI( double, int, d, i, funcname ) \
|
||||
GENTPROTI( scomplex, int, c, i, funcname ) \
|
||||
GENTPROTI( dcomplex, int, z, i, funcname )
|
||||
|
||||
|
||||
// -- Basic one-operand with real projection --
|
||||
|
||||
|
||||
#define INSERT_GENTPROTR_BASIC( tfuncname ) \
|
||||
#define INSERT_GENTPROTR_BASIC( funcname ) \
|
||||
\
|
||||
GENTPROTR( float, float, s, s, tfuncname ) \
|
||||
GENTPROTR( double, double, d, d, tfuncname ) \
|
||||
GENTPROTR( scomplex, float, c, s, tfuncname ) \
|
||||
GENTPROTR( dcomplex, double, z, d, tfuncname )
|
||||
GENTPROTR( float, float, s, s, funcname ) \
|
||||
GENTPROTR( double, double, d, d, funcname ) \
|
||||
GENTPROTR( scomplex, float, c, s, funcname ) \
|
||||
GENTPROTR( dcomplex, double, z, d, funcname )
|
||||
|
||||
|
||||
// -- Basic one-operand with real and integer projections --
|
||||
|
||||
|
||||
#define INSERT_GENTPROTRI_BASIC( funcname ) \
|
||||
\
|
||||
GENTPROTRI( float, float, int, s, s, i, funcname ) \
|
||||
GENTPROTRI( double, double, int, d, d, i, funcname ) \
|
||||
GENTPROTRI( scomplex, float, int, c, s, i, funcname ) \
|
||||
GENTPROTRI( dcomplex, double, int, z, d, i, funcname )
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -476,6 +476,7 @@
|
||||
#define bli_dformatspec() "%9.2e"
|
||||
#define bli_cformatspec() "%9.2e + %9.2e "
|
||||
#define bli_zformatspec() "%9.2e + %9.2e "
|
||||
#define bli_iformatspec() "%6d"
|
||||
|
||||
|
||||
// project dt to real if imaginary component is zero
|
||||
|
||||
@@ -535,9 +535,10 @@ typedef enum
|
||||
BLIS_EXPECTED_NONINTEGER_DATATYPE = ( -32),
|
||||
BLIS_EXPECTED_NONCONSTANT_DATATYPE = ( -33),
|
||||
BLIS_EXPECTED_REAL_DATATYPE = ( -34),
|
||||
BLIS_INCONSISTENT_DATATYPES = ( -35),
|
||||
BLIS_EXPECTED_REAL_PROJ_OF = ( -36),
|
||||
BLIS_EXPECTED_REAL_VALUED_OBJECT = ( -37),
|
||||
BLIS_EXPECTED_INTEGER_DATATYPE = ( -35),
|
||||
BLIS_INCONSISTENT_DATATYPES = ( -36),
|
||||
BLIS_EXPECTED_REAL_PROJ_OF = ( -37),
|
||||
BLIS_EXPECTED_REAL_VALUED_OBJECT = ( -38),
|
||||
|
||||
// Dimension-specific errors
|
||||
BLIS_NONCONFORMAL_DIMENSIONS = ( -40),
|
||||
|
||||
@@ -210,6 +210,7 @@ extern "C" {
|
||||
|
||||
// -- Utility operations --
|
||||
|
||||
#include "bli_abmaxv.h"
|
||||
#include "bli_absumv.h"
|
||||
#include "bli_absumm.h"
|
||||
#include "bli_mkherm.h"
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
\
|
||||
( BLIS_CONST_Z_PTR( BLIS_TWO ) )
|
||||
|
||||
#define bli_i2 \
|
||||
\
|
||||
( BLIS_CONST_I_PTR( BLIS_TWO ) )
|
||||
|
||||
// 1
|
||||
|
||||
#define bli_s1 \
|
||||
@@ -73,6 +77,10 @@
|
||||
\
|
||||
( BLIS_CONST_Z_PTR( BLIS_ONE ) )
|
||||
|
||||
#define bli_i1 \
|
||||
\
|
||||
( BLIS_CONST_I_PTR( BLIS_ONE ) )
|
||||
|
||||
// 0
|
||||
|
||||
#define bli_s0 \
|
||||
@@ -91,6 +99,10 @@
|
||||
\
|
||||
( BLIS_CONST_Z_PTR( BLIS_ZERO ) )
|
||||
|
||||
#define bli_i0 \
|
||||
\
|
||||
( BLIS_CONST_I_PTR( BLIS_ZERO ) )
|
||||
|
||||
// -1
|
||||
|
||||
#define bli_sm1 \
|
||||
@@ -109,6 +121,10 @@
|
||||
\
|
||||
( BLIS_CONST_Z_PTR( BLIS_MINUS_ONE ) )
|
||||
|
||||
#define bli_im1 \
|
||||
\
|
||||
( BLIS_CONST_I_PTR( BLIS_MINUS_ONE ) )
|
||||
|
||||
// -2
|
||||
|
||||
#define bli_sm2 \
|
||||
@@ -127,6 +143,10 @@
|
||||
\
|
||||
( BLIS_CONST_Z_PTR( BLIS_MINUS_TWO ) )
|
||||
|
||||
#define bli_im2 \
|
||||
\
|
||||
( BLIS_CONST_I_PTR( BLIS_MINUS_TWO ) )
|
||||
|
||||
|
||||
// set to constant
|
||||
|
||||
|
||||
@@ -117,6 +117,11 @@
|
||||
(y).imag = ( double ) (x).imag; \
|
||||
}
|
||||
|
||||
#define bli_iicopys( x, y ) \
|
||||
{ \
|
||||
(y) = ( int ) (x); \
|
||||
}
|
||||
|
||||
|
||||
#define bli_scopys( x, y ) \
|
||||
{ \
|
||||
@@ -134,6 +139,10 @@
|
||||
{ \
|
||||
bli_zzcopys( x, y ); \
|
||||
}
|
||||
#define bli_icopys( x, y ) \
|
||||
{ \
|
||||
bli_iicopys( x, y ); \
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -59,6 +59,10 @@
|
||||
fprintf( file, spec, (x).imag ); \
|
||||
fprintf( file, " " ); \
|
||||
}
|
||||
#define bli_ifprints( file, spec, x ) \
|
||||
{ \
|
||||
fprintf( file, spec, (x) ); \
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
88
frame/util/abmaxv/bli_abmaxv.c
Normal file
88
frame/util/abmaxv/bli_abmaxv.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2013, The University of Texas
|
||||
|
||||
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 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"
|
||||
|
||||
/*
|
||||
void bli_abmaxv( obj_t* x,
|
||||
obj_t* scale,
|
||||
obj_t* sumsq )
|
||||
{
|
||||
if ( bli_error_checking_is_enabled() )
|
||||
bli_abmaxv_check( x, scale, sumsq );
|
||||
|
||||
bli_abmaxv_unb_var1( x, scale, sumsq );
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// Define object-based interface.
|
||||
//
|
||||
#undef GENFRONT
|
||||
#define GENFRONT( opname, varname ) \
|
||||
\
|
||||
void PASTEMAC0(opname)( \
|
||||
obj_t* x, \
|
||||
obj_t* abmax_i \
|
||||
) \
|
||||
{ \
|
||||
if ( bli_error_checking_is_enabled() ) \
|
||||
PASTEMAC(opname,_check)( x, abmax_i ); \
|
||||
\
|
||||
PASTEMAC0(varname)( x, \
|
||||
abmax_i ); \
|
||||
}
|
||||
|
||||
GENFRONT( abmaxv, abmaxv_unb_var1 )
|
||||
|
||||
|
||||
//
|
||||
// Define BLAS-like interfaces.
|
||||
//
|
||||
#undef GENTFUNCI
|
||||
#define GENTFUNCI( ctype_x, ctype_i, chx, chi, opname, varname ) \
|
||||
\
|
||||
void PASTEMAC(chx,opname)( \
|
||||
dim_t n, \
|
||||
ctype_x* x, inc_t incx, \
|
||||
ctype_i* abmax_i \
|
||||
) \
|
||||
{ \
|
||||
PASTEMAC(chx,varname)( n, \
|
||||
x, incx, \
|
||||
abmax_i ); \
|
||||
}
|
||||
|
||||
INSERT_GENTFUNCI_BASIC( abmaxv, abmaxv_unb_var1 )
|
||||
|
||||
59
frame/util/abmaxv/bli_abmaxv.h
Normal file
59
frame/util/abmaxv/bli_abmaxv.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2013, The University of Texas
|
||||
|
||||
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 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 "bli_abmaxv_check.h"
|
||||
#include "bli_abmaxv_unb_var1.h"
|
||||
|
||||
|
||||
//
|
||||
// Prototype object-based interface.
|
||||
//
|
||||
void bli_abmaxv( obj_t* x,
|
||||
obj_t* abmax_i );
|
||||
|
||||
|
||||
//
|
||||
// Prototype BLAS-like interfaces.
|
||||
//
|
||||
#undef GENTPROTI
|
||||
#define GENTPROTI( ctype_x, ctype_i, chx, chi, opname ) \
|
||||
\
|
||||
void PASTEMAC(chx,opname)( \
|
||||
dim_t n, \
|
||||
ctype_x* x, inc_t incx, \
|
||||
ctype_i* abmax_i \
|
||||
);
|
||||
|
||||
INSERT_GENTPROTI_BASIC( abmaxv )
|
||||
|
||||
61
frame/util/abmaxv/bli_abmaxv_check.c
Normal file
61
frame/util/abmaxv/bli_abmaxv_check.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2013, The University of Texas
|
||||
|
||||
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 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"
|
||||
|
||||
void bli_abmaxv_check( obj_t* x,
|
||||
obj_t* abmax_i )
|
||||
{
|
||||
err_t e_val;
|
||||
|
||||
// Check object datatypes.
|
||||
|
||||
e_val = bli_check_floating_object( x );
|
||||
bli_check_error_code( e_val );
|
||||
|
||||
e_val = bli_check_integer_object( abmax_i );
|
||||
bli_check_error_code( e_val );
|
||||
|
||||
e_val = bli_check_nonconstant_object( abmax_i );
|
||||
bli_check_error_code( e_val );
|
||||
|
||||
// Check object dimensions.
|
||||
|
||||
e_val = bli_check_vector_object( x );
|
||||
bli_check_error_code( e_val );
|
||||
|
||||
e_val = bli_check_scalar_object( abmax_i );
|
||||
bli_check_error_code( e_val );
|
||||
}
|
||||
|
||||
36
frame/util/abmaxv/bli_abmaxv_check.h
Normal file
36
frame/util/abmaxv/bli_abmaxv_check.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2013, The University of Texas
|
||||
|
||||
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 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.
|
||||
|
||||
*/
|
||||
|
||||
void bli_abmaxv_check( obj_t* x,
|
||||
obj_t* abmax_i );
|
||||
136
frame/util/abmaxv/bli_abmaxv_unb_var1.c
Normal file
136
frame/util/abmaxv/bli_abmaxv_unb_var1.c
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2013, The University of Texas
|
||||
|
||||
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 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"
|
||||
|
||||
#define FUNCPTR_T abmaxv_fp
|
||||
|
||||
typedef void (*FUNCPTR_T)(
|
||||
dim_t n,
|
||||
void* x, inc_t incx,
|
||||
void* abmax_i
|
||||
);
|
||||
|
||||
static FUNCPTR_T GENARRAY(ftypes,abmaxv_unb_var1);
|
||||
|
||||
|
||||
void bli_abmaxv_unb_var1( obj_t* x,
|
||||
obj_t* abmax_i )
|
||||
{
|
||||
num_t dt_x = bli_obj_datatype( *x );
|
||||
|
||||
dim_t n = bli_obj_vector_dim( *x );
|
||||
|
||||
inc_t inc_x = bli_obj_vector_inc( *x );
|
||||
void* buf_x = bli_obj_buffer_at_off( *x );
|
||||
|
||||
void* buf_abmax_i = bli_obj_buffer_at_off( *abmax_i );
|
||||
|
||||
FUNCPTR_T f;
|
||||
|
||||
// Index into the type combination array to extract the correct
|
||||
// function pointer.
|
||||
f = ftypes[dt_x];
|
||||
|
||||
// Invoke the function.
|
||||
f( n,
|
||||
buf_x, inc_x,
|
||||
buf_abmax_i );
|
||||
}
|
||||
|
||||
|
||||
#undef GENTFUNCRI
|
||||
#define GENTFUNCRI( ctype_x, ctype_xr, ctype_i, chx, chxr, chi, opname, varname ) \
|
||||
\
|
||||
void PASTEMAC(chx,varname)( \
|
||||
dim_t n, \
|
||||
void* x, inc_t incx, \
|
||||
void* abmax_i \
|
||||
) \
|
||||
{ \
|
||||
ctype_x* x_cast = x; \
|
||||
ctype_i* abmax_i_cast = abmax_i; \
|
||||
ctype_xr* minus_one = PASTEMAC(chxr,m1); \
|
||||
ctype_i* minus_one_i = PASTEMAC(chi,m1); \
|
||||
\
|
||||
ctype_x* chi1; \
|
||||
ctype_xr chi1_r; \
|
||||
ctype_xr chi1_i; \
|
||||
ctype_xr abs_chi1_save; \
|
||||
ctype_xr abs_chi1; \
|
||||
ctype_i i_save; \
|
||||
dim_t i; \
|
||||
\
|
||||
/* Initialize the maximum absolute value search candidate with
|
||||
-1, which is guaranteed to be less than all values we will
|
||||
compute. */ \
|
||||
PASTEMAC2(chxr,chxr,copys)( *minus_one, abs_chi1_save ); \
|
||||
\
|
||||
/* Initialize the index for the maximum absolute value search
|
||||
candidate. We use -1 in case x has a length of zero. */ \
|
||||
PASTEMAC2(chi,chi,copys)( *minus_one_i, i_save ); \
|
||||
\
|
||||
chi1 = x_cast; \
|
||||
\
|
||||
for ( i = 0; i < n; ++i ) \
|
||||
{ \
|
||||
/* Get the real and imaginary components of chi1. */ \
|
||||
PASTEMAC2(chx,chxr,getris)( *chi1, chi1_r, chi1_i ); \
|
||||
\
|
||||
/* Replace chi1_r and chi1_i with their absolute values. */ \
|
||||
chi1_r = bli_fabs( chi1_r ); \
|
||||
chi1_i = bli_fabs( chi1_i ); \
|
||||
\
|
||||
/* Add the real and imaginary absolute values together. */ \
|
||||
PASTEMAC(chxr,set0s)( abs_chi1 ); \
|
||||
PASTEMAC2(chxr,chxr,adds)( chi1_r, abs_chi1 ); \
|
||||
PASTEMAC2(chxr,chxr,adds)( chi1_i, abs_chi1 ); \
|
||||
\
|
||||
if ( abs_chi1_save < abs_chi1 ) \
|
||||
{ \
|
||||
/* If the absolute value of the current element exceeds
|
||||
that of the previous largest, save it and its index. */ \
|
||||
PASTEMAC2(chxr,chxr,copys)( abs_chi1, abs_chi1_save ); \
|
||||
PASTEMAC2(chi,chi,copys)( i, i_save ); \
|
||||
} \
|
||||
\
|
||||
chi1 += incx; \
|
||||
} \
|
||||
\
|
||||
/* Store final index to output variable. */ \
|
||||
PASTEMAC2(chi,chi,copys)( i_save, *abmax_i_cast ); \
|
||||
}
|
||||
|
||||
INSERT_GENTFUNCRI_BASIC( abmaxv, abmaxv_unb_var1 )
|
||||
|
||||
49
frame/util/abmaxv/bli_abmaxv_unb_var1.h
Normal file
49
frame/util/abmaxv/bli_abmaxv_unb_var1.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2013, The University of Texas
|
||||
|
||||
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 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.
|
||||
|
||||
*/
|
||||
|
||||
void bli_abmaxv_unb_var1( obj_t* x,
|
||||
obj_t* abmax_i );
|
||||
|
||||
|
||||
#undef GENTPROTRI
|
||||
#define GENTPROTRI( ctype_x, ctype_xr, ctype_i, chx, chxr, chi, varname ) \
|
||||
\
|
||||
void PASTEMAC(chx,varname)( \
|
||||
dim_t n, \
|
||||
void* x, inc_t incx, \
|
||||
void* abmax_i \
|
||||
);
|
||||
|
||||
INSERT_GENTPROTRI_BASIC( abmaxv_unb_var1 )
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef void (*FUNCPTR_T)(
|
||||
char* s2
|
||||
);
|
||||
|
||||
static FUNCPTR_T GENARRAY(ftypes,fprintm);
|
||||
static FUNCPTR_T GENARRAY_I(ftypes,fprintm);
|
||||
|
||||
|
||||
void bli_fprintm( FILE* file, char* s1, obj_t* x, char* format, char* s2 )
|
||||
@@ -81,8 +81,6 @@ void bli_fprintm( FILE* file, char* s1, obj_t* x, char* format, char* s2 )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( dt_x == BLIS_INT ) bli_abort();
|
||||
|
||||
// Index into the type combination array to extract the correct
|
||||
// function pointer.
|
||||
f = ftypes[dt_x];
|
||||
@@ -135,5 +133,5 @@ void PASTEMAC(ch,opname)( \
|
||||
fprintf( file, "%s\n", s2 ); \
|
||||
}
|
||||
|
||||
INSERT_GENTFUNC_BASIC( fprintm, fprintm )
|
||||
INSERT_GENTFUNC_BASIC_I( fprintm, fprintm )
|
||||
|
||||
|
||||
@@ -52,5 +52,5 @@ void PASTEMAC(ch,opname)( \
|
||||
char* s2 \
|
||||
);
|
||||
|
||||
INSERT_GENTPROT_BASIC( fprintm )
|
||||
INSERT_GENTPROT_BASIC_I( fprintm )
|
||||
|
||||
|
||||
@@ -61,5 +61,5 @@ void PASTEMAC(ch,opname)( \
|
||||
s2 ); \
|
||||
}
|
||||
|
||||
INSERT_GENTFUNC_BASIC( printm, fprintm )
|
||||
INSERT_GENTFUNC_BASIC_I( printm, fprintm )
|
||||
|
||||
|
||||
@@ -52,5 +52,5 @@ void PASTEMAC(ch,opname)( \
|
||||
char* s2 \
|
||||
);
|
||||
|
||||
INSERT_GENTPROT_BASIC( printm )
|
||||
INSERT_GENTPROT_BASIC_I( printm )
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ typedef void (*FUNCPTR_T)(
|
||||
char* s2
|
||||
);
|
||||
|
||||
static FUNCPTR_T GENARRAY(ftypes,fprintv);
|
||||
static FUNCPTR_T GENARRAY_I(ftypes,fprintv);
|
||||
|
||||
|
||||
void bli_fprintv( FILE* file, char* s1, obj_t* x, char* format, char* s2 )
|
||||
@@ -107,5 +107,5 @@ void PASTEMAC(ch,opname)( \
|
||||
fprintf( file, "%s\n", s2 ); \
|
||||
}
|
||||
|
||||
INSERT_GENTFUNC_BASIC( fprintv, fprintv )
|
||||
INSERT_GENTFUNC_BASIC_I( fprintv, fprintv )
|
||||
|
||||
|
||||
@@ -51,5 +51,5 @@ void PASTEMAC(ch,opname)( \
|
||||
char* s2 \
|
||||
);
|
||||
|
||||
INSERT_GENTPROT_BASIC( fprintv )
|
||||
INSERT_GENTPROT_BASIC_I( fprintv )
|
||||
|
||||
|
||||
@@ -59,5 +59,5 @@ void PASTEMAC(ch,opname)( \
|
||||
s2 ); \
|
||||
}
|
||||
|
||||
INSERT_GENTFUNC_BASIC( printv, fprintv )
|
||||
INSERT_GENTFUNC_BASIC_I( printv, fprintv )
|
||||
|
||||
|
||||
@@ -51,5 +51,5 @@ void PASTEMAC(ch,opname)( \
|
||||
char* s2 \
|
||||
);
|
||||
|
||||
INSERT_GENTPROT_BASIC( printv )
|
||||
INSERT_GENTPROT_BASIC_I( printv )
|
||||
|
||||
|
||||
@@ -458,11 +458,13 @@ void libblis_test_output_params_struct( FILE* os, test_params_t* params )
|
||||
libblis_test_fprintf_c( os, "\n" );
|
||||
libblis_test_fprintf_c( os, "enable system mem align? %u\n", BLIS_ENABLE_SYSTEM_MEM_ALIGN );
|
||||
libblis_test_fprintf_c( os, " system alignment size %u\n", BLIS_SYSTEM_MEM_ALIGN_SIZE );
|
||||
libblis_test_fprintf_c( os, "contig mem alignment size %u\n", BLIS_CONTIG_MEM_ALIGN_SIZE );
|
||||
libblis_test_fprintf_c( os, "static memory pool \n" );
|
||||
libblis_test_fprintf_c( os, "\n" );
|
||||
libblis_test_fprintf_c( os, "contig memory allocator \n" );
|
||||
libblis_test_fprintf_c( os, " # of mc x kc blocks %u\n", BLIS_NUM_MC_X_KC_BLOCKS );
|
||||
libblis_test_fprintf_c( os, " # of kc x nc blocks %u\n", BLIS_NUM_KC_X_NC_BLOCKS );
|
||||
libblis_test_fprintf_c( os, " # of mc x nc blocks %u\n", BLIS_NUM_MC_X_NC_BLOCKS );
|
||||
libblis_test_fprintf_c( os, " page size %u\n", BLIS_PAGE_SIZE );
|
||||
libblis_test_fprintf_c( os, " panel alignment size %u\n", BLIS_CONTIG_MEM_ALIGN_SIZE );
|
||||
libblis_test_fprintf_c( os, " max preload byte offset %u\n", BLIS_MAX_PRELOAD_BYTE_OFFSET );
|
||||
libblis_test_fprintf_c( os, "\n" );
|
||||
libblis_test_fprintf_c( os, "--- BLIS kernel header ---\n" );
|
||||
|
||||
Reference in New Issue
Block a user