thepowersgang / mrustc

Alternative rust compiler (re-implementation)
MIT License
2.18k stars 109 forks source link

Add PGO support #304

Closed zamazan4ik closed 2 months ago

zamazan4ik commented 1 year ago

Since the upstream rustc supports PGO and clang gains benefits from PGO too I think would be a good idea to provide PGO build variant to mrustc as well.

thepowersgang commented 1 year ago

Would that mean mrustc itself built using PGO, or the rustc built by mrustc using PGO?

I've never worked with PGO, so cannot comment as to the ease of either - but speed isn't really the goal of mrustc, correctness is.

zamazan4ik commented 1 year ago

Would that mean mrustc itself built using PGO, or the rustc built by mrustc using PGO?

Building mrustc with PGO.

but speed isn't really the goal of mrustc, correctness is.

PGO does not affect the correctness of a program - just a performance improvement.

I've never worked with PGO

I suggest starting with the documentation for your compiler. E.g. for Clang the documentation is here. More materials about PGO (results, more advanced techniques like LLVM BOLT, possibly helpful notes) are here. I hope it helps.

thepowersgang commented 1 year ago

I'll rephrase my previous comment - My personal focus is on getting mrustc to correctly produce code, not to focus on making it fast.

I wouldn't be too against someone else experimenting with PGO and seeing if it improves performance enough to be worth including.