Skip to content

[RISCV][SiFive7Model] Best way to provide custom VCIX latencies? #106669

Open
@michalt

Description

@michalt

I'm not sure if this belongs to a bug, but I wanted to open the conversation about the best approach to dealing with scheduling of VCIX instructions. What I'd like to be able to do is to:

  • Be able to provide accurate latencies of VCIX instructions in our internal LLVM build. (NB: These latencies would not be upstreamed)
  • But reuse the upstream SiFive7Model.
  • Make it reasonably easy to keep up with the upstream changes of SiFive7Model (e.g., manually copy & paste of the VCIX latencies would be ok, but it'd be nice to avoid anything more complicated).

What would be the best approach to achieve this?

Idea 1:

  • Create a copy of RISCVSchedSiFive7.td (let's call it RISCVSchedSiFive7Foobar.td).
  • But this leads to name conflicts since everything is just included in RISCV.td.
  • So one could run sed s/SiFive7/SiFive7Foobar/g over the file. This is not quite enough (VLDSX0Pred conflicts); perhaps we could try to use the SiFive7 prefix for all definitions in that file? Would that be acceptable?
  • The above should be mostly mechanical (could be automated by a script). Then it would be a matter of (semi-)manually adjusting the VCIX scheduling information.

Idea 2:

  • Perhaps we could refactor RISCVSchedSiFive7.td to have something like SiFive7ModelTemplate that would be a multiclass and could be instantiated with different VCIX scheduling information? (i.e., we would just instantiate it to create the current  SiFive7Model)
  • This seems like a cleaner approach where RISCVSchedSiFive7Foobar.td would not have to be a copy (with all the sed renaming), it would just instantiate the model and provide the custom VCIX latencies.
  • But I'm not sure if this is even feasible? (not a TableGen expert!) Would we run into some issues with this? Would it significantly increase the maintenance burden of RISCVSchedSiFive7.td?

@topperc @michaelmaitland What are your thoughts? Any better ideas would be appreciated! 🙂 

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:RISC-VquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions