diff --git a/frame/0/absqsc/bli_absqsc_check.c b/frame/0/absqsc/bli_absqsc_check.c index 4f1f3a510..75b65162d 100644 --- a/frame/0/absqsc/bli_absqsc_check.c +++ b/frame/0/absqsc/bli_absqsc_check.c @@ -67,5 +67,13 @@ void bli_absqsc_check( obj_t* chi, e_val = bli_check_scalar_object( absq ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( absq ); + bli_check_error_code( e_val ); } diff --git a/frame/0/addsc/bli_addsc_check.c b/frame/0/addsc/bli_addsc_check.c index d7545ab8d..43510f04a 100644 --- a/frame/0/addsc/bli_addsc_check.c +++ b/frame/0/addsc/bli_addsc_check.c @@ -57,5 +57,13 @@ void bli_addsc_check( obj_t* chi, e_val = bli_check_scalar_object( psi ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( psi ); + bli_check_error_code( e_val ); } diff --git a/frame/0/copysc/bli_copysc_check.c b/frame/0/copysc/bli_copysc_check.c index ce58dcf02..9ca943b3c 100644 --- a/frame/0/copysc/bli_copysc_check.c +++ b/frame/0/copysc/bli_copysc_check.c @@ -57,5 +57,13 @@ void bli_copysc_check( obj_t* chi, e_val = bli_check_scalar_object( psi ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( psi ); + bli_check_error_code( e_val ); } diff --git a/frame/0/divsc/bli_divsc_check.c b/frame/0/divsc/bli_divsc_check.c index cc4c6d24d..ac9eb9f86 100644 --- a/frame/0/divsc/bli_divsc_check.c +++ b/frame/0/divsc/bli_divsc_check.c @@ -57,5 +57,13 @@ void bli_divsc_check( obj_t* chi, e_val = bli_check_scalar_object( psi ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( psi ); + bli_check_error_code( e_val ); } diff --git a/frame/0/getsc/bli_getsc_check.c b/frame/0/getsc/bli_getsc_check.c index 2e9a40e2d..59066915c 100644 --- a/frame/0/getsc/bli_getsc_check.c +++ b/frame/0/getsc/bli_getsc_check.c @@ -49,5 +49,10 @@ void bli_getsc_check( obj_t* chi, e_val = bli_check_scalar_object( chi ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); } diff --git a/frame/0/mulsc/bli_mulsc_check.c b/frame/0/mulsc/bli_mulsc_check.c index f2bc1f21f..2639822b4 100644 --- a/frame/0/mulsc/bli_mulsc_check.c +++ b/frame/0/mulsc/bli_mulsc_check.c @@ -57,5 +57,13 @@ void bli_mulsc_check( obj_t* chi, e_val = bli_check_scalar_object( psi ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( psi ); + bli_check_error_code( e_val ); } diff --git a/frame/0/normfsc/bli_normfsc_check.c b/frame/0/normfsc/bli_normfsc_check.c index c61fc6cea..296ba151e 100644 --- a/frame/0/normfsc/bli_normfsc_check.c +++ b/frame/0/normfsc/bli_normfsc_check.c @@ -67,5 +67,13 @@ void bli_normfsc_check( obj_t* chi, e_val = bli_check_scalar_object( norm ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( norm ); + bli_check_error_code( e_val ); } diff --git a/frame/0/setsc/bli_setsc_check.c b/frame/0/setsc/bli_setsc_check.c index 8a364ffbb..aa61e71d6 100644 --- a/frame/0/setsc/bli_setsc_check.c +++ b/frame/0/setsc/bli_setsc_check.c @@ -49,5 +49,10 @@ void bli_setsc_check( double beta_r, e_val = bli_check_scalar_object( chi ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); } diff --git a/frame/0/sqrtsc/bli_sqrtsc_check.c b/frame/0/sqrtsc/bli_sqrtsc_check.c index b8c5bbe66..7c6d6cb9c 100644 --- a/frame/0/sqrtsc/bli_sqrtsc_check.c +++ b/frame/0/sqrtsc/bli_sqrtsc_check.c @@ -60,5 +60,13 @@ void bli_sqrtsc_check( obj_t* chi, e_val = bli_check_scalar_object( psi ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( psi ); + bli_check_error_code( e_val ); } diff --git a/frame/0/subsc/bli_subsc_check.c b/frame/0/subsc/bli_subsc_check.c index 6cd069537..624d2f12a 100644 --- a/frame/0/subsc/bli_subsc_check.c +++ b/frame/0/subsc/bli_subsc_check.c @@ -57,5 +57,13 @@ void bli_subsc_check( obj_t* chi, e_val = bli_check_scalar_object( psi ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( psi ); + bli_check_error_code( e_val ); } diff --git a/frame/0/unzipsc/bli_unzipsc_check.c b/frame/0/unzipsc/bli_unzipsc_check.c index 62685b2ee..f4ab3fef7 100644 --- a/frame/0/unzipsc/bli_unzipsc_check.c +++ b/frame/0/unzipsc/bli_unzipsc_check.c @@ -73,5 +73,16 @@ void bli_unzipsc_check( obj_t* beta, e_val = bli_check_scalar_object( chi_i ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( chi_r ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( chi_i ); + bli_check_error_code( e_val ); } diff --git a/frame/0/zipsc/bli_zipsc_check.c b/frame/0/zipsc/bli_zipsc_check.c index c168f59a8..ec50892fd 100644 --- a/frame/0/zipsc/bli_zipsc_check.c +++ b/frame/0/zipsc/bli_zipsc_check.c @@ -70,5 +70,16 @@ void bli_zipsc_check( obj_t* beta_r, e_val = bli_check_scalar_object( chi ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta_r ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta_i ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( chi ); + bli_check_error_code( e_val ); } diff --git a/frame/1/addv/bli_addv_check.c b/frame/1/addv/bli_addv_check.c index a197f2881..b231ebc1f 100644 --- a/frame/1/addv/bli_addv_check.c +++ b/frame/1/addv/bli_addv_check.c @@ -57,5 +57,13 @@ void bli_addv_check( obj_t* x, e_val = bli_check_equal_vector_lengths( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1/axpyv/bli_axpyv_check.c b/frame/1/axpyv/bli_axpyv_check.c index 29052b6f7..dac7c1aaf 100644 --- a/frame/1/axpyv/bli_axpyv_check.c +++ b/frame/1/axpyv/bli_axpyv_check.c @@ -64,5 +64,16 @@ void bli_axpyv_check( obj_t* alpha, e_val = bli_check_equal_vector_lengths( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1/copyv/bli_copyv_check.c b/frame/1/copyv/bli_copyv_check.c index d4f35a152..905ba38fa 100644 --- a/frame/1/copyv/bli_copyv_check.c +++ b/frame/1/copyv/bli_copyv_check.c @@ -57,5 +57,13 @@ void bli_copyv_check( obj_t* x, e_val = bli_check_equal_vector_lengths( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1/dotv/bli_dotv_check.c b/frame/1/dotv/bli_dotv_check.c index db62eb3f1..8ed0d1db6 100644 --- a/frame/1/dotv/bli_dotv_check.c +++ b/frame/1/dotv/bli_dotv_check.c @@ -67,5 +67,16 @@ void bli_dotv_check( obj_t* x, e_val = bli_check_equal_vector_lengths( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( rho ); + bli_check_error_code( e_val ); } diff --git a/frame/1/dotxv/bli_dotxv_check.c b/frame/1/dotxv/bli_dotxv_check.c index d780e89fd..738a70475 100644 --- a/frame/1/dotxv/bli_dotxv_check.c +++ b/frame/1/dotxv/bli_dotxv_check.c @@ -81,5 +81,22 @@ void bli_dotxv_check( obj_t* alpha, e_val = bli_check_equal_vector_lengths( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( rho ); + bli_check_error_code( e_val ); } diff --git a/frame/1/invertv/bli_invertv_check.c b/frame/1/invertv/bli_invertv_check.c index 16d7d97fe..3efa8f22e 100644 --- a/frame/1/invertv/bli_invertv_check.c +++ b/frame/1/invertv/bli_invertv_check.c @@ -47,5 +47,10 @@ void bli_invertv_check( obj_t* x ) e_val = bli_check_vector_object( x ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); } diff --git a/frame/1/scal2v/bli_scal2v_check.c b/frame/1/scal2v/bli_scal2v_check.c index 77c891900..847c59671 100644 --- a/frame/1/scal2v/bli_scal2v_check.c +++ b/frame/1/scal2v/bli_scal2v_check.c @@ -64,5 +64,16 @@ void bli_scal2v_check( obj_t* beta, e_val = bli_check_equal_vector_lengths( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1/scalv/bli_scalv_check.c b/frame/1/scalv/bli_scalv_check.c index 4c5e908a3..fae46fb68 100644 --- a/frame/1/scalv/bli_scalv_check.c +++ b/frame/1/scalv/bli_scalv_check.c @@ -67,11 +67,21 @@ void bli_scalv_check( obj_t* beta, void bli_scalv_int_check( obj_t* beta, obj_t* x, scalv_t* cntl ) -{ +{ + err_t e_val; + // Check basic properties of the operation. bli_scalv_basic_check( beta, x ); + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + // Check control tree pointer // NOTE: We can't check the control tree until we stop interpreting a diff --git a/frame/1/scalv/bli_scalv_int.c b/frame/1/scalv/bli_scalv_int.c index cd946c3b1..e58bedf24 100644 --- a/frame/1/scalv/bli_scalv_int.c +++ b/frame/1/scalv/bli_scalv_int.c @@ -53,6 +53,9 @@ void bli_scalv_int( obj_t* beta, impl_t i; FUNCPTR_T f; + // Return early if one of the matrix operands has a zero dimension. + if ( bli_obj_has_zero_dim( *x ) ) return; + // Check parameters. if ( bli_error_checking_is_enabled() ) bli_scalv_int_check( beta, x, cntl ); @@ -60,9 +63,6 @@ void bli_scalv_int( obj_t* beta, // First check if we are to skip this operation. if ( cntl_is_noop( cntl ) ) return; - // Return early if one of the matrix operands has a zero dimension. - if ( bli_obj_has_zero_dim( *x ) ) return; - // Return early if the beta scalar equals one. if ( bli_obj_equals( beta, &BLIS_ONE ) ) return; diff --git a/frame/1/setv/bli_setv_check.c b/frame/1/setv/bli_setv_check.c index ad030dc70..9efe0eb21 100644 --- a/frame/1/setv/bli_setv_check.c +++ b/frame/1/setv/bli_setv_check.c @@ -34,8 +34,8 @@ #include "blis.h" -void bli_setv_basic_check( obj_t* beta, - obj_t* x ) +void bli_setv_check( obj_t* beta, + obj_t* x ) { err_t e_val; @@ -54,13 +54,13 @@ void bli_setv_basic_check( obj_t* beta, e_val = bli_check_vector_object( x ); 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 ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); } diff --git a/frame/1/setv/bli_setv_check.h b/frame/1/setv/bli_setv_check.h index 8fb4d6ca8..468c2c954 100644 --- a/frame/1/setv/bli_setv_check.h +++ b/frame/1/setv/bli_setv_check.h @@ -32,8 +32,5 @@ */ -void bli_setv_basic_check( obj_t* beta, - obj_t* x ); - void bli_setv_check( obj_t* beta, obj_t* x ); diff --git a/frame/1/subv/bli_subv_check.c b/frame/1/subv/bli_subv_check.c index 1e37f4c67..78d27dcf7 100644 --- a/frame/1/subv/bli_subv_check.c +++ b/frame/1/subv/bli_subv_check.c @@ -57,5 +57,13 @@ void bli_subv_check( obj_t* x, e_val = bli_check_equal_vector_lengths( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1/swapv/bli_swapv_check.c b/frame/1/swapv/bli_swapv_check.c index 66d58ad73..11070686f 100644 --- a/frame/1/swapv/bli_swapv_check.c +++ b/frame/1/swapv/bli_swapv_check.c @@ -57,5 +57,13 @@ void bli_swapv_check( obj_t* x, e_val = bli_check_equal_vector_lengths( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1d/addd/bli_addd_check.c b/frame/1d/addd/bli_addd_check.c index d05061346..60a8fd428 100644 --- a/frame/1d/addd/bli_addd_check.c +++ b/frame/1d/addd/bli_addd_check.c @@ -57,5 +57,13 @@ void bli_addd_check( obj_t* x, e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1d/axpyd/bli_axpyd_check.c b/frame/1d/axpyd/bli_axpyd_check.c index cc5520380..b9e06dc3b 100644 --- a/frame/1d/axpyd/bli_axpyd_check.c +++ b/frame/1d/axpyd/bli_axpyd_check.c @@ -64,5 +64,16 @@ void bli_axpyd_check( obj_t* alpha, e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1d/copyd/bli_copyd_check.c b/frame/1d/copyd/bli_copyd_check.c index fc7a0a33f..7704f23b9 100644 --- a/frame/1d/copyd/bli_copyd_check.c +++ b/frame/1d/copyd/bli_copyd_check.c @@ -57,5 +57,13 @@ void bli_copyd_check( obj_t* x, e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1d/invertd/bli_invertd_check.c b/frame/1d/invertd/bli_invertd_check.c index 1fe40119f..d743b23f4 100644 --- a/frame/1d/invertd/bli_invertd_check.c +++ b/frame/1d/invertd/bli_invertd_check.c @@ -47,5 +47,10 @@ void bli_invertd_check( obj_t* x ) e_val = bli_check_matrix_object( x ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); } diff --git a/frame/1d/scal2d/bli_scal2d_check.c b/frame/1d/scal2d/bli_scal2d_check.c index ba2454234..763258874 100644 --- a/frame/1d/scal2d/bli_scal2d_check.c +++ b/frame/1d/scal2d/bli_scal2d_check.c @@ -64,5 +64,16 @@ void bli_scal2d_check( obj_t* beta, e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1d/scald/bli_scald_check.c b/frame/1d/scald/bli_scald_check.c index f7678e812..ac1fa81db 100644 --- a/frame/1d/scald/bli_scald_check.c +++ b/frame/1d/scald/bli_scald_check.c @@ -54,5 +54,13 @@ void bli_scald_check( obj_t* beta, e_val = bli_check_matrix_object( x ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); } diff --git a/frame/1d/setd/bli_setd_check.c b/frame/1d/setd/bli_setd_check.c index 62c175425..b6a8507b8 100644 --- a/frame/1d/setd/bli_setd_check.c +++ b/frame/1d/setd/bli_setd_check.c @@ -54,5 +54,13 @@ void bli_setd_check( obj_t* beta, e_val = bli_check_matrix_object( x ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); } diff --git a/frame/1d/subd/bli_subd_check.c b/frame/1d/subd/bli_subd_check.c index 33d2c07de..9509205ce 100644 --- a/frame/1d/subd/bli_subd_check.c +++ b/frame/1d/subd/bli_subd_check.c @@ -57,5 +57,13 @@ void bli_subd_check( obj_t* x, e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1f/axpy2v/bli_axpy2v_check.c b/frame/1f/axpy2v/bli_axpy2v_check.c index 2d32d7012..099ccc45e 100644 --- a/frame/1f/axpy2v/bli_axpy2v_check.c +++ b/frame/1f/axpy2v/bli_axpy2v_check.c @@ -81,5 +81,22 @@ void bli_axpy2v_check( obj_t* alpha1, e_val = bli_check_equal_vector_lengths( x, z ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha1 ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( alpha2 ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( z ); + bli_check_error_code( e_val ); } diff --git a/frame/1f/axpyf/bli_axpyf_check.c b/frame/1f/axpyf/bli_axpyf_check.c index 5e645ee29..6ac045b6c 100644 --- a/frame/1f/axpyf/bli_axpyf_check.c +++ b/frame/1f/axpyf/bli_axpyf_check.c @@ -74,5 +74,19 @@ void bli_axpyf_check( obj_t* alpha, e_val = bli_check_vector_dim_equals( y, bli_obj_length_after_trans( *a ) ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1f/dotaxpyv/bli_dotaxpyv_check.c b/frame/1f/dotaxpyv/bli_dotaxpyv_check.c index 827951693..0cedb1aed 100644 --- a/frame/1f/dotaxpyv/bli_dotaxpyv_check.c +++ b/frame/1f/dotaxpyv/bli_dotaxpyv_check.c @@ -99,5 +99,25 @@ void bli_dotaxpyv_check( obj_t* alpha, e_val = bli_check_object_alias_of( xt, x ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( xt ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( rho ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( z ); + bli_check_error_code( e_val ); } diff --git a/frame/1f/dotxaxpyf/bli_dotxaxpyf_check.c b/frame/1f/dotxaxpyf/bli_dotxaxpyf_check.c index 3d969e7e3..d696d51f1 100644 --- a/frame/1f/dotxaxpyf/bli_dotxaxpyf_check.c +++ b/frame/1f/dotxaxpyf/bli_dotxaxpyf_check.c @@ -122,5 +122,31 @@ void bli_dotxaxpyf_check( obj_t* alpha, e_val = bli_check_object_alias_of( at, a ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( at ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( w ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( z ); + bli_check_error_code( e_val ); } diff --git a/frame/1f/dotxf/bli_dotxf_check.c b/frame/1f/dotxf/bli_dotxf_check.c index 566e25aba..656045f7c 100644 --- a/frame/1f/dotxf/bli_dotxf_check.c +++ b/frame/1f/dotxf/bli_dotxf_check.c @@ -81,5 +81,22 @@ void bli_dotxf_check( obj_t* alpha, e_val = bli_check_vector_dim_equals( y, bli_obj_width_after_trans( *a ) ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1m/addm/bli_addm_check.c b/frame/1m/addm/bli_addm_check.c index 9b49495c7..cca55e547 100644 --- a/frame/1m/addm/bli_addm_check.c +++ b/frame/1m/addm/bli_addm_check.c @@ -57,5 +57,13 @@ void bli_addm_check( obj_t* x, e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1m/axpym/bli_axpym_check.c b/frame/1m/axpym/bli_axpym_check.c index 0f4292ed2..f289fdd55 100644 --- a/frame/1m/axpym/bli_axpym_check.c +++ b/frame/1m/axpym/bli_axpym_check.c @@ -64,5 +64,16 @@ void bli_axpym_check( obj_t* alpha, e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1m/copym/bli_copym_check.c b/frame/1m/copym/bli_copym_check.c index a6b4dce24..3cb6fafa5 100644 --- a/frame/1m/copym/bli_copym_check.c +++ b/frame/1m/copym/bli_copym_check.c @@ -57,5 +57,13 @@ void bli_copym_check( obj_t* x, e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1m/scal2m/bli_scal2m_check.c b/frame/1m/scal2m/bli_scal2m_check.c index e9528bec5..b85c0e385 100644 --- a/frame/1m/scal2m/bli_scal2m_check.c +++ b/frame/1m/scal2m/bli_scal2m_check.c @@ -64,5 +64,16 @@ void bli_scal2m_check( obj_t* beta, e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/1m/scalm/bli_scalm_check.c b/frame/1m/scalm/bli_scalm_check.c index 3d69cfde4..1af0d0425 100644 --- a/frame/1m/scalm/bli_scalm_check.c +++ b/frame/1m/scalm/bli_scalm_check.c @@ -73,10 +73,20 @@ void bli_scalm_int_check( obj_t* beta, obj_t* x, scalm_t* cntl ) { + err_t e_val; + // Check basic properties of the operation. bli_scalm_basic_check( beta, x ); + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + // Check control tree pointer // NOTE: We can't check the control tree until we stop interpreting a diff --git a/frame/1m/scalm/bli_scalm_int.c b/frame/1m/scalm/bli_scalm_int.c index b9ca21c2f..ccfdc1755 100644 --- a/frame/1m/scalm/bli_scalm_int.c +++ b/frame/1m/scalm/bli_scalm_int.c @@ -53,6 +53,9 @@ void bli_scalm_int( obj_t* beta, impl_t i; FUNCPTR_T f; + // Return early if one of the matrix operands has a zero dimension. + if ( bli_obj_has_zero_dim( *x ) ) return; + // Check parameters. if ( bli_error_checking_is_enabled() ) bli_scalm_int_check( beta, x, cntl ); @@ -60,9 +63,6 @@ void bli_scalm_int( obj_t* beta, // First check if we are to skip this operation. if ( cntl_is_noop( cntl ) ) return; - // Return early if one of the matrix operands has a zero dimension. - if ( bli_obj_has_zero_dim( *x ) ) return; - // Return early if both beta and the scalar attached to x are unit. if ( bli_obj_equals( beta, &BLIS_ONE ) && bli_obj_scalar_equals( x, &BLIS_ONE ) ) return; diff --git a/frame/1m/setm/bli_setm_check.c b/frame/1m/setm/bli_setm_check.c index 9f263cbd1..5329cadb2 100644 --- a/frame/1m/setm/bli_setm_check.c +++ b/frame/1m/setm/bli_setm_check.c @@ -34,8 +34,8 @@ #include "blis.h" -void bli_setm_basic_check( obj_t* beta, - obj_t* x ) +void bli_setm_check( obj_t* beta, + obj_t* x ) { err_t e_val; @@ -59,13 +59,13 @@ void bli_setm_basic_check( obj_t* beta, 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 ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); } diff --git a/frame/1m/setm/bli_setm_check.h b/frame/1m/setm/bli_setm_check.h index 7b042f4d4..e54d4b60e 100644 --- a/frame/1m/setm/bli_setm_check.h +++ b/frame/1m/setm/bli_setm_check.h @@ -32,8 +32,5 @@ */ -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/1m/subm/bli_subm_check.c b/frame/1m/subm/bli_subm_check.c index ccf70a8eb..9e0315616 100644 --- a/frame/1m/subm/bli_subm_check.c +++ b/frame/1m/subm/bli_subm_check.c @@ -57,5 +57,13 @@ void bli_subm_check( obj_t* x, e_val = bli_check_conformal_dims( x, y ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); } diff --git a/frame/2/gemv/bli_gemv_check.c b/frame/2/gemv/bli_gemv_check.c index d73d70e1e..9bef1cd73 100644 --- a/frame/2/gemv/bli_gemv_check.c +++ b/frame/2/gemv/bli_gemv_check.c @@ -114,6 +114,23 @@ void bli_gemv_int_check( obj_t* alpha, bli_gemv_basic_check( alpha, a, x, beta, y ); + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); + // Check control tree pointer. e_val = bli_check_valid_cntl( ( void* )cntl ); diff --git a/frame/2/gemv/bli_gemv_int.c b/frame/2/gemv/bli_gemv_int.c index ecd4d945d..66f2e3ab4 100644 --- a/frame/2/gemv/bli_gemv_int.c +++ b/frame/2/gemv/bli_gemv_int.c @@ -66,15 +66,6 @@ void bli_gemv_int( trans_t transa, obj_t a_local; obj_t x_local; - // Apply the trans and/or conj parameters to aliases of the objects. - bli_obj_alias_with_trans( transa, *a, a_local ); - bli_obj_alias_with_conj( conjx, *x, x_local ); - - // Check parameters. We use the aliased copy of A so the transa parameter - // is taken into account for dimension checking. - if ( bli_error_checking_is_enabled() ) - bli_gemv_int_check( alpha, &a_local, &x_local, beta, y, cntl ); - // If y has a zero dimension, return early. if ( bli_obj_has_zero_dim( *y ) ) return; @@ -86,6 +77,15 @@ void bli_gemv_int( trans_t transa, return; } + // Apply the trans and/or conj parameters to aliases of the objects. + bli_obj_alias_with_trans( transa, *a, a_local ); + bli_obj_alias_with_conj( conjx, *x, x_local ); + + // Check parameters. We use the aliased copy of A so the transa parameter + // is taken into account for dimension checking. + if ( bli_error_checking_is_enabled() ) + bli_gemv_int_check( alpha, &a_local, &x_local, beta, y, cntl ); + // Extract the variant number and implementation type. n = cntl_var_num( cntl ); i = cntl_impl_type( cntl ); diff --git a/frame/2/ger/bli_ger_check.c b/frame/2/ger/bli_ger_check.c index 70bda3a43..70694df5d 100644 --- a/frame/2/ger/bli_ger_check.c +++ b/frame/2/ger/bli_ger_check.c @@ -94,10 +94,10 @@ void bli_ger_check( obj_t* alpha, } void bli_ger_int_check( obj_t* alpha, - obj_t* x, - obj_t* y, - obj_t* a, - ger_t* cntl ) + obj_t* x, + obj_t* y, + obj_t* a, + ger_t* cntl ) { err_t e_val; @@ -105,6 +105,20 @@ void bli_ger_int_check( obj_t* alpha, bli_ger_basic_check( alpha, x, y, a ); + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + // Check control tree pointer e_val = bli_check_valid_cntl( ( void* )cntl ); diff --git a/frame/2/ger/bli_ger_int.c b/frame/2/ger/bli_ger_int.c index de0c529c1..6a7b3190f 100644 --- a/frame/2/ger/bli_ger_int.c +++ b/frame/2/ger/bli_ger_int.c @@ -67,10 +67,6 @@ void bli_ger_int( conj_t conjx, obj_t y_local; obj_t a_local; - // Check parameters. - if ( bli_error_checking_is_enabled() ) - bli_ger_int_check( alpha, x, y, a, cntl ); - // If A has a zero dimension, return early. if ( bli_obj_has_zero_dim( *a ) ) return; @@ -81,6 +77,10 @@ void bli_ger_int( conj_t conjx, return; } + // Check parameters. + if ( bli_error_checking_is_enabled() ) + bli_ger_int_check( alpha, x, y, a, cntl ); + // Alias the objects, applying conjx and conjy to x and y, respectively. bli_obj_alias_with_conj( conjx, *x, x_local ); bli_obj_alias_with_conj( conjy, *y, y_local ); diff --git a/frame/2/hemv/bli_hemv_check.c b/frame/2/hemv/bli_hemv_check.c index 056b82e8d..72c686a22 100644 --- a/frame/2/hemv/bli_hemv_check.c +++ b/frame/2/hemv/bli_hemv_check.c @@ -131,6 +131,23 @@ void bli_hemv_int_check( conj_t conjh, bli_check_error_code( e_val ); } + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); + // Check control tree pointer. e_val = bli_check_valid_cntl( ( void* )cntl ); diff --git a/frame/2/hemv/bli_hemv_int.c b/frame/2/hemv/bli_hemv_int.c index 345f5b1d5..c2a46f387 100644 --- a/frame/2/hemv/bli_hemv_int.c +++ b/frame/2/hemv/bli_hemv_int.c @@ -66,10 +66,6 @@ void bli_hemv_int( conj_t conjh, FUNCPTR_T f; obj_t a_local; - // Check parameters. - if ( bli_error_checking_is_enabled() ) - bli_hemv_int_check( conjh, alpha, a, x, beta, y, cntl ); - // If y has a zero dimension, return early. if ( bli_obj_has_zero_dim( *y ) ) return; @@ -81,6 +77,10 @@ void bli_hemv_int( conj_t conjh, return; } + // Check parameters. + if ( bli_error_checking_is_enabled() ) + bli_hemv_int_check( conjh, alpha, a, x, beta, y, cntl ); + // Alias A in case we need to induce the upper triangular case. bli_obj_alias_to( *a, a_local ); diff --git a/frame/2/her/bli_her_check.c b/frame/2/her/bli_her_check.c index 9e383f168..a85bb35de 100644 --- a/frame/2/her/bli_her_check.c +++ b/frame/2/her/bli_her_check.c @@ -120,6 +120,17 @@ void bli_her_int_check( conj_t conjh, bli_check_error_code( e_val ); } + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( c ); + bli_check_error_code( e_val ); + // Check control tree pointer. e_val = bli_check_valid_cntl( ( void* )cntl ); diff --git a/frame/2/her/bli_her_int.c b/frame/2/her/bli_her_int.c index 6f13dd64a..3bb0ff15f 100644 --- a/frame/2/her/bli_her_int.c +++ b/frame/2/her/bli_her_int.c @@ -63,14 +63,14 @@ void bli_her_int( conj_t conjh, obj_t x_local; obj_t c_local; - // Check parameters. - if ( bli_error_checking_is_enabled() ) - bli_her_int_check( conjh, alpha, x, c, cntl ); - // If C or x has a zero dimension, return early. if ( bli_obj_has_zero_dim( *c ) ) return; if ( bli_obj_has_zero_dim( *x ) ) return; + // Check parameters. + if ( bli_error_checking_is_enabled() ) + bli_her_int_check( conjh, alpha, x, c, cntl ); + // Alias the operands in case we need to apply conjugations. bli_obj_alias_to( *x, x_local ); bli_obj_alias_to( *c, c_local ); diff --git a/frame/2/her2/bli_her2_check.c b/frame/2/her2/bli_her2_check.c index 98a9b68fe..fd448fcf4 100644 --- a/frame/2/her2/bli_her2_check.c +++ b/frame/2/her2/bli_her2_check.c @@ -124,6 +124,20 @@ void bli_her2_int_check( conj_t conjh, bli_check_error_code( e_val ); } + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( y ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( c ); + bli_check_error_code( e_val ); + // Check control tree pointer e_val = bli_check_valid_cntl( ( void* )cntl ); diff --git a/frame/2/her2/bli_her2_int.c b/frame/2/her2/bli_her2_int.c index efb5dc1ab..d80d05eb1 100644 --- a/frame/2/her2/bli_her2_int.c +++ b/frame/2/her2/bli_her2_int.c @@ -70,15 +70,15 @@ void bli_her2_int( conj_t conjh, obj_t y_local; obj_t c_local; - // Check parameters. - if ( bli_error_checking_is_enabled() ) - bli_her2_int_check( conjh, alpha, x, y, c, cntl ); - // If C, x, or y has a zero dimension, return early. if ( bli_obj_has_zero_dim( *c ) ) return; if ( bli_obj_has_zero_dim( *x ) ) return; if ( bli_obj_has_zero_dim( *y ) ) return; + // Check parameters. + if ( bli_error_checking_is_enabled() ) + bli_her2_int_check( conjh, alpha, x, y, c, cntl ); + // Alias the operands in case we need to apply conjugations. bli_obj_alias_to( *x, x_local ); bli_obj_alias_to( *y, y_local ); diff --git a/frame/2/trmv/bli_trmv_check.c b/frame/2/trmv/bli_trmv_check.c index a00efffe3..7f3a6d8d8 100644 --- a/frame/2/trmv/bli_trmv_check.c +++ b/frame/2/trmv/bli_trmv_check.c @@ -101,6 +101,17 @@ void bli_trmv_int_check( obj_t* alpha, e_val = bli_check_triangular_object( a ); bli_check_error_code( e_val ); + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + // Check control tree pointer e_val = bli_check_valid_cntl( ( void* )cntl ); diff --git a/frame/2/trmv/bli_trmv_int.c b/frame/2/trmv/bli_trmv_int.c index ab46ce99a..758986b01 100644 --- a/frame/2/trmv/bli_trmv_int.c +++ b/frame/2/trmv/bli_trmv_int.c @@ -70,13 +70,14 @@ void bli_trmv_int( obj_t* alpha, FUNCPTR_T f; obj_t a_local; + // If A or x has a zero dimension, return early. + if ( bli_obj_has_zero_dim( *a ) ) return; + if ( bli_obj_has_zero_dim( *x ) ) return; + // Check parameters. if ( bli_error_checking_is_enabled() ) bli_trmv_int_check( alpha, a, x, cntl ); - // If x has a zero dimension, return early. - if ( bli_obj_has_zero_dim( *x ) ) return; - // Alias A in case we need to induce a transformation (ie: transposition). bli_obj_alias_to( *a, a_local ); diff --git a/frame/2/trsv/bli_trsv_check.c b/frame/2/trsv/bli_trsv_check.c index e0b8bce55..81d25bc4e 100644 --- a/frame/2/trsv/bli_trsv_check.c +++ b/frame/2/trsv/bli_trsv_check.c @@ -101,6 +101,17 @@ void bli_trsv_int_check( obj_t* alpha, e_val = bli_check_triangular_object( a ); bli_check_error_code( e_val ); + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + // Check control tree pointer e_val = bli_check_valid_cntl( ( void* )cntl ); diff --git a/frame/2/trsv/bli_trsv_int.c b/frame/2/trsv/bli_trsv_int.c index a61d49f19..36814e807 100644 --- a/frame/2/trsv/bli_trsv_int.c +++ b/frame/2/trsv/bli_trsv_int.c @@ -70,13 +70,14 @@ void bli_trsv_int( obj_t* alpha, FUNCPTR_T f; obj_t a_local; + // If A or x has a zero dimension, return early. + if ( bli_obj_has_zero_dim( *a ) ) return; + if ( bli_obj_has_zero_dim( *x ) ) return; + // Check parameters. if ( bli_error_checking_is_enabled() ) bli_trsv_int_check( alpha, a, x, cntl ); - // If x has a zero dimension, return early. - if ( bli_obj_has_zero_dim( *x ) ) return; - // Alias A in case we need to induce a transformation (ie: transposition). bli_obj_alias_to( *a, a_local ); diff --git a/frame/3/gemm/bli_gemm_check.c b/frame/3/gemm/bli_gemm_check.c index 99a015b57..a8723d9ed 100644 --- a/frame/3/gemm/bli_gemm_check.c +++ b/frame/3/gemm/bli_gemm_check.c @@ -121,6 +121,23 @@ void bli_gemm_int_check( obj_t* alpha, { err_t e_val; + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( b ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( c ); + bli_check_error_code( e_val ); + // Check basic properties of the operation. bli_gemm_basic_check( alpha, a, b, beta, c ); diff --git a/frame/3/gemm/bli_gemm_int.c b/frame/3/gemm/bli_gemm_int.c index 5f59c43c8..d2cc838e1 100644 --- a/frame/3/gemm/bli_gemm_int.c +++ b/frame/3/gemm/bli_gemm_int.c @@ -68,10 +68,6 @@ void bli_gemm_int( obj_t* alpha, impl_t i; FUNCPTR_T f; - // Check parameters. - if ( bli_error_checking_is_enabled() ) - bli_gemm_int_check( alpha, a, b, beta, c, cntl ); - // If C has a zero dimension, return early. if ( bli_obj_has_zero_dim( *c ) ) return; @@ -85,6 +81,10 @@ void bli_gemm_int( obj_t* alpha, return; } + // Check parameters. + if ( bli_error_checking_is_enabled() ) + bli_gemm_int_check( alpha, a, b, beta, c, cntl ); + // If A or B is marked as being filled with zeros, scale C by beta and // return early. if ( bli_obj_is_zeros( *a ) || diff --git a/frame/3/hemm/bli_hemm_check.c b/frame/3/hemm/bli_hemm_check.c index 63304dc25..d3e07f00d 100644 --- a/frame/3/hemm/bli_hemm_check.c +++ b/frame/3/hemm/bli_hemm_check.c @@ -111,6 +111,23 @@ void bli_hemm_check( side_t side, { err_t e_val; + // Check object pointers. + + e_val = bli_check_null_pointer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_null_pointer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_null_pointer( b ); + bli_check_error_code( e_val ); + + e_val = bli_check_null_pointer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_null_pointer( c ); + bli_check_error_code( e_val ); + // Check basic properties of the operation. bli_hemm_basic_check( side, alpha, a, b, beta, c ); diff --git a/frame/3/her2k/bli_her2k_check.c b/frame/3/her2k/bli_her2k_check.c index 26a4eea76..caa8f487f 100644 --- a/frame/3/her2k/bli_her2k_check.c +++ b/frame/3/her2k/bli_her2k_check.c @@ -164,6 +164,32 @@ void bli_her2k_int_check( obj_t* alpha, { err_t e_val; + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( bh ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( alpha_conj ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( b ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( ah ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( c ); + bli_check_error_code( e_val ); + // Check basic properties of the operation. bli_her2k_basic_check( alpha, a, bh, alpha_conj, b, ah, beta, c ); diff --git a/frame/3/herk/bli_herk_check.c b/frame/3/herk/bli_herk_check.c index 9c0aac6dd..b073dae52 100644 --- a/frame/3/herk/bli_herk_check.c +++ b/frame/3/herk/bli_herk_check.c @@ -131,6 +131,23 @@ void bli_herk_int_check( obj_t* alpha, { err_t e_val; + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( ah ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( c ); + bli_check_error_code( e_val ); + // Check basic properties of the operation. bli_herk_basic_check( alpha, a, ah, beta, c ); diff --git a/frame/3/herk/bli_herk_int.c b/frame/3/herk/bli_herk_int.c index f604a55c6..bdd869093 100644 --- a/frame/3/herk/bli_herk_int.c +++ b/frame/3/herk/bli_herk_int.c @@ -78,10 +78,6 @@ void bli_herk_int( obj_t* alpha, bool_t uplo; FUNCPTR_T f; - // Check parameters. - if ( bli_error_checking_is_enabled() ) - bli_herk_int_check( alpha, a, ah, beta, c, cntl ); - // If C has a zero dimension, return early. if ( bli_obj_has_zero_dim( *c ) ) return; @@ -95,6 +91,10 @@ void bli_herk_int( obj_t* alpha, return; } + // Check parameters. + if ( bli_error_checking_is_enabled() ) + bli_herk_int_check( alpha, a, ah, beta, c, cntl ); + // Alias A and A' in case we need to update attached scalars. bli_obj_alias_to( *a, a_local ); bli_obj_alias_to( *ah, ah_local ); diff --git a/frame/3/trmm/bli_trmm_check.c b/frame/3/trmm/bli_trmm_check.c index ab5560caa..c785a39d3 100644 --- a/frame/3/trmm/bli_trmm_check.c +++ b/frame/3/trmm/bli_trmm_check.c @@ -120,6 +120,23 @@ void bli_trmm_int_check( obj_t* alpha, { err_t e_val; + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( b ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( c ); + bli_check_error_code( e_val ); + // Check basic properties of the operation. bli_trmm_basic_check( BLIS_LEFT, alpha, a, b, beta, c ); diff --git a/frame/3/trmm/bli_trmm_int.c b/frame/3/trmm/bli_trmm_int.c index 038348dd7..6e65db401 100644 --- a/frame/3/trmm/bli_trmm_int.c +++ b/frame/3/trmm/bli_trmm_int.c @@ -100,10 +100,6 @@ void bli_trmm_int( obj_t* alpha, impl_t i; FUNCPTR_T f; - // Check parameters. - if ( bli_error_checking_is_enabled() ) - bli_trmm_int_check( alpha, a, b, beta, c, cntl ); - // If C has a zero dimension, return early. if ( bli_obj_has_zero_dim( *c ) ) return; @@ -117,6 +113,10 @@ void bli_trmm_int( obj_t* alpha, return; } + // Check parameters. + if ( bli_error_checking_is_enabled() ) + bli_trmm_int_check( alpha, a, b, beta, c, cntl ); + // Alias A and B in case we need to update attached scalars. bli_obj_alias_to( *a, a_local ); bli_obj_alias_to( *b, b_local ); diff --git a/frame/3/trsm/bli_trsm_check.c b/frame/3/trsm/bli_trsm_check.c index 56e858467..890540856 100644 --- a/frame/3/trsm/bli_trsm_check.c +++ b/frame/3/trsm/bli_trsm_check.c @@ -120,6 +120,23 @@ void bli_trsm_int_check( obj_t* alpha, { err_t e_val; + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( alpha ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( b ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( beta ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( c ); + bli_check_error_code( e_val ); + // Check basic properties of the operation. bli_trsm_basic_check( BLIS_LEFT, alpha, a, b, beta, c ); diff --git a/frame/3/trsm/bli_trsm_int.c b/frame/3/trsm/bli_trsm_int.c index 6644b3512..4377b97ce 100644 --- a/frame/3/trsm/bli_trsm_int.c +++ b/frame/3/trsm/bli_trsm_int.c @@ -100,10 +100,6 @@ void bli_trsm_int( obj_t* alpha, impl_t i; FUNCPTR_T f; - // Check parameters. - if ( bli_error_checking_is_enabled() ) - bli_trsm_int_check( alpha, a, b, beta, c, cntl ); - // If C has a zero dimension, return early. if ( bli_obj_has_zero_dim( *c ) ) return; @@ -117,6 +113,10 @@ void bli_trsm_int( obj_t* alpha, return; } + // Check parameters. + if ( bli_error_checking_is_enabled() ) + bli_trsm_int_check( alpha, a, b, beta, c, cntl ); + // Alias A and B in case we need to update attached scalars. bli_obj_alias_to( *a, a_local ); bli_obj_alias_to( *b, b_local ); diff --git a/frame/base/bli_check.c b/frame/base/bli_check.c index 215a6228b..513b40a9c 100644 --- a/frame/base/bli_check.c +++ b/frame/base/bli_check.c @@ -77,7 +77,6 @@ err_t bli_check_null_pointer( void* ptr ) return e_val; } - // -- Parameter-related checks ------------------------------------------------- err_t bli_check_valid_side( side_t side ) @@ -676,7 +675,6 @@ err_t bli_check_valid_3x3_subpart( subpart_t part ) return e_val; } - // -- Control tree-related checks ---------------------------------------------- err_t bli_check_valid_cntl( void* cntl ) @@ -714,6 +712,17 @@ err_t bli_check_packv_schema_on_unpack( obj_t* a ) return e_val; } +// -- Buffer-related checks ---------------------------------------------------- + +err_t bli_check_object_buffer( obj_t* a ) +{ + err_t e_val = BLIS_SUCCESS; + + if ( bli_obj_buffer( *a ) == NULL ) + e_val = BLIS_EXPECTED_NONNULL_OBJECT_BUFFER; + + return e_val; +} // -- Memory allocator checks -------------------------------------------------- @@ -750,7 +759,6 @@ err_t bli_check_if_exhausted_pool( pool_t* pool ) return e_val; } - // -- Memory allocator checks -------------------------------------------------- err_t bli_check_object_alias_of( obj_t* a, obj_t* b ) diff --git a/frame/base/bli_check.h b/frame/base/bli_check.h index 4626a6794..5515ea7bd 100644 --- a/frame/base/bli_check.h +++ b/frame/base/bli_check.h @@ -93,6 +93,8 @@ err_t bli_check_valid_cntl( void* cntl ); err_t bli_check_packm_schema_on_unpack( obj_t* a ); err_t bli_check_packv_schema_on_unpack( obj_t* a ); +err_t bli_check_object_buffer( obj_t* a ); + err_t bli_check_valid_packbuf( packbuf_t buf_type ); err_t bli_check_requested_block_size_for_pool( siz_t req_size, pool_t* pool ); err_t bli_check_if_exhausted_pool( pool_t* pool ); diff --git a/frame/base/bli_error.c b/frame/base/bli_error.c index 7a1055b1a..9b285afe7 100644 --- a/frame/base/bli_error.c +++ b/frame/base/bli_error.c @@ -182,6 +182,9 @@ void bli_error_msgs_init( void ) sprintf( bli_error_string_for_code(BLIS_PACK_SCHEMA_NOT_SUPPORTED_FOR_UNPACK), "Pack schema not yet supported/implemented for use with unpacking." ); + sprintf( bli_error_string_for_code(BLIS_EXPECTED_NONNULL_OBJECT_BUFFER), + "Encountered object containing unexpected null buffer." ); + sprintf( bli_error_string_for_code(BLIS_INVALID_PACKBUF), "Invalid packbuf_t value." ); sprintf( bli_error_string_for_code(BLIS_REQUESTED_CONTIG_BLOCK_TOO_BIG ), diff --git a/frame/base/check/bli_obj_check.c b/frame/base/check/bli_obj_check.c index a70a85f2e..ec53b8b9f 100644 --- a/frame/base/check/bli_obj_check.c +++ b/frame/base/check/bli_obj_check.c @@ -89,8 +89,14 @@ void bli_obj_attach_buffer_check( void* p, { err_t e_val; - e_val = bli_check_null_pointer( p ); - bli_check_error_code( e_val ); + // NOTE: We allow the caller to attach NULL to an object because + // the buffer contains NULL after _create_wihout_buffer() anyway. + // Thus, we're not opening a window for undefined behavior because + // that window is already open. Instead of checking for NULL here, + // we check the object buffers for all objects in all of the + // computational operations' _check()/_int_check() functions. + //e_val = bli_check_null_pointer( p ); + //bli_check_error_code( e_val ); e_val = bli_check_matrix_strides( bli_obj_length( *obj ), bli_obj_width( *obj ), @@ -143,6 +149,9 @@ void bli_obj_create_const_copy_of_check( obj_t* a, obj_t* b ) e_val = bli_check_scalar_object( a ); bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); } void bli_datatype_size_check( num_t dt ) diff --git a/frame/include/bli_type_defs.h b/frame/include/bli_type_defs.h index 6b00e0ee9..609b38931 100644 --- a/frame/include/bli_type_defs.h +++ b/frame/include/bli_type_defs.h @@ -727,15 +727,18 @@ typedef enum // Packing-specific errors BLIS_PACK_SCHEMA_NOT_SUPPORTED_FOR_UNPACK = (-100), + // Buffer-specific errors + BLIS_EXPECTED_NONNULL_OBJECT_BUFFER = (-110), + // Memory allocator errors - BLIS_INVALID_PACKBUF = (-110), - BLIS_REQUESTED_CONTIG_BLOCK_TOO_BIG = (-111), - BLIS_EXHAUSTED_CONTIG_MEMORY_POOL = (-112), + BLIS_INVALID_PACKBUF = (-120), + BLIS_REQUESTED_CONTIG_BLOCK_TOO_BIG = (-121), + BLIS_EXHAUSTED_CONTIG_MEMORY_POOL = (-122), // Object-related errors - BLIS_EXPECTED_OBJECT_ALIAS = (-120), + BLIS_EXPECTED_OBJECT_ALIAS = (-130), - BLIS_ERROR_CODE_MAX = (-130) + BLIS_ERROR_CODE_MAX = (-140) } err_t; #endif diff --git a/frame/util/amaxv/bli_amaxv_check.c b/frame/util/amaxv/bli_amaxv_check.c index 5dff44ec4..187b83839 100644 --- a/frame/util/amaxv/bli_amaxv_check.c +++ b/frame/util/amaxv/bli_amaxv_check.c @@ -57,5 +57,13 @@ void bli_amaxv_check( obj_t* x, e_val = bli_check_scalar_object( abmax_i ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( abmax_i ); + bli_check_error_code( e_val ); } diff --git a/frame/util/asumv/bli_asumv_check.c b/frame/util/asumv/bli_asumv_check.c index 7c0ad17d0..fc47f60bf 100644 --- a/frame/util/asumv/bli_asumv_check.c +++ b/frame/util/asumv/bli_asumv_check.c @@ -54,5 +54,13 @@ void bli_asumv_check( obj_t* x, e_val = bli_check_scalar_object( asum ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( asum ); + bli_check_error_code( e_val ); } diff --git a/frame/util/mkherm/bli_mkherm_check.c b/frame/util/mkherm/bli_mkherm_check.c index f472629de..0a7983e98 100644 --- a/frame/util/mkherm/bli_mkherm_check.c +++ b/frame/util/mkherm/bli_mkherm_check.c @@ -66,5 +66,10 @@ void bli_mkherm_check( obj_t* a ) e_val = bli_check_upper_or_lower_object( a ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); } diff --git a/frame/util/mksymm/bli_mksymm_check.c b/frame/util/mksymm/bli_mksymm_check.c index d8ba83352..3e89d663c 100644 --- a/frame/util/mksymm/bli_mksymm_check.c +++ b/frame/util/mksymm/bli_mksymm_check.c @@ -66,5 +66,10 @@ void bli_mksymm_check( obj_t* a ) e_val = bli_check_upper_or_lower_object( a ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); } diff --git a/frame/util/mktrim/bli_mktrim_check.c b/frame/util/mktrim/bli_mktrim_check.c index 7c79e9ae3..8b685f575 100644 --- a/frame/util/mktrim/bli_mktrim_check.c +++ b/frame/util/mktrim/bli_mktrim_check.c @@ -66,5 +66,10 @@ void bli_mktrim_check( obj_t* a ) e_val = bli_check_upper_or_lower_object( a ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( a ); + bli_check_error_code( e_val ); } diff --git a/frame/util/norm1m/bli_norm1m_check.c b/frame/util/norm1m/bli_norm1m_check.c index be734ba20..1ac0d0929 100644 --- a/frame/util/norm1m/bli_norm1m_check.c +++ b/frame/util/norm1m/bli_norm1m_check.c @@ -54,5 +54,13 @@ void bli_norm1m_check( obj_t* x, e_val = bli_check_scalar_object( norm ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( norm ); + bli_check_error_code( e_val ); } diff --git a/frame/util/norm1v/bli_norm1v_check.c b/frame/util/norm1v/bli_norm1v_check.c index 13eff8769..e34a20a30 100644 --- a/frame/util/norm1v/bli_norm1v_check.c +++ b/frame/util/norm1v/bli_norm1v_check.c @@ -54,5 +54,13 @@ void bli_norm1v_check( obj_t* x, e_val = bli_check_scalar_object( norm ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( norm ); + bli_check_error_code( e_val ); } diff --git a/frame/util/normfm/bli_normfm_check.c b/frame/util/normfm/bli_normfm_check.c index fbec6e9a6..09a46233f 100644 --- a/frame/util/normfm/bli_normfm_check.c +++ b/frame/util/normfm/bli_normfm_check.c @@ -57,5 +57,13 @@ void bli_normfm_check( obj_t* x, e_val = bli_check_scalar_object( norm ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( norm ); + bli_check_error_code( e_val ); } diff --git a/frame/util/normfv/bli_normfv_check.c b/frame/util/normfv/bli_normfv_check.c index 34d161b71..25f95c737 100644 --- a/frame/util/normfv/bli_normfv_check.c +++ b/frame/util/normfv/bli_normfv_check.c @@ -57,5 +57,13 @@ void bli_normfv_check( obj_t* x, e_val = bli_check_scalar_object( norm ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( norm ); + bli_check_error_code( e_val ); } diff --git a/frame/util/normim/bli_normim_check.c b/frame/util/normim/bli_normim_check.c index 952ff956a..9a49406a4 100644 --- a/frame/util/normim/bli_normim_check.c +++ b/frame/util/normim/bli_normim_check.c @@ -54,5 +54,13 @@ void bli_normim_check( obj_t* x, e_val = bli_check_scalar_object( norm ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( norm ); + bli_check_error_code( e_val ); } diff --git a/frame/util/normiv/bli_normiv_check.c b/frame/util/normiv/bli_normiv_check.c index 0a7e0c0a6..82a95ea1a 100644 --- a/frame/util/normiv/bli_normiv_check.c +++ b/frame/util/normiv/bli_normiv_check.c @@ -54,5 +54,13 @@ void bli_normiv_check( obj_t* x, e_val = bli_check_scalar_object( norm ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( norm ); + bli_check_error_code( e_val ); } diff --git a/frame/util/printm/bli_fprintm.c b/frame/util/printm/bli_fprintm.c index 1ecb18916..41ded88f7 100644 --- a/frame/util/printm/bli_fprintm.c +++ b/frame/util/printm/bli_fprintm.c @@ -62,6 +62,9 @@ void bli_fprintm( FILE* file, char* s1, obj_t* x, char* format, char* s2 ) FUNCPTR_T f; + if ( bli_error_checking_is_enabled() ) + bli_fprintm_check( file, s1, x, format, s2 ); + // Handle constants up front. if ( dt_x == BLIS_CONSTANT ) { diff --git a/frame/util/printm/bli_fprintm_check.c b/frame/util/printm/bli_fprintm_check.c new file mode 100644 index 000000000..aa0f71598 --- /dev/null +++ b/frame/util/printm/bli_fprintm_check.c @@ -0,0 +1,61 @@ +/* + + BLIS + An object-based framework for developing high-performance BLAS-like + libraries. + + Copyright (C) 2014, 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_fprintm_check( FILE* file, + char* s1, + obj_t* x, + char* format, + char* s2 ) +{ + err_t e_val; + + // Check argument pointers. + + e_val = bli_check_null_pointer( file ); + bli_check_error_code( e_val ); + + e_val = bli_check_null_pointer( s1 ); + bli_check_error_code( e_val ); + + e_val = bli_check_null_pointer( s2 ); + bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); +} + diff --git a/frame/util/printm/bli_fprintm_check.h b/frame/util/printm/bli_fprintm_check.h new file mode 100644 index 000000000..98b6f8a6e --- /dev/null +++ b/frame/util/printm/bli_fprintm_check.h @@ -0,0 +1,39 @@ +/* + + BLIS + An object-based framework for developing high-performance BLAS-like + libraries. + + Copyright (C) 2014, 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_fprintm_check( FILE* file, + char* s1, + obj_t* x, + char* format, + char* s2 ); diff --git a/frame/util/printm/bli_printm.h b/frame/util/printm/bli_printm.h index 690804d0a..bc4b039fa 100644 --- a/frame/util/printm/bli_printm.h +++ b/frame/util/printm/bli_printm.h @@ -33,6 +33,7 @@ */ #include "bli_fprintm.h" +#include "bli_fprintm_check.h" void bli_printm( char* s1, obj_t* x, diff --git a/frame/util/printv/bli_fprintv.c b/frame/util/printv/bli_fprintv.c index a221cbbbd..41a8850a7 100644 --- a/frame/util/printv/bli_fprintv.c +++ b/frame/util/printv/bli_fprintv.c @@ -59,6 +59,9 @@ void bli_fprintv( FILE* file, char* s1, obj_t* x, char* format, char* s2 ) FUNCPTR_T f; + if ( bli_error_checking_is_enabled() ) + bli_fprintv_check( file, s1, x, format, s2 ); + // Index into the type combination array to extract the correct // function pointer. f = ftypes[dt_x]; diff --git a/frame/util/printv/bli_fprintv_check.c b/frame/util/printv/bli_fprintv_check.c new file mode 100644 index 000000000..8631287ac --- /dev/null +++ b/frame/util/printv/bli_fprintv_check.c @@ -0,0 +1,61 @@ +/* + + BLIS + An object-based framework for developing high-performance BLAS-like + libraries. + + Copyright (C) 2014, 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_fprintv_check( FILE* file, + char* s1, + obj_t* x, + char* format, + char* s2 ) +{ + err_t e_val; + + // Check argument pointers. + + e_val = bli_check_null_pointer( file ); + bli_check_error_code( e_val ); + + e_val = bli_check_null_pointer( s1 ); + bli_check_error_code( e_val ); + + e_val = bli_check_null_pointer( s2 ); + bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); +} + diff --git a/frame/util/printv/bli_fprintv_check.h b/frame/util/printv/bli_fprintv_check.h new file mode 100644 index 000000000..2c32e67f8 --- /dev/null +++ b/frame/util/printv/bli_fprintv_check.h @@ -0,0 +1,39 @@ +/* + + BLIS + An object-based framework for developing high-performance BLAS-like + libraries. + + Copyright (C) 2014, 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_fprintv_check( FILE* file, + char* s1, + obj_t* x, + char* format, + char* s2 ); diff --git a/frame/util/printv/bli_printv.h b/frame/util/printv/bli_printv.h index 55123b6fc..c471faec0 100644 --- a/frame/util/printv/bli_printv.h +++ b/frame/util/printv/bli_printv.h @@ -33,6 +33,7 @@ */ #include "bli_fprintv.h" +#include "bli_fprintv_check.h" void bli_printv( char* s1, obj_t* x, diff --git a/frame/util/randm/bli_randm.c b/frame/util/randm/bli_randm.c index 0651adeda..f05b304a9 100644 --- a/frame/util/randm/bli_randm.c +++ b/frame/util/randm/bli_randm.c @@ -34,12 +34,22 @@ #include "blis.h" + +// +// Define object-based interface. +// void bli_randm( obj_t* x ) { + if ( bli_error_checking_is_enabled() ) + bli_randm_check( x ); + bli_randm_unb_var1( x ); } +// +// Define BLAS-like interfaces. +// #undef GENTFUNC #define GENTFUNC( ctype, ch, opname, varname ) \ \ diff --git a/frame/util/randm/bli_randm.h b/frame/util/randm/bli_randm.h index f9ca13553..c77658c28 100644 --- a/frame/util/randm/bli_randm.h +++ b/frame/util/randm/bli_randm.h @@ -32,11 +32,19 @@ */ +#include "bli_randm_check.h" #include "bli_randm_unb_var1.h" + +// +// Prototype object-based interface. +// void bli_randm( obj_t* x ); +// +// Prototype BLAS-like interfaces. +// #undef GENTPROT #define GENTPROT( ctype, ch, opname ) \ \ diff --git a/frame/util/randm/bli_randm_check.c b/frame/util/randm/bli_randm_check.c new file mode 100644 index 000000000..186ef17d7 --- /dev/null +++ b/frame/util/randm/bli_randm_check.c @@ -0,0 +1,54 @@ +/* + + BLIS + An object-based framework for developing high-performance BLAS-like + libraries. + + Copyright (C) 2014, 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_randm_check( obj_t* x ) +{ + err_t e_val; + + // Check object datatypes. + + e_val = bli_check_noninteger_object( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_nonconstant_object( x ); + bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); +} + diff --git a/frame/util/randm/bli_randm_check.h b/frame/util/randm/bli_randm_check.h new file mode 100644 index 000000000..6dd9ba9d9 --- /dev/null +++ b/frame/util/randm/bli_randm_check.h @@ -0,0 +1,35 @@ +/* + + BLIS + An object-based framework for developing high-performance BLAS-like + libraries. + + Copyright (C) 2014, 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_randm_check( obj_t* x ); diff --git a/frame/util/randv/bli_randv.c b/frame/util/randv/bli_randv.c index d080f59cc..cac533606 100644 --- a/frame/util/randv/bli_randv.c +++ b/frame/util/randv/bli_randv.c @@ -34,12 +34,22 @@ #include "blis.h" + +// +// Define object-based interface. +// void bli_randv( obj_t* x ) { + if ( bli_error_checking_is_enabled() ) + bli_randv_check( x ); + bli_randv_unb_var1( x ); } +// +// Define BLAS-like interfaces. +// #undef GENTFUNC #define GENTFUNC( ctype, ch, opname, varname ) \ \ diff --git a/frame/util/randv/bli_randv.h b/frame/util/randv/bli_randv.h index a869d9696..9f8e87ef0 100644 --- a/frame/util/randv/bli_randv.h +++ b/frame/util/randv/bli_randv.h @@ -32,11 +32,19 @@ */ +#include "bli_randv_check.h" #include "bli_randv_unb_var1.h" + +// +// Prototype object-based interface. +// void bli_randv( obj_t* x ); +// +// Prototype BLAS-like interfaces. +// #undef GENTPROT #define GENTPROT( ctype, ch, opname ) \ \ diff --git a/frame/util/randv/bli_randv_check.c b/frame/util/randv/bli_randv_check.c new file mode 100644 index 000000000..cc2c25713 --- /dev/null +++ b/frame/util/randv/bli_randv_check.c @@ -0,0 +1,54 @@ +/* + + BLIS + An object-based framework for developing high-performance BLAS-like + libraries. + + Copyright (C) 2014, 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_randv_check( obj_t* x ) +{ + err_t e_val; + + // Check object datatypes. + + e_val = bli_check_noninteger_object( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_nonconstant_object( x ); + bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); +} + diff --git a/frame/util/randv/bli_randv_check.h b/frame/util/randv/bli_randv_check.h new file mode 100644 index 000000000..564d7887d --- /dev/null +++ b/frame/util/randv/bli_randv_check.h @@ -0,0 +1,35 @@ +/* + + BLIS + An object-based framework for developing high-performance BLAS-like + libraries. + + Copyright (C) 2014, 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_randv_check( obj_t* x ); diff --git a/frame/util/sumsqv/bli_sumsqv_check.c b/frame/util/sumsqv/bli_sumsqv_check.c index 52b5df70b..ad014fd91 100644 --- a/frame/util/sumsqv/bli_sumsqv_check.c +++ b/frame/util/sumsqv/bli_sumsqv_check.c @@ -61,5 +61,16 @@ void bli_sumsqv_check( obj_t* x, e_val = bli_check_scalar_object( sumsq ); bli_check_error_code( e_val ); + + // Check object buffers (for non-NULLness). + + e_val = bli_check_object_buffer( x ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( scale ); + bli_check_error_code( e_val ); + + e_val = bli_check_object_buffer( sumsq ); + bli_check_error_code( e_val ); }