[PATCH] D44309: [llvm-mca] Revactor event listeners to make the backend agnostic to event types.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 03:35:05 PDT 2018


courbet added a comment.

Thanks, PTAL.



================
Comment at: tools/llvm-mca/HWEventListener.h:24
 
-class HWEventListener {
+// An event
+class HWInstructionEvent {
----------------
andreadb wrote:
> We need a better (doxygen) comment here.
oops.


================
Comment at: tools/llvm-mca/HWEventListener.h:27
 public:
-  // Events generated by the Retire Control Unit.
-  virtual void onInstructionRetired(unsigned Index) {};
+  // FIXME: This should be subtarget-specific. Move to TD files.
+  enum EventType {
----------------
andreadb wrote:
> Could you please explain what is the long term goal? Do you plan to remove this EventType?
I've given it a shot, tell me what you think.


================
Comment at: tools/llvm-mca/Scheduler.h:457-458
+
+  // The dispatch unit gets notified when instructions are executed.
+  DispatchUnit *DU;
 
----------------
andreadb wrote:
> Is the plan to remove this dependency in the long term?
Not really. If we want the Backend class to be agnostic to the pipeline structure, we need inter-component dependencies to be carried by the component themselves. The pipeline creation function (in the subtarget, see https://reviews.llvm.org/D43951?id=136547#inline-384507) should be the one that does that the plugging.

However it would be better if the DispatchUnit was given in the ctor, maybe through some wrapper object (but let's do that if the need arises).



Repository:
  rL LLVM

https://reviews.llvm.org/D44309





More information about the llvm-commits mailing list