From ed33417a64bfe3d5d8159e29751532c34cb54990 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 16 Sep 2018 19:37:44 +0000 Subject: re PR fortran/37802 (Improve wording for matmul bound checking) 2018-09-16 Thomas Koenig PR fortran/37802 * frontend-passes.c (B_ERROR): New macro for matmul bounds checking error messages. (C_ERROR): Likewise. (inline_matmul_assign): Reorganize bounds checking, use B_ERROR and C_ERROR macros. 2018-09-16 Thomas Koenig PR fortran/37802 * gfortran.dg/matmul_bounds_13.f90: New test case. * gfortran.dg/inline_matmul_15.f90: Adjust test for runtime error. * gfortran.dg/matmul_5.f90: Likewise. * gfortran.dg/matmul_bounds_10.f90: Likewise. * gfortran.dg/matmul_bounds_11.f90: Likewise. * gfortran.dg/matmul_bounds_2.f90: Likewise. * gfortran.dg/matmul_bounds_4.f90: Likewise. * gfortran.dg/matmul_bounds_5.f90: Likewise. 2018-09-16 Thomas Koenig PR fortran/37802 * m4/matmul_internal.m4: Adjust error messages. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. * generated/matmulavx128_c10.c: Regenerated. * generated/matmulavx128_c16.c: Regenerated. * generated/matmulavx128_c4.c: Regenerated. * generated/matmulavx128_c8.c: Regenerated. * generated/matmulavx128_i1.c: Regenerated. * generated/matmulavx128_i16.c: Regenerated. * generated/matmulavx128_i2.c: Regenerated. * generated/matmulavx128_i4.c: Regenerated. * generated/matmulavx128_i8.c: Regenerated. * generated/matmulavx128_r10.c: Regenerated. * generated/matmulavx128_r16.c: Regenerated. * generated/matmulavx128_r4.c: Regenerated. * generated/matmulavx128_r8.c: Regenerated. From-SVN: r264349 --- libgfortran/generated/matmulavx128_r8.c | 70 ++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 24 deletions(-) (limited to 'libgfortran/generated/matmulavx128_r8.c') diff --git a/libgfortran/generated/matmulavx128_r8.c b/libgfortran/generated/matmulavx128_r8.c index 4da59f9..06e0437 100644 --- a/libgfortran/generated/matmulavx128_r8.c +++ b/libgfortran/generated/matmulavx128_r8.c @@ -109,8 +109,8 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; -- cgit v1.1