Fixed bugs in scalm and setm.

Details:
- Fixed bugs in scalm and setm that resulted in segmentation faults when
  beta is not the same type as the matrix operand. Thanks to Vladimir
  Sukharev for reporting this bug.
- Changed axpym and scal2m front-ends in fashion similar to that of scalm
  and setm; namely, the alpha scalar is copy-cast the type of the first
  matrix operand.
- Changed the template and reference configurations' bli_config.h files
  so that the number of memory allocator blocks of A and B are set based
  on BLIS_MAX_NUM_THREADS.
- Comment updates to bli_obj.c and variable rename in bla_nrm2.c.
This commit is contained in:
Field G. Van Zee
2013-10-30 14:39:01 -05:00
parent 2807013a47
commit cca1e1f51d
11 changed files with 190 additions and 18 deletions

View File

@@ -80,7 +80,7 @@
// The number of MC x KC, KC x NC, and MC x NC blocks to reserve in the
// contiguous memory pools.
#define BLIS_NUM_MC_X_KC_BLOCKS BLIS_MAX_NUM_THREADS
#define BLIS_NUM_KC_X_NC_BLOCKS 1
#define BLIS_NUM_KC_X_NC_BLOCKS BLIS_MAX_NUM_THREADS
#define BLIS_NUM_MC_X_NC_BLOCKS 0
// The maximum preload byte offset is used to pad the end of the contiguous

View File

@@ -80,7 +80,7 @@
// The number of MC x KC, KC x NC, and MC x NC blocks to reserve in the
// contiguous memory pools.
#define BLIS_NUM_MC_X_KC_BLOCKS BLIS_MAX_NUM_THREADS
#define BLIS_NUM_KC_X_NC_BLOCKS 1
#define BLIS_NUM_KC_X_NC_BLOCKS BLIS_MAX_NUM_THREADS
#define BLIS_NUM_MC_X_NC_BLOCKS 0
// The maximum preload byte offset is used to pad the end of the contiguous

View File

@@ -42,10 +42,25 @@ void bli_axpym( obj_t* alpha,
obj_t* x,
obj_t* y )
{
num_t dt_x;
obj_t alpha_local;
if ( bli_error_checking_is_enabled() )
bli_axpym_check( alpha, x, y );
bli_axpym_unb_var1( alpha, x, y );
// Use the datatype of x as the target type for alpha (since we do
// not assume mixed domain/type support is enabled).
dt_x = bli_obj_datatype( *x );
// Create an object to hold a copy-cast of alpha.
bli_obj_init_scalar_copy_of( dt_x,
BLIS_NO_CONJUGATE,
alpha,
&alpha_local );
bli_axpym_unb_var1( &alpha_local,
x,
y );
}

View File

@@ -42,10 +42,25 @@ void bli_scal2m( obj_t* beta,
obj_t* x,
obj_t* y )
{
num_t dt_x;
obj_t beta_local;
if ( bli_error_checking_is_enabled() )
bli_scal2m_check( beta, x, y );
bli_scal2m_unb_var1( beta, x, y );
// Use the datatype of x as the target type for beta (since we do
// not assume mixed domain/type support is enabled).
dt_x = bli_obj_datatype( *x );
// Create an object to hold a copy-cast of beta.
bli_obj_init_scalar_copy_of( dt_x,
BLIS_NO_CONJUGATE,
beta,
&beta_local );
bli_scal2m_unb_var1( &beta_local,
x,
y );
}

View File

@@ -43,13 +43,28 @@ extern scalm_t* scalm_cntl;
void bli_scalm( obj_t* beta,
obj_t* x )
{
num_t dt_x;
obj_t beta_local;
if ( bli_error_checking_is_enabled() )
bli_scalm_check( beta, x );
bli_scalm_unb_var1( beta, x );
//bli_scalm_int( beta,
// x,
// scalm_cntl );
// Use the datatype of x as the target type for beta (since we do
// not assume mixed domain/type support is enabled).
dt_x = bli_obj_datatype( *x );
// Create an object to hold a copy-cast of beta.
bli_obj_init_scalar_copy_of( dt_x,
BLIS_NO_CONJUGATE,
beta,
&beta_local );
bli_scalm_unb_var1( &beta_local, x );
/*
bli_scalm_int( &beta_local,
x,
scalm_cntl );
*/
}

View File

@@ -41,7 +41,23 @@
void bli_setm( obj_t* beta,
obj_t* x )
{
bli_setm_unb_var1( beta, x );
num_t dt_x;
obj_t beta_local;
if ( bli_error_checking_is_enabled() )
bli_setm_check( beta, x );
// Use the datatype of x as the target type for beta (since we do
// not assume mixed domain/type support is enabled).
dt_x = bli_obj_datatype( *x );
// Create an object to hold a copy-cast of beta.
bli_obj_init_scalar_copy_of( dt_x,
BLIS_NO_CONJUGATE,
beta,
&beta_local );
bli_setm_unb_var1( &beta_local, x );
}

View File

@@ -32,6 +32,8 @@
*/
#include "bli_setm_check.h"
#include "bli_setm_unb_var1.h"

View File

@@ -0,0 +1,68 @@
/*
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_setm_basic_check( obj_t* beta,
obj_t* x )
{
err_t e_val;
// Check object datatypes.
e_val = bli_check_noninteger_object( beta );
bli_check_error_code( e_val );
e_val = bli_check_floating_object( x );
bli_check_error_code( e_val );
// Check object dimensions.
e_val = bli_check_scalar_object( beta );
bli_check_error_code( e_val );
// Check object properties.
e_val = bli_check_nonunit_diag( x );
bli_check_error_code( e_val );
}
void bli_setm_check( obj_t* beta,
obj_t* x )
{
// Check basic properties of the operation.
bli_setm_basic_check( beta, x );
}

View File

@@ -0,0 +1,39 @@
/*
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_setm_basic_check( obj_t* beta,
obj_t* x );
void bli_setm_check( obj_t* beta,
obj_t* x );

View File

@@ -78,12 +78,14 @@ void bli_obj_create_without_buffer( num_t dt,
bli_obj_set_defaults( *obj );
// Set the object root to itself, since obj is not presumed to be a view
// into a larger matrix. This is the ONLY time this field is ever set;
// henceforth, subpartitions and aliases to this object will get copies
// of this field, and thus always have access to its "greatest-grand"
// parent (ie: the original parent, or "root", object). (There is an
// exception to this: there are a few places where root status is
// reset explicitly via bli_obj_set_as_root().)
// into a larger matrix. This is typically the only time this field is
// ever set; henceforth, subpartitions and aliases to this object will
// get copies of this field, and thus always have access to its
// "greatest-grand" parent (ie: the original parent, or "root", object).
// However, there ARE a few places where it is convenient to reset the
// root field explicitly via bli_obj_set_as_root(). (We do not list
// those places here. Just grep for bli_obj_set_as_root within the
// top-level 'frame' directory to see them.
bli_obj_set_as_root( *obj );
// Set individual fields.

View File

@@ -49,7 +49,7 @@ ftype_r PASTEF772(chr,chx,blasname)( \
dim_t n0; \
ftype_x* x0; \
inc_t incx0; \
ftype_r absum; \
ftype_r norm; \
err_t init_result; \
\
/* Initialize BLIS (if it is not already initialized). */ \
@@ -65,12 +65,12 @@ ftype_r PASTEF772(chr,chx,blasname)( \
/* Call BLIS interface. */ \
PASTEMAC(chx,fnormv)( n0, \
x0, incx0, \
&absum ); \
&norm ); \
\
/* Finalize BLIS (if it was initialized above). */ \
bli_finalize_safe( init_result ); \
\
return absum; \
return norm; \
}
#ifdef BLIS_ENABLE_BLAS2BLIS