From cb7ed90752d1ddbac11368c4510641ca4f3a02eb Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Fri, 16 Mar 2018 13:05:56 -0500 Subject: [PATCH] Convert op names to uppercase before calling xerbla_(). Details: - Defined a new function, bli_string_mkupper(), that calls toupper() on every non-NULL character in a string. - Call bli_string_mkupper() prior to calling xerbla_() in the level-2/-3 BLAS _check() macros. This prevents the BLAS testsuite from complaining that the operation name (e.g. "dgemm") does not match the expected value (e.g. "DGEMM"). Thanks to Dave Love for reporting this issue. --- frame/base/bli_string.c | 47 ++++++++++++++++++++++++++++ frame/base/bli_string.h | 35 +++++++++++++++++++++ frame/compat/check/bla_gemm_check.h | 2 ++ frame/compat/check/bla_gemv_check.h | 2 ++ frame/compat/check/bla_ger_check.h | 2 ++ frame/compat/check/bla_hemm_check.h | 2 ++ frame/compat/check/bla_hemv_check.h | 2 ++ frame/compat/check/bla_her2_check.h | 2 ++ frame/compat/check/bla_her2k_check.h | 2 ++ frame/compat/check/bla_her_check.h | 2 ++ frame/compat/check/bla_herk_check.h | 2 ++ frame/compat/check/bla_syr2k_check.h | 2 ++ frame/compat/check/bla_syrk_check.h | 2 ++ frame/compat/check/bla_trmm_check.h | 2 ++ frame/compat/check/bla_trmv_check.h | 2 ++ frame/include/blis.h | 1 + 16 files changed, 109 insertions(+) create mode 100644 frame/base/bli_string.c create mode 100644 frame/base/bli_string.h diff --git a/frame/base/bli_string.c b/frame/base/bli_string.c new file mode 100644 index 000000000..608c43eb0 --- /dev/null +++ b/frame/base/bli_string.c @@ -0,0 +1,47 @@ +/* + + BLIS + An object-based framework for developing high-performance BLAS-like + libraries. + + Copyright (C) 2014, The University of Texas at Austin + + 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 at Austin 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_string_mkupper( char* s ) +{ + // Convert the string to uppercase. + + for ( ; *s != '\0'; s++ ) + { + // Convert to unsigned in case one of the chars is negative. + *s = toupper( ( unsigned char ) *s ); + } +} + diff --git a/frame/base/bli_string.h b/frame/base/bli_string.h new file mode 100644 index 000000000..6eb024068 --- /dev/null +++ b/frame/base/bli_string.h @@ -0,0 +1,35 @@ +/* + + BLIS + An object-based framework for developing high-performance BLAS-like + libraries. + + Copyright (C) 2014, The University of Texas at Austin + + 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 at Austin 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_string_mkupper( char* s ); diff --git a/frame/compat/check/bla_gemm_check.h b/frame/compat/check/bla_gemm_check.h index aaf967625..b5e4d6847 100644 --- a/frame/compat/check/bla_gemm_check.h +++ b/frame/compat/check/bla_gemm_check.h @@ -76,6 +76,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_gemv_check.h b/frame/compat/check/bla_gemv_check.h index fc168d5a2..9789519f3 100644 --- a/frame/compat/check/bla_gemv_check.h +++ b/frame/compat/check/bla_gemv_check.h @@ -61,6 +61,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_ger_check.h b/frame/compat/check/bla_ger_check.h index 4282c0f36..c316517e5 100644 --- a/frame/compat/check/bla_ger_check.h +++ b/frame/compat/check/bla_ger_check.h @@ -54,6 +54,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_hemm_check.h b/frame/compat/check/bla_hemm_check.h index 70b98593f..a16ca34ed 100644 --- a/frame/compat/check/bla_hemm_check.h +++ b/frame/compat/check/bla_hemm_check.h @@ -69,6 +69,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_hemv_check.h b/frame/compat/check/bla_hemv_check.h index 04e6309ca..e55cb818b 100644 --- a/frame/compat/check/bla_hemv_check.h +++ b/frame/compat/check/bla_hemv_check.h @@ -58,6 +58,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_her2_check.h b/frame/compat/check/bla_her2_check.h index 8c38e9adc..7d09ed8bd 100644 --- a/frame/compat/check/bla_her2_check.h +++ b/frame/compat/check/bla_her2_check.h @@ -58,6 +58,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_her2k_check.h b/frame/compat/check/bla_her2k_check.h index 23a28cb9b..83d8c9187 100644 --- a/frame/compat/check/bla_her2k_check.h +++ b/frame/compat/check/bla_her2k_check.h @@ -69,6 +69,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_her_check.h b/frame/compat/check/bla_her_check.h index a4f4bcce5..7920affc4 100644 --- a/frame/compat/check/bla_her_check.h +++ b/frame/compat/check/bla_her_check.h @@ -56,6 +56,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_herk_check.h b/frame/compat/check/bla_herk_check.h index eee51710c..1db81150b 100644 --- a/frame/compat/check/bla_herk_check.h +++ b/frame/compat/check/bla_herk_check.h @@ -67,6 +67,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_syr2k_check.h b/frame/compat/check/bla_syr2k_check.h index 67beb05ee..82ab18518 100644 --- a/frame/compat/check/bla_syr2k_check.h +++ b/frame/compat/check/bla_syr2k_check.h @@ -70,6 +70,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_syrk_check.h b/frame/compat/check/bla_syrk_check.h index 8b56fe92c..386e143bd 100644 --- a/frame/compat/check/bla_syrk_check.h +++ b/frame/compat/check/bla_syrk_check.h @@ -68,6 +68,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_trmm_check.h b/frame/compat/check/bla_trmm_check.h index 2321018cc..9217bf1f5 100644 --- a/frame/compat/check/bla_trmm_check.h +++ b/frame/compat/check/bla_trmm_check.h @@ -78,6 +78,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/compat/check/bla_trmv_check.h b/frame/compat/check/bla_trmv_check.h index db6d62fdd..416d7c67a 100644 --- a/frame/compat/check/bla_trmv_check.h +++ b/frame/compat/check/bla_trmv_check.h @@ -67,6 +67,8 @@ char func_str[ BLIS_MAX_BLAS_FUNC_STR_LENGTH ]; \ \ sprintf( func_str, "%s%-5s", dt_str, op_str ); \ +\ + bli_string_mkupper( func_str ); \ \ PASTEF770(xerbla)( func_str, &info, (ftnlen)6 ); \ \ diff --git a/frame/include/blis.h b/frame/include/blis.h index 84308bf45..7ca8c5bab 100644 --- a/frame/include/blis.h +++ b/frame/include/blis.h @@ -124,6 +124,7 @@ extern "C" { #include "bli_info.h" #include "bli_arch.h" #include "bli_cpuid.h" +#include "bli_string.h" // -- Level-0 operations --