public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: redmond@ecf.utoronto.ca
To: gcc-gnats@gcc.gnu.org
Subject: middle-end/7561: Prefetch merging code in gcc-3.1/gcc/loop.c incorect
Date: Fri, 09 Aug 2002 12:05:00 -0000	[thread overview]
Message-ID: <20020809175832.25368.qmail@sources.redhat.com> (raw)


>Number:         7561
>Category:       middle-end
>Synopsis:       Prefetch merging code in gcc-3.1/gcc/loop.c incorect
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 09 11:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Rob Redmond, University of Toronto
>Release:        3.1
>Organization:
>Environment:
Intel Pentium3
Redhat Linux 7.2
>Description:
See  emit_prefetch_instruction() in gcc-3.1/gcc/loop.c

After examining a general induction variable (GIV) to determine if it is eligible for prefetching, emit_prefetch_instruction() compares the newly identified "prefetchable" GIV with all the previously identified "prefetchable" GIVs (which share a common basic induction variable (BIV)) to determine if they can be merged.

In the first case were two GIV's can be merged, the address of the new one is greater than that of the existing one, causing the existing prefetch's info to be replaced by info related to the new prefetch.

                if (index >= info[i].index && index - info[i].index < 4096)
                  {
                    info[i].write |= d.mem_write;
                    info[i].bytes_accesed += size;
                    info[i].index = index;
                    info[i].giv = iv;
                    info[i].class = bl;
                    info[num_prefetches].base_address = address;
                    add = 0;
                    break;
                  }

The code above (as it appears in loop.c) does not replace the base address of the existing prefetchable GIV.  Thus, by keeping the address of the lower addressed GIV, the higher addressed GIV will never be prefetched.  In fact, the comments before this code say to, "Just do the later and the earlier will get prefetched from previous iteration.", but this is not being done.

  In addition, since num_prefetches is not incremented when the new prefetch is merged, the assignment of the new prefetch's address to "info[num_prefetches].base_address" is replaced when the next non-mergeable prefetch instruction is identified.
>How-To-Repeat:
This problem is located in the GCC source code.
>Fix:
Change the array index in the line mentioned above from,
"info[num_prefetches].base_address = address" (line #3925) to
"info[i].base_address = address"
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-08-09 18:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-09 12:05 redmond [this message]
2002-08-14 10:52 Janis Johnson
2002-12-04  8:07 bangerth
2002-12-06 11:26 Janis Johnson
2002-12-06 11:54 bangerth
2002-12-06 12:06 Wolfgang Bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020809175832.25368.qmail@sources.redhat.com \
    --to=redmond@ecf.utoronto.ca \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).