fusion-plugin icon indicating copy to clipboard operation
fusion-plugin copied to clipboard

Propagate inline phase information

Open harendra-kumar opened this issue 5 years ago • 1 comments

The drain combinator is marked to be inlined in phase 2.

See this commit in the streamly repo. If the readDrain function is annotated plainly as INLINE then GHC is not able to inline it in the first phase (phase-2) for some reason because it is shared at two places in the bench group table. This has an effect that the drain does not fuse. If we mark readDrain as INLINE[2] then it fuses.

I have not investigated deeply but my guess is that if an underlying fusible function is marked to be inlined in a specific phase then we need to propagate that information to the functions that directly or indirectly call that function so that we can ensure that it is inlined in that phase.

harendra-kumar avatar Jul 09 '20 20:07 harendra-kumar

It should be noted that if we remove INLINE from readDrain then the code fuses because in that case readDrain is not inlined in the benchgroup list and the code inside readDrain is properly inlined and fuses.

harendra-kumar avatar Jul 09 '20 20:07 harendra-kumar