-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[MIPS] Add Scheduling model for MIPS i6400 and i6500 CPUs #132704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for working on this! Can you please share a document that shows the instruction latencies? |
|
||
// LSU pipelines | ||
// ============= | ||
def : InstRW<[I6400WriteLSUStore], (instrs SB, SD, SH, SW, SDC1, SDC164, SWC1, SWC2_R6, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible avoid using SchedWriteRes
+ InstRW
and using the normal SchedWrite
+ WriteRes
instead?
InstRW
really should be used for "ad-hoc fixing" nowadays (e.g. instruction A & B share the same scheduling class in their instruction definitions, but they should be in two different scheduling classes in your core)
Hi, please find the instruction latency at public document: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf |
d22c99a
to
e1a086e
Compare
mul $3, $2, $3 | ||
sw $3, 8($sp) | ||
div $2, $1 | ||
sw $2, 0($sp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add more tests on simple integer and floating point arithmetics instructions, as well as some vector instructions (they're called MSA?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. I will add. thank you for the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have extended the existing test to cover more instructions.
Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit
i6400 and i6500 are in-order cores. hence set BufferSize and MicroBufferSize to 0
- remove hasNoSchedulingInfo in Mips32r6InstrInfo.td - define BufferSize to 0 for all resources - remove timeline test in llvm-mca testcase
b9b1cf4
to
6784668
Compare
Extend i64..s to cover more instructions including MSA
@@ -0,0 +1,133 @@ | |||
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py | |||
# RUN: llvm-mca -mtriple=mips64el -mcpu=i6400 --mattr=msa -timeline -iterations=1 < %s | FileCheck %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when I suggested to remove -timeline
for scheduling model test, I meant remove this flag from the RUN
line and run update_mca_test_checks.py
again to update the test (rather than manually remove the related CHECKs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for pointing me the process. I have now removed --timeline option and rerun with update_mca_test_checks.py
@@ -0,0 +1,133 @@ | |||
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py | |||
# RUN: llvm-mca -mtriple=mips64el -mcpu=i6400 --mattr=msa -timeline -iterations=1 < %s | FileCheck %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked the processor definitions: please correct me if I'm wrong, but it seems like none of the in-tree MIPS processors support MSA, then why did you want to assign meaningful latency/occupancy to those instructions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i6400 and i6500 comes with MSA implemented and enabled by default, user can disable MSA with reset bit from the software. I think I need to enable FeatureMSA as part of i6400/i6500 cpu definition. I have created a separate PR: #134985
removed --timeline option from the RUN command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I'm not really a fan of using InstRW as I pointed out in one of my comments. But I guess it's up to MIPS maintainers to make the call on that. Other than that, LGTM.
@djtodoro do you have any other comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets try to avoid InstRW
.
Hi, thank you for the review and the feedback. We have started porting work. We will port all existing scheduling model for MIPS cpus to new scheduling API soon. |
OK, it can be addressed as a separate PR, but please handle all MIPS CPUs that use |
yes sure. thank you. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/23854 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/54/builds/8671 Here is the relevant piece of the build log for the reference
|
…vm#132704)" This reverts commit ffcca51.
Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
…vm#132704)" (llvm#137767) This reverts commit ffcca51.
You forgot to add |
Thank you. I will add lit.local.cfg and create new pr. thanks for your feedback. |
…2704) Relands llvm#132704 with a fix in the testcase: Add llvm/test/tools/llvm-mca/Mips/lit.local.cfg Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
#137984) Relands #132704 with a fix in the testcase: Add llvm/test/tools/llvm-mca/Mips/lit.local.cfg Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/17043 Here is the relevant piece of the build log for the reference
|
Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
…vm#132704)" (llvm#137767) This reverts commit ffcca51.
…2704) (llvm#137984) Relands llvm#132704 with a fix in the testcase: Add llvm/test/tools/llvm-mca/Mips/lit.local.cfg Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
…vm#132704)" (llvm#137767) This reverts commit ffcca51.
…2704) (llvm#137984) Relands llvm#132704 with a fix in the testcase: Add llvm/test/tools/llvm-mca/Mips/lit.local.cfg Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
…vm#132704)" (llvm#137767) This reverts commit ffcca51.
…2704) (llvm#137984) Relands llvm#132704 with a fix in the testcase: Add llvm/test/tools/llvm-mca/Mips/lit.local.cfg Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
…vm#132704)" (llvm#137767) This reverts commit ffcca51.
…2704) (llvm#137984) Relands llvm#132704 with a fix in the testcase: Add llvm/test/tools/llvm-mca/Mips/lit.local.cfg Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor. i6400 and i6500 share same instruction latencies. CPU has following pipelines - Two ALUs - Multiply and Divide unit (MDU) - Branch Unit (CTU) - Load/Store Unit (LSU) - Short Floating-point Unit and - Long Floating-point Unit Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf
…vm#132704)" (llvm#137767) This reverts commit ffcca51.
Add scheduling model for the MIPS i6400 and i6500, an in-order MIPS64R6 processor.
i6400 and i6500 share same instruction latencies.
CPU has following pipelines
Latency information is available at: https://mips.com/wp-content/uploads/2025/03/MIPS_I6500-F_Data_Sheet_Rev1.10_3-17-2025.pdf