ldc icon indicating copy to clipboard operation
ldc copied to clipboard

Compiler assertion: Statement not found in PGO counter map!

Open jondegenhardt opened this issue 5 years ago • 5 comments

As follow-up to discussion in #3054 I added ldc-latest-ci builds to the weekly cron job for a small performance testing app. The app builds with ThinLTO and PGO. Both the Linux and MacOS builds failed generating the instrumented builds. Error messages were similar:

ldc2: /home/vsts/work/1/s/gen/pgo_ASTbased.cpp:837: void CodeGenPGO::emitCounterIncrement(const RootObject*) const: Assertion `counter_it != (*RegionCounterMap).end() && "Statement not found in PGO counter map!"' failed.

This is first time I've built with the latest-ci builds. First thought is these builds might not setup to be generate the instrumented PGO builds. If so I'll just drop these from the cron job, let me know.

Build logs are here and here.

The app repo is here: jondegenhardt/dcat-perf. It's a small app, builds in less than 90 seconds. See the repo README for the build commands if you wish to try it.

jondegenhardt avatar May 09 '19 07:05 jondegenhardt

I guess this is solely because the latest CI builds feature enabled assertions, i.e., nothing new.

kinke avatar May 09 '19 09:05 kinke

Okay, thanks for the timely reply. I'll drop the PGO build from the weekly cron job. I'll let the LDC team decide whether to keep this issue open.

jondegenhardt avatar May 09 '19 16:05 jondegenhardt

So you're using AST-based PGO; it would be interesting to have a comparison with LLVM-intrinsic IR-based PGO, both in terms of build/profiling time (+ profile file size) and final runtime performance. I've never tried it, but it should be as simple as switching from -fprofile-instr-{generate,use} to -fprofile-{generate,use}.

kinke avatar May 09 '19 19:05 kinke

I did try IR PGO about a year ago but there were build issues at the time. Have not tried recently though. See #2582.

jondegenhardt avatar May 09 '19 20:05 jondegenhardt

At least one unhandled statement is also encountered when compiling the frontend itself with AST-based PGO (with a host compiler with enabled assertions); e.g., in #3980 tests.

kinke avatar May 14 '22 14:05 kinke