diff --git a/config/reference/bli_config.h b/config/reference/bli_config.h index 9054ba852..2df828311 100644 --- a/config/reference/bli_config.h +++ b/config/reference/bli_config.h @@ -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 diff --git a/config/template/bli_config.h b/config/template/bli_config.h index 9054ba852..2df828311 100644 --- a/config/template/bli_config.h +++ b/config/template/bli_config.h @@ -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 diff --git a/frame/1m/axpym/bli_axpym.c b/frame/1m/axpym/bli_axpym.c index 0abf4ca3d..192624fa5 100644 --- a/frame/1m/axpym/bli_axpym.c +++ b/frame/1m/axpym/bli_axpym.c @@ -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 ); } diff --git a/frame/1m/scal2m/bli_scal2m.c b/frame/1m/scal2m/bli_scal2m.c index 8cec2ca0b..62b1f368c 100644 --- a/frame/1m/scal2m/bli_scal2m.c +++ b/frame/1m/scal2m/bli_scal2m.c @@ -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 ); } diff --git a/frame/1m/scalm/bli_scalm.c b/frame/1m/scalm/bli_scalm.c index 03ff2cec1..a2a4a59c9 100644 --- a/frame/1m/scalm/bli_scalm.c +++ b/frame/1m/scalm/bli_scalm.c @@ -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 ); +*/ } diff --git a/frame/1m/setm/bli_setm.c b/frame/1m/setm/bli_setm.c index b53937528..217f7780a 100644 --- a/frame/1m/setm/bli_setm.c +++ b/frame/1m/setm/bli_setm.c @@ -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 ); } diff --git a/frame/1m/setm/bli_setm.h b/frame/1m/setm/bli_setm.h index 7de578cbf..479cab587 100644 --- a/frame/1m/setm/bli_setm.h +++ b/frame/1m/setm/bli_setm.h @@ -32,6 +32,8 @@ */ +#include "bli_setm_check.h" + #include "bli_setm_unb_var1.h" diff --git a/frame/1m/setm/bli_setm_check.c b/frame/1m/setm/bli_setm_check.c new file mode 100644 index 000000000..ad4ea8e10 --- /dev/null +++ b/frame/1m/setm/bli_setm_check.c @@ -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 ); +} + diff --git a/frame/1m/setm/bli_setm_check.h b/frame/1m/setm/bli_setm_check.h new file mode 100644 index 000000000..46e90b3ab --- /dev/null +++ b/frame/1m/setm/bli_setm_check.h @@ -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 ); diff --git a/frame/base/bli_obj.c b/frame/base/bli_obj.c index 5058c26ab..134085414 100644 --- a/frame/base/bli_obj.c +++ b/frame/base/bli_obj.c @@ -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. diff --git a/frame/compat/bla_nrm2.c b/frame/compat/bla_nrm2.c index 7f6f7c286..ebc0ac6be 100644 --- a/frame/compat/bla_nrm2.c +++ b/frame/compat/bla_nrm2.c @@ -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