From ccb8dd26fd396fe190d503930e9585f0e8a99b18 Mon Sep 17 00:00:00 2001 From: Edward Smyth Date: Fri, 8 Sep 2023 15:10:50 -0400 Subject: [PATCH] Compiler warnings when using --int-size=32 Correct compiler warnings when building with configure --int-size=32 - bla_imatcopy.c: Cast ints to longs to match %ld format specification in error printf statement and change this to fprintf to stderr. Also copy this additional fprintf statement to other variants of this function. - bli_type_defs.h: siz_t should always be the same size as a pointer. This corrects an issue in bli_malloc.c when casting from a pointer to a siz_t integer value. AMD-Internal: [CPUPL-3519] Change-Id: Ic87cd6142b8a6fed177b7c55bc0bb6013c5b69ab --- frame/compat/bla_imatcopy.c | 15 +++++++++++++-- frame/include/bli_type_defs.h | 6 +++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/frame/compat/bla_imatcopy.c b/frame/compat/bla_imatcopy.c index 699d8b424..67a82defd 100644 --- a/frame/compat/bla_imatcopy.c +++ b/frame/compat/bla_imatcopy.c @@ -4,7 +4,7 @@ An object-based framework for developing high-performance BLAS-like libraries. - Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved. + Copyright (C) 2020-2023, Advanced Micro Devices, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -376,6 +376,8 @@ static dim_t bli_siMatCopy_cn(dim_t rows,dim_t cols,const float alpha,float* a,d if ( rows <= 0 || cols <= 0 || a == NULL || lda < cols || ldb < cols) { + fprintf( stderr, " Invalid trans setting bli_siMatCopy_cn() %ld %ld %ld %ld \n", + ( long )rows, ( long )cols, ( long )lda, ( long )ldb); bli_print_msg( " Invalid function parameters bli_siMatCopy_cn() .", __FILE__, __LINE__ ); AOCL_DTL_TRACE_EXIT_ERR(AOCL_DTL_LEVEL_TRACE_2, "Invalid function parameters"); return (0); @@ -422,7 +424,8 @@ static dim_t bli_diMatCopy_cn(dim_t rows,dim_t cols,const double alpha,double* a if ( rows <= 0 || cols <= 0 || a == NULL || lda < cols || ldb < cols) { - printf( " Invalid trans setting bli_diMatcopy_cn() %ld %ld %ld %ld \n", rows, cols, lda,ldb); + fprintf( stderr, " Invalid trans setting bli_diMatcopy_cn() %ld %ld %ld %ld \n", + ( long )rows, ( long )cols, ( long )lda, ( long )ldb); bli_print_msg( " Invalid function parameters bli_diMatCopy_cn() .", __FILE__, __LINE__ ); AOCL_DTL_TRACE_EXIT_ERR(AOCL_DTL_LEVEL_TRACE_2, "Invalid function parameters"); return (0); @@ -470,6 +473,8 @@ static dim_t bli_ciMatCopy_cn(dim_t rows,dim_t cols,const scomplex alpha,scomple if ( rows <= 0 || cols <= 0 || a == NULL || lda < cols || ldb < cols) { + fprintf( stderr, " Invalid trans setting bli_ciMatCopy_cn() %ld %ld %ld %ld \n", + ( long )rows, ( long )cols, ( long )lda, ( long )ldb); bli_print_msg( " Invalid function parameters bli_ciMatCopy_cn() .", __FILE__, __LINE__ ); AOCL_DTL_TRACE_EXIT_ERR(AOCL_DTL_LEVEL_TRACE_2, "Invalid function parameters"); return (0); @@ -518,6 +523,8 @@ static dim_t bli_ziMatCopy_cn(dim_t rows,dim_t cols,const dcomplex alpha,dcomple if ( rows <= 0 || cols <= 0 || a == NULL || lda < cols || ldb < cols) { + fprintf( stderr, " Invalid trans setting bli_ziMatCopy_cn() %ld %ld %ld %ld \n", + ( long )rows, ( long )cols, ( long )lda, ( long )ldb); bli_print_msg( " Invalid function parameters bli_ziMatCopy_cn() .", __FILE__, __LINE__ ); AOCL_DTL_TRACE_EXIT_ERR(AOCL_DTL_LEVEL_TRACE_2, "Invalid function parameters"); return (0); @@ -565,6 +572,8 @@ static dim_t bli_ciMatCopy_cr(dim_t rows,dim_t cols,const scomplex alpha,scomple if ( rows <= 0 || cols <= 0 || a == NULL || lda < cols || ldb < cols) { + fprintf( stderr, " Invalid trans setting bli_ciMatCopy_cr() %ld %ld %ld %ld \n", + ( long )rows, ( long )cols, ( long )lda, ( long )ldb); bli_print_msg( " Invalid function parameters bli_ciMatCopy_cr() .", __FILE__, __LINE__ ); AOCL_DTL_TRACE_EXIT_ERR(AOCL_DTL_LEVEL_TRACE_2, "Invalid function parameters"); return (0); @@ -612,6 +621,8 @@ static dim_t bli_ziMatCopy_cr(dim_t rows,dim_t cols,const dcomplex alpha,dcomple if ( rows <= 0 || cols <= 0 || a == NULL || lda < cols || ldb < cols) { + fprintf( stderr, " Invalid trans setting bli_ziMatCopy_cr() %ld %ld %ld %ld \n", + ( long )rows, ( long )cols, ( long )lda, ( long )ldb); bli_print_msg( " Invalid function parameters bli_ziMatCopy_cr() .", __FILE__, __LINE__ ); AOCL_DTL_TRACE_EXIT_ERR(AOCL_DTL_LEVEL_TRACE_2, "Invalid function parameters"); return (0); diff --git a/frame/include/bli_type_defs.h b/frame/include/bli_type_defs.h index 173c5d62e..823410e0a 100644 --- a/frame/include/bli_type_defs.h +++ b/frame/include/bli_type_defs.h @@ -118,7 +118,11 @@ typedef gint_t dim_t; // dimension type #endif typedef gint_t inc_t; // increment/stride type typedef gint_t doff_t; // diagonal offset type -typedef guint_t siz_t; // byte size type +#ifdef BLIS_ARCH_64 +typedef uint64_t siz_t; // byte size type +#else +typedef uint32_t siz_t; // byte size type +#endif typedef uint32_t objbits_t; // object information bit field // -- Real types --