<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">On Mar 3, 2020, at 4:12 AM, Fedor Sergeev via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<div><blockquote type="cite" class=""><div class="">
  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
  
  <div text="#000000" bgcolor="#FFFFFF" class="">
    Oops.. sorry, hit send too soon..<br class="">
    <blockquote type="cite" class="">
      <div class="">I can't say anything about the GCC side, but this isn't a
        particularly novel aspect of the MLIR pass manager. In many
        ways, the pass manager is the easiest/simplest part of the
        multi-threading problem. The bigger problem is making sure that
        the rest of the compiler infrastructure is structured in a way
        that is thread-safe, or can be made thread-safe. This is why
        most of the discussion is based around how to model things like
        constants, global values, etc. When I made MLIR multi-threaded a
        year ago, a large majority of my time was spent outside of the
        pass manager. For a real example, I spent much more time just on
        <a href="https://mlir.llvm.org/docs/WritingAPass/#multi-threaded-pass-timing" class="">multi-threaded
          pass timing</a> than making the pass manager itself
        multi-threaded.</div>
    </blockquote>
    Picking on this point, perhaps a bit off-topic for the whole
    discussion.<br class="">
    <br class="">
    I have recently realized that for the purpose of multi-threaded pass
    timing currently existing LLVM timers<br class="">
    are hardly suitable since they measure per-process time instead of
    per-thread time.<br class="">
    (and there seem to be no portable LLVM interfaces for per-thread
    time query :( )<br class="">
    <br class="">
    From a first glance it seems that in your MLIR timing examples all
    the times are also per-process.<br class="">
    How do you handle cases when half of your threads are doing
    something else?<br class="">
    And if you handle it per-thread - can you point me to the code doing
    that, pls :)<br class=""></div></div></blockquote><br class=""></div><div>Indeed, how you account for things is important.  Please take a look at "Multi-threaded Pass Timing”  on this page:</div><div><a href="https://mlir.jackwish.net/writingapass#pass-manager" class="">https://mlir.llvm.org/docs/WritingAPass/</a></div><div class=""><br class=""></div><div class="">-Chris</div></body></html>