Re: [patch, libfortran] Fix amount of memory allocation for matrix - vector calculation

2017-05-15 Thread Janne Blomqvist
On Fri, May 12, 2017 at 7:57 PM, Thomas Koenig  wrote:
> Am 12.05.2017 um 10:16 schrieb Janne Blomqvist:
>>
>> On Fri, May 12, 2017 at 1:14 AM, Thomas Koenig 
>> wrote:
>>>
>>> Hello world,
>>>
>>> the memory allocation for the buffer in the library matmul
>>> routines still has one problem: The value of 0xdeadbeef meant
>>> as poison could end up in the calculation of the size of the
>>> buffer for the blocked matmul.
>>>
>>> The attached patch fixes that. Verified with regression-test,
>>> also by running a few select test cases under valgrind.
>>>
>>> No test case because nothing appeared to fail.
>>>
>>> OK for trunk?
>>
>>
>> Patch missing?
>
>
> Well, yes.
>
> Here it is.

Looks good, Ok for trunk.

Also add PR 80765 to the changelog per HJL's message.


-- 
Janne Blomqvist


Re: [patch, libfortran] Fix amount of memory allocation for matrix - vector calculation

2017-05-15 Thread H.J. Lu
On Fri, May 12, 2017 at 9:57 AM, Thomas Koenig  wrote:
> Am 12.05.2017 um 10:16 schrieb Janne Blomqvist:
>>
>> On Fri, May 12, 2017 at 1:14 AM, Thomas Koenig 
>> wrote:
>>>
>>> Hello world,
>>>
>>> the memory allocation for the buffer in the library matmul
>>> routines still has one problem: The value of 0xdeadbeef meant
>>> as poison could end up in the calculation of the size of the
>>> buffer for the blocked matmul.
>>>
>>> The attached patch fixes that. Verified with regression-test,
>>> also by running a few select test cases under valgrind.
>>>
>>> No test case because nothing appeared to fail.
>>>
>>> OK for trunk?
>>
>>
>> Patch missing?
>
>
> Well, yes.
>
> Here it is.
>
> Regards
>
> Thomas
>

This fixes:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80765

-- 
H.J.


Re: [patch, libfortran] Fix amount of memory allocation for matrix - vector calculation

2017-05-12 Thread Thomas Koenig

Am 12.05.2017 um 10:16 schrieb Janne Blomqvist:

On Fri, May 12, 2017 at 1:14 AM, Thomas Koenig  wrote:

Hello world,

the memory allocation for the buffer in the library matmul
routines still has one problem: The value of 0xdeadbeef meant
as poison could end up in the calculation of the size of the
buffer for the blocked matmul.

The attached patch fixes that. Verified with regression-test,
also by running a few select test cases under valgrind.

No test case because nothing appeared to fail.

OK for trunk?


Patch missing?


Well, yes.

Here it is.

Regards

Thomas

Index: generated/matmul_c10.c
===
--- generated/matmul_c10.c	(Revision 247839)
+++ generated/matmul_c10.c	(Arbeitskopie)
@@ -222,9 +222,9 @@ matmul_c10_avx (gfc_array_c10 * const restrict ret
   bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
 
   /* bystride should never be used for 1-dimensional b.
-	 in case it is we want it to cause a segfault, rather than
-	 an incorrect result. */
-  bystride = 0xDEADBEEF;
+ The value is only used for calculation of the
+ memory by the buffer.  */
+  bystride = 256;
   ycount = 1;
 }
   else
@@ -774,9 +774,9 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict re
   bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
 
   /* bystride should never be used for 1-dimensional b.
-	 in case it is we want it to cause a segfault, rather than
-	 an incorrect result. */
-  bystride = 0xDEADBEEF;
+ The value is only used for calculation of the
+ memory by the buffer.  */
+  bystride = 256;
   ycount = 1;
 }
   else
@@ -1326,9 +1326,9 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict
   bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
 
   /* bystride should never be used for 1-dimensional b.
-	 in case it is we want it to cause a segfault, rather than
-	 an incorrect result. */
-  bystride = 0xDEADBEEF;
+ The value is only used for calculation of the
+ memory by the buffer.  */
+  bystride = 256;
   ycount = 1;
 }
   else
@@ -1874,9 +1874,9 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict
   bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
 
   /* bystride should never be used for 1-dimensional b.
-	 in case it is we want it to cause a segfault, rather than
-	 an incorrect result. */
-  bystride = 0xDEADBEEF;
+ The value is only used for calculation of the
+ memory by the buffer.  */
+  bystride = 256;
   ycount = 1;
 }
   else
@@ -2480,9 +2480,9 @@ matmul_c10 (gfc_array_c10 * const restrict retarra
   bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
 
   /* bystride should never be used for 1-dimensional b.
-	 in case it is we want it to cause a segfault, rather than
-	 an incorrect result. */
-  bystride = 0xDEADBEEF;
+ The value is only used for calculation of the
+ memory by the buffer.  */
+  bystride = 256;
   ycount = 1;
 }
   else
Index: generated/matmul_c16.c
===
--- generated/matmul_c16.c	(Revision 247839)
+++ generated/matmul_c16.c	(Arbeitskopie)
@@ -222,9 +222,9 @@ matmul_c16_avx (gfc_array_c16 * const restrict ret
   bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
 
   /* bystride should never be used for 1-dimensional b.
-	 in case it is we want it to cause a segfault, rather than
-	 an incorrect result. */
-  bystride = 0xDEADBEEF;
+ The value is only used for calculation of the
+ memory by the buffer.  */
+  bystride = 256;
   ycount = 1;
 }
   else
@@ -774,9 +774,9 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict re
   bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
 
   /* bystride should never be used for 1-dimensional b.
-	 in case it is we want it to cause a segfault, rather than
-	 an incorrect result. */
-  bystride = 0xDEADBEEF;
+ The value is only used for calculation of the
+ memory by the buffer.  */
+  bystride = 256;
   ycount = 1;
 }
   else
@@ -1326,9 +1326,9 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict
   bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
 
   /* bystride should never be used for 1-dimensional b.
-	 in case it is we want it to cause a segfault, rather than
-	 an incorrect result. */
-  bystride = 0xDEADBEEF;
+ The value is only used for calculation of the
+ memory by the buffer.  */
+  bystride = 256;
   ycount = 1;
 }
   else
@@ -1874,9 +1874,9 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict
   bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
 
   /* bystride should never be used for 1-dimensional b.
-	 in case it is we want it to cause a segfault, rather than
-	 an incorrect result. */
-  bystride = 0xDEADBEEF;
+ The value is only used for calculation of the
+ memory by the buffer.  */
+  bystride = 256;
   ycount = 1;
 }
   else
@@ -2480,9 +

Re: [patch, libfortran] Fix amount of memory allocation for matrix - vector calculation

2017-05-12 Thread Janne Blomqvist
On Fri, May 12, 2017 at 1:14 AM, Thomas Koenig  wrote:
> Hello world,
>
> the memory allocation for the buffer in the library matmul
> routines still has one problem: The value of 0xdeadbeef meant
> as poison could end up in the calculation of the size of the
> buffer for the blocked matmul.
>
> The attached patch fixes that. Verified with regression-test,
> also by running a few select test cases under valgrind.
>
> No test case because nothing appeared to fail.
>
> OK for trunk?

Patch missing?




-- 
Janne Blomqvist


[patch, libfortran] Fix amount of memory allocation for matrix - vector calculation

2017-05-11 Thread Thomas Koenig

Hello world,

the memory allocation for the buffer in the library matmul
routines still has one problem: The value of 0xdeadbeef meant
as poison could end up in the calculation of the size of the
buffer for the blocked matmul.

The attached patch fixes that. Verified with regression-test,
also by running a few select test cases under valgrind.

No test case because nothing appeared to fail.

OK for trunk?

Regards

Thomas

2017-05-10  Thomas Koenig  

* m4/matmul_internal.m4:  Set bystride to correct
value for later calculation of buffer size.
* 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.