cosmobobak / viridithas

A superhuman chess engine.
MIT License
90 stars 8 forks source link

PGO #165

Closed mibere closed 3 weeks ago

mibere commented 1 month ago

As Rust in MSYS2 does not support PGO, I have Rust 1.79 natively installed on Windows 10 and Clang 18.1 via MSYS2.

The general compilation of Viridithas works fine and without errors. But, if someone knows how to do PGO... If I run these commands there are dozens of warnings with llvm-profdata and there is no merged.profdata.

This how-to with cargo-pgo and rustup component add llvm-tools-preview doesn't help either. Same error

Failed to merge PGO profile(s): warning: d:\Temp\viridithas-master\target\pgo-profiles\default_17648943948358147781_0.profraw: malformed instrumentation profile data: function name is empty
error: no profile can be merged
cosmobobak commented 1 month ago

I find that PGO on linux works perfectly when I do this:

$ mkdir tmp
$ cargo rustc -r --features syzygy,bindgen -- -C target-feature=+crt-static -C target-cpu=<TARGET_CPU> -C profile-generate=tmp --emit link=viridithas-profile
$ ./viridithas-profile bench
$ llvm-profdata merge -o tmp/merged.profdata tmp
$ cargo rustc -r --features syzygy,bindgen -- -C target-feature=+crt-static -C target-cpu=<TARGET_CPU> -C profile-use=tmp/merged.profdata --emit link=viridithas-pgo

I don't know if this is easily replicable on Windows.