MPLLang / mpl

The MaPLe compiler for efficient and scalable parallel functional programming
Other
306 stars 18 forks source link

add prim `Heartbeat_tokens` for a faster `par` fast path #187

Closed shwestrick closed 1 month ago

shwestrick commented 1 month ago

A small change which avoids a C runtime call on the fast path of ForkJoin.par. The purpose of this C call, previously, was just to read and return the spareHeartbeatTokens field of the GCState.

We can avoid the overhead of the C runtime call by generating the appropriate code to read directly from the GCState. To do this, I implemented a new prim called Heartbeat_tokens which is eliminated in the ssa2-to-rssa pass.

I also renamed spareHeartbeats -> spareHeartbeatTokens in the runtime system for consistency.