Skip to content

[RISCV] Add UnsupportedSchedZfhExceptForZfhmin for processors only support Zfhmin #120196

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

Closed
wants to merge 1 commit into from

Conversation

BoyaoWang430
Copy link
Contributor

Zfhmin is required in rva23. Add UnsupportedSchedZfhExceptForZfhmin for processors only support Zfhmin.

@llvmbot
Copy link
Member

llvmbot commented Dec 17, 2024

@llvm/pr-subscribers-backend-risc-v

Author: None (BoyaoWang430)

Changes

Zfhmin is required in rva23. Add UnsupportedSchedZfhExceptForZfhmin for processors only support Zfhmin.


Full diff: https://github.com/llvm/llvm-project/pull/120196.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVSchedule.td (+25)
diff --git a/llvm/lib/Target/RISCV/RISCVSchedule.td b/llvm/lib/Target/RISCV/RISCVSchedule.td
index 1fdbc7cbcbaf4a..ecd5329f5710fe 100644
--- a/llvm/lib/Target/RISCV/RISCVSchedule.td
+++ b/llvm/lib/Target/RISCV/RISCVSchedule.td
@@ -257,6 +257,31 @@ def : ReadAdvance<ReadFSqrt16, 0>;
 } // Unsupported = true
 }
 
+multiclass UnsupportedSchedZfhExceptForZfhmin {
+let Unsupported = true in {
+def : WriteRes<WriteFAdd16, []>;
+def : WriteRes<WriteFClass16, []>;
+def : WriteRes<WriteFDiv16, []>;
+def : WriteRes<WriteFCmp16, []>;
+def : WriteRes<WriteFMA16, []>;
+def : WriteRes<WriteFMinMax16, []>;
+def : WriteRes<WriteFMul16, []>;
+def : WriteRes<WriteFSGNJ16, []>;
+def : WriteRes<WriteFST16, []>;
+def : WriteRes<WriteFSqrt16, []>;
+
+def : ReadAdvance<ReadFAdd16, 0>;
+def : ReadAdvance<ReadFClass16, 0>;
+def : ReadAdvance<ReadFDiv16, 0>;
+def : ReadAdvance<ReadFCmp16, 0>;
+def : ReadAdvance<ReadFMA16, 0>;
+def : ReadAdvance<ReadFMinMax16, 0>;
+def : ReadAdvance<ReadFMul16, 0>;
+def : ReadAdvance<ReadFSGNJ16, 0>;
+def : ReadAdvance<ReadFSqrt16, 0>;
+} // Unsupported = true
+}
+
 multiclass UnsupportedSchedF {
 let Unsupported = true in {
 def : WriteRes<WriteFST32, []>;

@@ -257,6 +257,31 @@ def : ReadAdvance<ReadFSqrt16, 0>;
} // Unsupported = true
}

multiclass UnsupportedSchedZfhExceptForZfhmin {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really like adding unused things to the repo. It's likely to get deleted because it doesn't look used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reminding!
Here I'd like to start the discussion: how should we handle the scheduling model of overlapped extensions like Zfhmin and Zfh? We know that only Zfhmin is mandatory in RVA23.
For current implementation, the scheduling model is not so fine-grained. For example, if we only support Zfhmin, then we don't need to define UnsupportedSchedZfh, but we still need to set Unsupported to true for arithmetic operations. And this is what we want to fix in this PR.

topperc added a commit to topperc/llvm-project that referenced this pull request Dec 17, 2024
…lticlasses. NFC

Split UnsupportedSchedZfhmin from UnsupportedSchedZfh. UnsupportedSchedZfhmin
inherits from UnsupportedSchedZfh and should be used when no F16 is
supported. UnsupportedSchedZfh can be used direclty for CPUs that support
Zfhmin but not Zfh.

Make UnsupportedSchedF inherit from both UnsupportedSchedD and
UnsupportedSchedZfhmin so that CPUs with no FP only need to include
UnsupportedSchedF. This required some minor refactorings to
RISCVSchedSyntacoreSCR345.td. I've also switch to inheritance instead
of using defm.

Alternative to llvm#120196.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants