-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[AMDGPU][NFC] Extend PredicateControl to support True16 predicates. #82245
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
Merged
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//===-- AMDGPUPredicateControl.td --------------------------*- tablegen -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
def TruePredicate : Predicate<"">; | ||
|
||
// FIXME: Tablegen should specially supports this | ||
def FalsePredicate : Predicate<"false">; | ||
|
||
// Add a predicate to the list if does not already exist to deduplicate it. | ||
class PredConcat<Predicate pred, list<Predicate> lst> { | ||
list<Predicate> ret = !listconcat(lst, !listremove([pred], lst)); | ||
} | ||
|
||
// Prevent using other kinds of predicates where True16 predicates are | ||
// expected by giving them their own class. | ||
class True16PredicateClass<string cond> : Predicate<cond>; | ||
def NoTrue16Predicate : True16PredicateClass<"">; | ||
|
||
class PredicateControl { | ||
Predicate SubtargetPredicate = TruePredicate; | ||
Predicate AssemblerPredicate = TruePredicate; | ||
Predicate WaveSizePredicate = TruePredicate; | ||
True16PredicateClass True16Predicate = NoTrue16Predicate; | ||
list<Predicate> OtherPredicates = []; | ||
list<Predicate> Predicates = | ||
PredConcat<SubtargetPredicate, | ||
PredConcat<AssemblerPredicate, | ||
PredConcat<WaveSizePredicate, | ||
PredConcat<True16Predicate, | ||
OtherPredicates>.ret>.ret>.ret>.ret; | ||
} |
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
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.
There are other places in the same file that also need to be taken care of:
VOP3_DPP16_Gen, VOP3_Real_Gen for example.
Do we actually have to introduce True16Predicate?
I think we have already used listconcat to add a new predicate into OtherPredicates list.
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.
Pasting
OtherPredicates
could help your particular case, but wouldn't resolve the more general problem of overriding predicates for various groups of instructions and inheriting them from their corresponding pseudos.The idea is to start using
True16Predicate
gradually as will seem necessary for future patches.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.
Do you have any examples that we can not use pasting to resolve the overriding issue for OtherPredicates?
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.
In real instructions we can paste with
OtherPredicates
of their pseudos, but there's no way to extend selfOtherPredicates
of classes and records. So everylet OtherPredicates = ...
potentially overrides some needed predicates and so havingTrue16Predicate
makes it a bit easier to avoid clashes.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.
It is Okay to me to introduce True16Predicate if we don't know what is exactly in OtherPredicates when we try to extend it.