Page MenuHomePhabricator

[Support] Time profiler: support new PassManager
AbandonedPublic

Authored by anton-afanasyev on May 17 2019, 8:21 AM.

Details

Summary

Add time tracing of backend passes invoked by new PassManager.

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 17 2019, 8:21 AM

I know this is in line with what is done in old-pm, but i find the middle-end names to be very useless.
In particular, why is the actual optimization pass name is always in the description, and the actual timeslice name is always the same generic "Opt???"?
IMHO the actual optimization pass name should be the Name, not Detail.

I know this is in line with what is done in old-pm, but i find the middle-end names to be very useless.
In particular, why is the actual optimization pass name is always in the description, and the actual timeslice name is always the same generic "Opt???"?
IMHO the actual optimization pass name should be the Name, not Detail.

We can change this in a separate commits in both new and old pm.
Same name "Opt???" makes the same color in a flamechart. Btw, have you tried Speedscope (https://www.speedscope.app) for visualization? It works better than chrome://tracing, trying to show details in chart boxes.

I know this is in line with what is done in old-pm, but i find the middle-end names to be very useless.
In particular, why is the actual optimization pass name is always in the description, and the actual timeslice name is always the same generic "Opt???"?
IMHO the actual optimization pass name should be the Name, not Detail.

We can change this in a separate commits in both new and old pm.

Same name "Opt???" makes the same color in a flamechart.

Yes, indeed.
I *believe* it also makes double-clicking on one select *all* the slices with that "Opt???" name.
In other words, how do i group by the pass name?
It can be argued either way which is more important, sure.

Btw, have you tried Speedscope (https://www.speedscope.app) for visualization? It works better than chrome://tracing, trying to show details in chart boxes.

No, i know it exists, but i didn't try it..

I'm not really familiar with new-PM.
Can this perhaps have a test?

philip.pfaffe requested changes to this revision.May 20 2019, 3:34 AM
philip.pfaffe added a subscriber: philip.pfaffe.

I might have fallen a bit out of the loop, but can you tell me a bit more details about the use case here? There is no in-tree support for new-PM backend passes currently, is this for an out-of-tree user?
What about all the other IRUnit nestings beyond function passes in module pipelines?

Those questions aside, I'm not happy with the implementation. It uses global state, which is bad on its own, but in a way that isn't remotely threadsafe. It also cannot be easily made threadsafe without bigger redesign. Therefore, this isn't going to work in the new PM.

In the new PassManager we have a quite nice instrumentation infrastructure, which is perfectly suited to hook tracers such as this one into the pipeline execution. I suggest implementing -ftime-trace on top of that infrastructure. That being said, it appears as if there's quite some overlap between this tracer and the pass timing things. Why is the existing mechanism insufficient? Is the difference really just the output format? In which case, why not make that customizable instead of rolling out a second timing instrumentation?

This revision now requires changes to proceed.May 20 2019, 3:34 AM

I might have fallen a bit out of the loop, but can you tell me a bit more details about the use case here? There is no in-tree support for new-PM backend passes currently, is this for an out-of-tree user?
What about all the other IRUnit nestings beyond function passes in module pipelines?

Those questions aside, I'm not happy with the implementation. It uses global state, which is bad on its own, but in a way that isn't remotely threadsafe. It also cannot be easily made threadsafe without bigger redesign. Therefore, this isn't going to work in the new PM.

In the new PassManager we have a quite nice instrumentation infrastructure, which is perfectly suited to hook tracers such as this one into the pipeline execution. I suggest implementing -ftime-trace on top of that infrastructure. That being said, it appears as if there's quite some overlap between this tracer and the pass timing things. Why is the existing mechanism insufficient? Is the difference really just the output format? In which case, why not make that customizable instead of rolling out a second timing instrumentation?

Hmm, thank you for noting this all, I'm not familiar with new PM. Could you please describe instrumentation infrastructure you are suggesting?

In essence, the infrastructure is a set of callbacks that you can register with PassBuilder. Your callbacks then get invoked at various points withing pipelines built by PB.

See StandardInstrumentations as well as its use in opt's NewPMDriver for an example.

anton-afanasyev abandoned this revision.Jun 3 2019, 8:14 AM