From a3f2e483dda162cb5cd284c87bc09d72812b4dd4 Mon Sep 17 00:00:00 2001 From: Andrea Di Biagio Date: Tue, 20 Mar 2018 18:20:39 +0000 Subject: [llvm-mca] Move the logic that computes the scheduler's queue usage to the BackendStatistics view. This patch introduces two new callbacks in the event listener interface to handle the "buffered resource reserved" event and the "buffered resource released" event. Every time a buffered resource is used, an event is generated. Before this patch, the Scheduler (with the help of the ResourceManager) was responsible for tracking the scheduler's queue usage. However, that design forced the Scheduler to 'publish' scheduler's queue pressure information through the Backend interface. The goal of this patch is to break the dependency between the BackendStatistics view, and the Backend. Now the Scheduler knows how to notify "buffer reserved/released" events. The scheduler's queue usage analysis has been moved to the BackendStatistics. Differential Revision: https://reviews.llvm.org/D44686 llvm-svn: 328011 --- llvm/tools/llvm-mca/Backend.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/tools/llvm-mca/Backend.cpp') diff --git a/llvm/tools/llvm-mca/Backend.cpp b/llvm/tools/llvm-mca/Backend.cpp index cad7db3c438..7d694667d7f 100644 --- a/llvm/tools/llvm-mca/Backend.cpp +++ b/llvm/tools/llvm-mca/Backend.cpp @@ -75,6 +75,16 @@ void Backend::notifyResourceAvailable(const ResourceRef &RR) { Listener->onResourceAvailable(RR); } +void Backend::notifyReservedBuffers(ArrayRef Buffers) { + for (HWEventListener *Listener : Listeners) + Listener->onReservedBuffers(Buffers); +} + +void Backend::notifyReleasedBuffers(ArrayRef Buffers) { + for (HWEventListener *Listener : Listeners) + Listener->onReleasedBuffers(Buffers); +} + void Backend::notifyCycleEnd(unsigned Cycle) { DEBUG(dbgs() << "[E] Cycle end: " << Cycle << "\n\n"); for (HWEventListener *Listener : Listeners) -- cgit v1.2.3