-
Notifications
You must be signed in to change notification settings - Fork 14
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
[AIE2/2P] Fix DONE latency at region end. #345
base: aie-public
Are you sure you want to change the base?
Conversation
@@ -176,6 +176,13 @@ struct AIEBaseInstrInfo : public TargetInstrInfo { | |||
} | |||
/// Check whether Opc represents a lock instruction | |||
virtual bool isLock(unsigned Opc) const { return false; } | |||
|
|||
/// Check whether Opc represents a DONE instruction | |||
virtual bool isDone(unsigned Opc) const { return false; } |
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.
nit: I hope no one needs to call this from outside. This one could go and instances could be private or inlined.
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.
made private.
virtual bool isDone(unsigned Opc) const { return false; } | ||
|
||
/// Get "implicit" latency for special instructions. | ||
virtual unsigned getImplicitLatency(const MachineInstr &) const { return 0; } |
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.
Can you document what that means?
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.
done.
@@ -280,6 +280,10 @@ class RegionEndEdges : public ScheduleDAGMutation { | |||
EdgeLatency = DelaySlots + 1; | |||
} | |||
|
|||
// "Implicit" latency for special instructions. | |||
const unsigned ImplicitLatency = TII->getImplicitLatency(MI); | |||
EdgeLatency = std::max(EdgeLatency, ImplicitLatency); |
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.
FYI @mludevid you might have done something similar when working on semaphores.
@@ -176,6 +176,13 @@ struct AIEBaseInstrInfo : public TargetInstrInfo { | |||
} | |||
/// Check whether Opc represents a lock instruction | |||
virtual bool isLock(unsigned Opc) const { return false; } | |||
|
|||
/// Check whether Opc represents a DONE instruction | |||
virtual bool isDone(unsigned Opc) const { return false; } |
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 we can have a design where we need just one method to be reimplemented. Something like:
virtual std::optional<unsigned> getDoneLatency(...)
In this case, we can have a base implementation for getImplicitLatency
that can be reimplemented by the target only if needed.
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.
@andcarminati, The idea was to have a more generic name excluding 'Done'. It's basically an extra latency that can be given to the exit edge. But yes, we would only have one generic method that fills it in.
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.
Hi, my idea is to avoid encode the latency knowledge separately. If we have a new done, we have two places to change.
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.
The aim was to encode all "special latencies" into one "getImplicitLatency", so that we don't touch AIEBaseSubTarget frequently. Is there another way other than having a separate function for Opcode to achieve all in one getImplicitLatency?
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.
Just as a suggestion, I was thinking in something like:
// Return an optional latency if Opc is a done instruction.
std::optional<unsigned>AIE2InstrInfo::getDoneLatency(unsigned Opc) const {
return (Opc == AIE2::DONE) ? 6 : std::nullopt
}
// This can be in the base class.
unsigned AIE2InstrInfo::getImplicitLatency(const MachineInstr &MI) const {
if (auto OptLatency = getDoneLatency(MI.getOpcode()))
return *OptLatency;
return 0;
}
New targets can just implement getDoneLatency
which will encode opcode + latency in the same place.
As I said, just a suggestion to have a single source of information here.
93896ab
to
913c317
Compare
No description provided.