This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [patch] PR44185 Fix new prefetch test failures
- From: "Fang, Changpeng" <Changpeng dot Fang at amd dot com>
- To: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "rguenther at suse dot de" <rguenther at suse dot de>, "sebpop at gmail dot com" <sebpop at gmail dot com>
- Date: Tue, 18 May 2010 16:12:27 -0500
- Subject: RE: [patch] PR44185 Fix new prefetch test failures
- References: <1C13CD442679CE45A2E80AE9251D7EF933839358@SAUSEXMBP01.amd.com>,<20100518200003.GA31046@kam.mff.cuni.cz>
________________________________________
From: Zdenek Dvorak [rakdver@kam.mff.cuni.cz]
Sent: Tuesday, May 18, 2010 3:00 PM
To: Fang, Changpeng
Cc: H.J. Lu; gcc-patches@gcc.gnu.org; rguenther@suse.de; sebpop@gmail.com
Subject: Re: [patch] PR44185 Fix new prefetch test failures
Hi,
>> Attached is the patch that fixes PR 44184: new prefetch test failure.
>> For gcc.dg/tree-ssa/prefetch-6.c, we add --param min-insn-to-prefetch-ratio=6 to generate
>> the desired number of prefetches.
>the need to change this testcase looks somewhat strange -- it seems to me that the loops should
>be unrolled enough so that min-insn-to-prefetch-ratio does not come into play. What is happening
>there?
Here are the first and last loops in prefetch-6.c:
/* Here, we should use non-temporal prefetch instruction. */
for (i = 0; i < K; i++)
for (j = 0; j < K; j++)
sum += a[i][j];
/* Temporal prefetches should be used here (even though the accesses to
a[j][i] are independent, the same cache line is almost always hit
every N iterations). */
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
sum += a[j][i];
The first loop is ok because it has been unrolled. For the second loop it is not unrolled because no "self" reuse.
Of course, for the second loop, I expect loop interchange happens (with -ftree-loop-linear).
Thanks,
Changpeng