public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ling-hua Tseng" <uranus@it.muds.net>
To: <gcc@gcc.gnu.org>
Subject: Question of pipeline description
Date: Fri, 19 Aug 2005 15:19:00 -0000	[thread overview]
Message-ID: <000301c5a4d1$5b932fe0$0201a8c0@uranus> (raw)

I'm porting GCC 4.0.2 to a new VLIW architecture.
There are 10 functions units (2 RISCs and 8 DSPs) in the architecture.
The pipeline stages are: IS, ID(fetch operand), E1(ALU), E2, E3, E4(write back to register)
For the circuit area reason, the pipeline forwarding mechanism is not available across two different function units.

For example, the two instructions can use pipeline forwarding in order to reduce the stall cycles:
    add    .r0    r2, r3, r4    @ the result is generated at the E1 stage
    nop    .r0                      @ stall 1 cycle
    add    .r0    r5, r6, r2    @ E1 can forward to ID because the two instructions use the same function unit

The two instructions cannot use the pipeline forwarding because they used difference function units
(.r0 means that the instruction uses RISC0, and .r1 means that the instruction uses RISC1):
    add    .r0    r2, r3, r4    @ write back to register at the E4 stage
    nop    .r0                      @ stall 1 cycle
    nop    .r0                      @ stall 1 cycle
    nop    .r0                      @ stall 1 cycle
    add    .r1    r5, r6, r2    @ no forwarding mechanism between two different function units

The pipeline description can write the following definition trivially:
(define_query_cpu_unit "r0, r1, d0, d1, d2, d3, d4, d5, d6, d7")

(define_insn_reservation "risc_data_processing" 4
    (and (eq_attr "type" "dp")
            (eq_attr "fu" "risc"))
    "(r0 | r1)")

I set the lantency time to 4 for general cases (without pipeline forwarding).
And then I set a bypass rule for the pipeline forwading case:
(define_bypass 1
    "risc_data_processing" "risc_data_processing, risc_load_word, ...")

It's only correct if the two RISC insns reserved the same RISC function unit.
If the two insns reserved RISC0 and RISC1 respectively, the bypass rule is not suitable.
I know that we can use the "guard function" in the (define_bypass ...), but it seems to no help for the situation.
The "guard function" cannot know what function units the two insns reserved.

Are there any other solutions for the situation?
Thanks a lot.

             reply	other threads:[~2005-08-19 15:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-19 15:19 Ling-hua Tseng [this message]
2005-08-22 19:13 ` James E Wilson

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='000301c5a4d1$5b932fe0$0201a8c0@uranus' \
    --to=uranus@it.muds.net \
    --cc=gcc@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).