GoingNative 12: C++ at Build 2012, Inside Profile Guided Optimization

Play GoingNative 12: C++ at Build 2012, Inside Profile Guided Optimization
Sign in to queue


Profile Guided Optimization, or PGO, is an approach to optimization where the compiler uses profile information to make better optimization decisions for the program.  Profiling is the process of gathering information of how the program is used during runtime.  In a nutshell, PGO is optimizations based on user scenarios whereas static optimizations rely on the source file structure. VC++ has supported this approach to measurement-based code optimization since VC2005. In this episode of GoingNative, we are going to dig into VC++'s implementation of PGO with some of the folks who make it: Program Manager Amit Mohindra and Development Lead Ten Tzen. Tune in.

Table of contents

[00:00]  GoingNative();\\ Charles and Ale discuss C++ at Build 2012 and introduce Profile Guided Optimization.

[04:09]  Charles interviews VC++ back end compiler team members Ten Tzen (lead developer) and Amit Mohindra (PM) about VC++'s implementation of PGO. Whiteboarding included. This is a long interview, so make some time.

[01:04:15]  ~GoingNative(); // Charles and Ale reflect on PGO, Charles answers Herb Sutter's question (that Herb asked Charles during his Build 2012 C++ session (in his intro remarks). Hi Herb!

We really want to hear from you, so please tweet feedback to @C9GoingNative (follow us!) and send your requests, ideas, complaints, praises, hate mail, and love letters to C9GoingNative at hotmail com. We will read and respond to all messages! That's how we roll, brothers and sisters. If you are a Facebook user, then please join our C9::GoingNative Facebook group.

Go native!



Right click to download this episode

The Discussion

  • User profile image

    Great show Charles. As an idea for a future episode, it would be awesome to get two or more senior Microsoft C++ devs, from different products and together talk about how they're using C++ 11 within their *existing* codebases. What new language idioms are they finding useful and what surprised them?



  • User profile image

    @dot_tom: Thanks, Tom. I've been trying to do just that. Unfortunately, nobody has taken the bait, only sniffed the hook and then swam away... I know you've asked this before and I'm sorry for not delivering on it (talk to folks not on the C++ team who use C++ in modern ways to solve modern problems). Will keep trying! (C++ devs are shy... Perhaps it's because they were kept in the dark for so long?..... Wink).


  • User profile image

    @Charles Are you fishing where the fishes are? (to parrot Laura)

  • User profile image

    Thanks for the show. Charles the C++ Knight!

  • User profile image

    For the love of god lol, just because Ale calls is "pogo" doesn't mean it's actually said that way... It's said as P-G-O, aka full acronym letter pronunciation :P
    Otherwise, Its a very crucial and amazing feature of a compiler, I've used it for years in both MS C++ and GCC.
    Thank you for the episode!

  • User profile image

    @Heavensrevenge: the technology is also sometimes referred to as POGO, thus the other way of saying it...


  • User profile image

    , Adam​Speight2008 wrote

    @Charles Are you fishing where the fishes are? (to parrot Laura)

    I don't understand the question.


  • User profile image

    @Charles: Just saying that I'm pretty sure it's just one of those MS lingo things to sound cool. As it stands, that term doesn't exist outside of the death star Tongue Out

  • User profile image

    Actually, its really Pogo

    The exported funtions in pgodb110.dll



    The modules in pgodb110.dll and pgort110.dll

    See ...Src\Tools\Pogo\....

    0002 F:\dd\vctools\Compiler\UTC\Src\Tools\Pogo\pogodb\objr\i386\pogodb.obj
    0003 F:\dd\vctools\Compiler\UTC\Src\Tools\Pogo\pogodb\objr\i386\pogodbmt.obj
    0004 F:\dd\vctools\Compiler\UTC\Src\Tools\Pogo\pogodb\objr\i386\loadui.obj
    0006 F:\dd\vctools\Compiler\UTC\Src\Tools\Pogo\pogodb\objr\i386\pgodb.rso
    0002 F:\dd\vctools\Compiler\UTC\Src\Tools\Pogo\irt\pgort\objr\i386\irtdll.obj
    0003 F:\dd\vctools\Compiler\UTC\Src\Tools\Pogo\irt\pgort\objr\i386\pogowin32interface.obj
    0004 F:\dd\vctools\Compiler\UTC\Src\Tools\Pogo\irt\pgort\objr\i386\pgort-loadui.obj
    0005 F:\dd\vctools\Compiler\UTC\Src\Tools\Pogo\irt\pgort\objr\i386\pgc.obj
    0007 F:\dd\vctools\Compiler\UTC\Src\Tools\Pogo\irt\pgort\objr\i386\pgort.rsoj


  • User profile image

    @felix9:  Leave it to Mary Jo Felix to get to the bottom of it!! ...


  • User profile image

    @charles: Actually they are big sharks in disguise :) You need to raise the bar ;) Then they might take a bait...

  • User profile image

    @Charles: Anytime ! Tongue Out

  • User profile image

    I use OpenMP heavily, and sadly it is said to be incompatible with PGO.  I suspect this is a major adoption block for many others too (if you have OpenMP usage statistics, you might be able to verify this).

    What's weirder is that a Connect issue I upvoted long ago about exactly this has just vanished off the net (here's the dead url).  The only trace I can find of a semi-explanation given there for this incompatibility persists in my blog:

       'Since PGO and OpenMP are both designed to increase performance, it is a shame that they can't be used together, but there were some major design issues preventing this. There is an ordering dependency in the designs of PGO and OpenMP. OpenMP changes some things about the program state that are important to PGO, and it does this after PGO has already processed the program state and made many decisions based on it.


    We will be considering a modification of the designs of PGO and/or OpenMP to get this to work in a future product version.'    [This was posted circa 2005   -Ofek]

    So guys - PGO is a great feature and i'd love to use it. But if you're serious about enhancing adoption, puh-leeese grab this bull by the horns, and give us PGO with OpenMP.

  • User profile image

    Clever bit about instrumenting using a spanning tree!

  • User profile image
    Marius Bancila

    @Heavensrevenge:just because you don't call it pogo, doesn't mean it's not called pogo  Tongue Out

Add Your 2 Cents