bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Stop listing `.gcno` files as outputs when using LLVM coverage map format

Open brentleyjones opened this issue 9 months ago • 8 comments

When using --experimental_use_llvm_covmap, no .gcno files are output. By listing them as outputs there is a mismatch between expected and actual outputs. Bazel will create these empty files after the action is run, but they non-deterministically get counted in the Action outputs, which can lead to cache misses on subsequent runs.

brentleyjones avatar Apr 25 '24 18:04 brentleyjones

Cc @c-mita

fmeum avatar Apr 25 '24 20:04 fmeum

@bazel-io flag

brentleyjones avatar Apr 26 '24 17:04 brentleyjones

@bazel-io fork 7.2.0

iancha1992 avatar Apr 26 '24 18:04 iancha1992

I'm pretty sure this will break something, at least internally; coverage flags in our toolchains are predicated on the presence of the "gcov_gcno_file" variable (although I don't think this is the case for Bazel's default toolchain), which is passed when these files are declared.

I think more of a refactor is needed before a change like this can be made.

c-mita avatar Apr 29 '24 08:04 c-mita

What compromise can I make to get this over the finish line? I would really like this to get into 7.2.0, as it's a big source of cache misses for us.

brentleyjones avatar Apr 29 '24 16:04 brentleyjones

Basically, there needs to be another way of entering this branch https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/rules/cpp/CompileBuildVariables.java;l=372

I am pretty sure the actual value doesn't matter and nobody depends on it, only its presence.

c-mita avatar Apr 29 '24 16:04 c-mita

So I can pass down an empty string when isCodeCoverageEnabled, and that should satisfy it? If so, I can add a comment on why we are doing that, and call it good.

brentleyjones avatar Apr 29 '24 16:04 brentleyjones

@c-mita I made a change. LMK what you think.

brentleyjones avatar Apr 29 '24 18:04 brentleyjones