Yes, good point. The branch hinting proposal has a very similar goal. And yes, outlining cold blocks into separate functions has downsides, but as V8 (and maybe other engines?) move to lazy tier-up, the outlining can improve startup performance get reach peak performance sooner by reducing the amount of code that needs to be tiered up.
I know PGO is on our list of things we'd like to get to eventually, but I don't think we have any specific plans to work on it soon. On Wed, Jan 12, 2022 at 10:14 PM Soeren Balko <[email protected]> wrote: > Interesting, as I understand branch hinting is already WebAssembly > proposal that is being worked on. Perhaps it could be use to segregate away > the "cold" blocks (branches). Moving cold blocks into functions (as the > only existing modularization concept in wasm) seems quite complex and > possibly introduce a performance penalty when calling cold code. Also, I > wonder if the (tiered) WebAssembly runtimes would even be smart enough to > treat hot functions differently from cold ones. But I am really out of my > depth here, not sure if any of this makes sense. > > In a more general sense: Emscripten once had PGO, which now seems to be > deprecated (is it?). Are there any plans to bring it back? We've got some > very specific workloads, for which we have performance profiles that we'd > love to feed back into the build process. > > Soeren > > > > On Wednesday, January 12, 2022 at 6:27:38 PM UTC+10 [email protected] > wrote: > >> IIRC, Bolt reorganizes binaries to separate out cold blocks into separate >> code sections. A similar optimization would probably be useful in >> WebAssembly, but it would have to outline the cold blocks into separate >> functions. Alternatively, we could add some sort of hinting about cold >> blocks in a custom section and let the WebAssembly engine perform this >> optimization on the compiled code. >> >> On Wed, Jan 12, 2022 at 01:32 Soeren Balko <[email protected]> wrote: >> >>> The good people at Facebook just landed their "Bolt" optimizer in LLVM: >>> llvm-project/bolt >>> at main ยท llvm/llvm-project (github.com) >>> <https://github.com/llvm/llvm-project/tree/main/bolt> >>> >>> Bolt is currently limited to x86-64 and AArch64. Given the lofty >>> performance uplift that Bolt claims to deliver, I wonder if WebAssembly >>> would benefit from it. Any thoughts? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "emscripten-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/emscripten-discuss/1cd76c9b-7ea9-4fd4-9678-72b080204f5an%40googlegroups.com >>> <https://groups.google.com/d/msgid/emscripten-discuss/1cd76c9b-7ea9-4fd4-9678-72b080204f5an%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/1d700f91-ad66-426a-a31f-305970c1d80an%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/1d700f91-ad66-426a-a31f-305970c1d80an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAJZD_EUdasBD1mJvyk%2B%2BXvMFE2m7vKHbr_RdfTW304_F2CTzow%40mail.gmail.com.
