-
Notifications
You must be signed in to change notification settings - Fork 14.6k
[RISCV] add load/store misched/PostRA subtarget features #149409
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
Open
danielhb
wants to merge
5
commits into
llvm:main
Choose a base branch
from
danielhb:load_store_cluster_opts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9de5329
[RISCV] add load/store misched/PostRA cluster options
danielhb 7603a09
misched-load-clustering.ll: exercise new clustering flags
danielhb 281d756
Adding load/store clustering as subtarget features
danielhb f1433bd
Invert the enum logic like TuneNoDefaultUnroll does
danielhb 8561859
Remove 'enableXXXClustering' methods from RISCVSubtarget.h
danielhb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
; REQUIRES: asserts | ||
; | ||
; Disable all misched clustering | ||
; RUN: llc -mtriple=riscv32 -verify-misched \ | ||
; RUN: -mattr=+disable-misched-load-clustering,+disable-misched-store-clustering \ | ||
; RUN: -debug-only=machine-scheduler -o - 2>&1 < %s \ | ||
; RUN: | FileCheck -check-prefix=NOCLUSTER %s | ||
; RUN: llc -mtriple=riscv64 -verify-misched \ | ||
; RUN: -mattr=+disable-misched-load-clustering,+disable-misched-store-clustering \ | ||
; RUN: -debug-only=machine-scheduler -o - 2>&1 < %s \ | ||
; RUN: | FileCheck -check-prefix=NOCLUSTER %s | ||
; | ||
; ST misched clustering only | ||
; RUN: llc -mtriple=riscv32 -verify-misched \ | ||
; RUN: -mattr=+disable-misched-load-clustering \ | ||
; RUN: -debug-only=machine-scheduler -o - 2>&1 < %s \ | ||
; RUN: | FileCheck -check-prefix=STCLUSTER %s | ||
; RUN: llc -mtriple=riscv64 -verify-misched \ | ||
; RUN: -mattr=+disable-misched-load-clustering \ | ||
; RUN: -debug-only=machine-scheduler -o - 2>&1 < %s \ | ||
; RUN: | FileCheck -check-prefix=STCLUSTER %s | ||
; | ||
; LD misched clustering only | ||
; RUN: llc -mtriple=riscv32 -verify-misched \ | ||
; RUN: -mattr=+disable-misched-store-clustering \ | ||
; RUN: -debug-only=machine-scheduler -o - 2>&1 < %s \ | ||
; RUN: | FileCheck -check-prefix=LDCLUSTER %s | ||
; RUN: llc -mtriple=riscv64 -verify-misched \ | ||
; RUN: -mattr=+disable-misched-store-clustering \ | ||
; RUN: -debug-only=machine-scheduler -o - 2>&1 < %s \ | ||
; RUN: | FileCheck -check-prefix=LDCLUSTER %s | ||
; | ||
; Default misched cluster settings (i.e. both LD and ST clustering) | ||
; RUN: llc -mtriple=riscv32 -verify-misched \ | ||
; RUN: -debug-only=machine-scheduler -o - 2>&1 < %s \ | ||
; RUN: | FileCheck -check-prefix=DEFAULTCLUSTER %s | ||
; RUN: llc -mtriple=riscv64 -verify-misched \ | ||
; RUN: -debug-only=machine-scheduler -o - 2>&1 < %s \ | ||
; RUN: | FileCheck -check-prefix=DEFAULTCLUSTER %s | ||
|
||
define i32 @store_clustering_1(ptr nocapture %p, i32 %v) { | ||
; NOCLUSTER: ********** MI Scheduling ********** | ||
; NOCLUSTER-LABEL: store_clustering_1:%bb.0 | ||
; NOCLUSTER: *** Final schedule for %bb.0 *** | ||
; NOCLUSTER: SU(2): SW %1:gpr, %0:gpr, 12 :: (store (s32) into %ir.arrayidx0) | ||
; NOCLUSTER: SU(3): SW %1:gpr, %0:gpr, 8 :: (store (s32) into %ir.arrayidx1) | ||
; NOCLUSTER: SU(4): SW %1:gpr, %0:gpr, 4 :: (store (s32) into %ir.arrayidx2) | ||
; NOCLUSTER: SU(5): SW %1:gpr, %0:gpr, 16 :: (store (s32) into %ir.arrayidx3) | ||
; | ||
; STCLUSTER: ********** MI Scheduling ********** | ||
; STCLUSTER-LABEL: store_clustering_1:%bb.0 | ||
; STCLUSTER: *** Final schedule for %bb.0 *** | ||
; STCLUSTER: SU(4): SW %1:gpr, %0:gpr, 4 :: (store (s32) into %ir.arrayidx2) | ||
; STCLUSTER: SU(3): SW %1:gpr, %0:gpr, 8 :: (store (s32) into %ir.arrayidx1) | ||
; STCLUSTER: SU(2): SW %1:gpr, %0:gpr, 12 :: (store (s32) into %ir.arrayidx0) | ||
; STCLUSTER: SU(5): SW %1:gpr, %0:gpr, 16 :: (store (s32) into %ir.arrayidx3) | ||
; | ||
; LDCLUSTER: ********** MI Scheduling ********** | ||
; LDCLUSTER-LABEL: store_clustering_1:%bb.0 | ||
; LDCLUSTER: *** Final schedule for %bb.0 *** | ||
; LDCLUSTER: SU(2): SW %1:gpr, %0:gpr, 12 :: (store (s32) into %ir.arrayidx0) | ||
; LDCLUSTER: SU(3): SW %1:gpr, %0:gpr, 8 :: (store (s32) into %ir.arrayidx1) | ||
; LDCLUSTER: SU(4): SW %1:gpr, %0:gpr, 4 :: (store (s32) into %ir.arrayidx2) | ||
; LDCLUSTER: SU(5): SW %1:gpr, %0:gpr, 16 :: (store (s32) into %ir.arrayidx3) | ||
; | ||
; DEFAULTCLUSTER: ********** MI Scheduling ********** | ||
; DEFAULTCLUSTER-LABEL: store_clustering_1:%bb.0 | ||
; DEFAULTCLUSTER: *** Final schedule for %bb.0 *** | ||
; DEFAULTCLUSTER: SU(4): SW %1:gpr, %0:gpr, 4 :: (store (s32) into %ir.arrayidx2) | ||
; DEFAULTCLUSTER: SU(3): SW %1:gpr, %0:gpr, 8 :: (store (s32) into %ir.arrayidx1) | ||
; DEFAULTCLUSTER: SU(2): SW %1:gpr, %0:gpr, 12 :: (store (s32) into %ir.arrayidx0) | ||
; DEFAULTCLUSTER: SU(5): SW %1:gpr, %0:gpr, 16 :: (store (s32) into %ir.arrayidx3) | ||
entry: | ||
%arrayidx0 = getelementptr inbounds i32, ptr %p, i32 3 | ||
store i32 %v, ptr %arrayidx0 | ||
%arrayidx1 = getelementptr inbounds i32, ptr %p, i32 2 | ||
store i32 %v, ptr %arrayidx1 | ||
%arrayidx2 = getelementptr inbounds i32, ptr %p, i32 1 | ||
store i32 %v, ptr %arrayidx2 | ||
%arrayidx3 = getelementptr inbounds i32, ptr %p, i32 4 | ||
store i32 %v, ptr %arrayidx3 | ||
ret i32 %v | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think @topperc meant to mimic something like "bool RISCVSubtarget::useAA()" for example
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.
No I meant something we could set per-CPU like this.