Fixed bugs in scalv and setv.

Details:
- Fixed bugs similar to those addressed in cca1e1f51d, whereby
  a segmentation fault may occur if beta is not the same type as
  the vector operand for scalv and setv.
- Changed axpyv and scal2v front-ends in a similar fashion.
This commit is contained in:
Field G. Van Zee
2013-11-04 15:50:00 -06:00
parent f5953259a1
commit 1abbf768af
7 changed files with 162 additions and 37 deletions

View File

@@ -47,10 +47,23 @@ void PASTEMAC0(opname)( \
obj_t* y \
) \
{ \
num_t dt_x; \
obj_t alpha_local; \
\
if ( bli_error_checking_is_enabled() ) \
PASTEMAC(opname,_check)( alpha, x, y ); \
\
PASTEMAC0(varname)( alpha, \
/* 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 alpha. */ \
bli_obj_init_scalar_copy_of( dt_x, \
BLIS_NO_CONJUGATE, \
alpha, \
&alpha_local ); \
\
PASTEMAC0(varname)( &alpha_local, \
x, \
y ); \
}

View File

@@ -34,17 +34,6 @@
#include "blis.h"
/*
void bli_scal2v( obj_t* beta,
obj_t* x,
obj_t* y )
{
if ( bli_error_checking_is_enabled() )
bli_scal2v_check( beta, x, y );
bli_scal2v_unb_var1( beta, x, y );
}
*/
//
// Define object-based interface.
@@ -58,10 +47,23 @@ void PASTEMAC0(opname)( \
obj_t* y \
) \
{ \
num_t dt_x; \
obj_t beta_local; \
\
if ( bli_error_checking_is_enabled() ) \
PASTEMAC(opname,_check)( beta, x, y ); \
\
PASTEMAC0(varname)( beta, \
/* 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 ); \
\
PASTEMAC0(varname)( &beta_local, \
x, \
y ); \
}

View File

@@ -34,18 +34,6 @@
#include "blis.h"
/*
extern scalv_t* scalv_cntl;
void bli_scalv( obj_t* beta,
obj_t* x )
{
//bli_scalv_int( beta,
// x,
// scalv_cntl );
bli_scalv_unb_var1( beta, x );
}
*/
//
// Define object-based interface.
@@ -58,11 +46,24 @@ void PASTEMAC0(opname)( \
obj_t* x \
) \
{ \
if ( bli_error_checking_is_enabled() ) \
PASTEMAC(opname,_check)( beta, x ); \
num_t dt_x; \
obj_t beta_local; \
\
PASTEMAC0(varname)( beta, \
x ); \
if ( bli_error_checking_is_enabled() ) \
PASTEMAC(opname,_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 ); \
\
PASTEMAC0(varname)( &beta_local, \
x ); \
}
GENFRONT( scalv, SCALV_KERNEL )

View File

@@ -34,13 +34,6 @@
#include "blis.h"
/*
void bli_setv( obj_t* beta,
obj_t* x )
{
bli_setv_unb_var1( beta, x );
}
*/
//
// Define object-based interface.
@@ -53,12 +46,24 @@ void PASTEMAC0(opname)( \
obj_t* x \
) \
{ \
num_t dt_x; \
obj_t beta_local; \
/*
if ( bli_error_checking_is_enabled() ) \
PASTEMAC(opname,_check)( beta, x ); \
*/ \
\
PASTEMAC0(varname)( beta, \
/* 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 ); \
\
PASTEMAC0(varname)( &beta_local, \
x ); \
}

View File

@@ -32,6 +32,8 @@
*/
#include "bli_setv_check.h"
#include "bli_setv_unb_var1.h"
#include "bli_setv_unb_var2.h"

View File

@@ -0,0 +1,63 @@
/*
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_setv_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 );
}
void bli_setv_check( obj_t* beta,
obj_t* x )
{
// Check basic properties of the operation.
bli_setv_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_setv_basic_check( obj_t* beta,
obj_t* x );
void bli_setv_check( obj_t* beta,
obj_t* x );