Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

brentleyjones
Copy link
Contributor

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.

@github-actions github-actions bot added team-Rules-CPP Issues for C++ rules awaiting-review PR is awaiting review from an assigned reviewer labels Apr 25, 2024
@fmeum
Copy link
Collaborator

fmeum commented Apr 25, 2024

Cc @c-mita

@brentleyjones
Copy link
Contributor Author

@bazel-io flag

@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Apr 26, 2024
@iancha1992
Copy link
Member

@bazel-io fork 7.2.0

@bazel-io bazel-io removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Apr 26, 2024
@c-mita
Copy link
Member

c-mita commented Apr 29, 2024

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.

@brentleyjones
Copy link
Contributor Author

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.

@c-mita
Copy link
Member

c-mita commented Apr 29, 2024

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.

@brentleyjones
Copy link
Contributor Author

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.

…rmat

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.

Signed-off-by: Brentley Jones <github@brentleyjones.com>
@brentleyjones brentleyjones force-pushed the bj/stop-listing-.gcno-files-as-outputs-when-using-llvm-coverage-map-format branch from 60d17fe to c97ef77 Compare April 29, 2024 18:28
@brentleyjones
Copy link
Contributor Author

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

Copy link
Member

@c-mita c-mita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is "fine".

We should probably simplify things and remove the passing around of the, possibly null, gcnoFile Artifact since, AFAICT, the actual value of this variable isn't important. But that's a riskier change that I can follow up on later.

We should also probably rename the variable in the future (another round of fun) and actually document it.

@c-mita c-mita added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels May 2, 2024
@copybara-service copybara-service bot closed this in a4d77c5 May 6, 2024
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label May 6, 2024
c-mita pushed a commit to c-mita/bazel that referenced this pull request May 7, 2024
…e map format

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.

Closes bazelbuild#22132.

PiperOrigin-RevId: 630996820
Change-Id: Ia7de7a05305095c8befee4f86181cf84d9737814
github-merge-queue bot pushed a commit that referenced this pull request May 7, 2024
…e map format (#22275)

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.

Closes #22132.

PiperOrigin-RevId: 630996820
Change-Id: Ia7de7a05305095c8befee4f86181cf84d9737814

Co-authored-by: Brentley Jones <github@brentleyjones.com>
Kila2 pushed a commit to Kila2/bazel that referenced this pull request May 13, 2024
…rmat

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.

Closes bazelbuild#22132.

PiperOrigin-RevId: 630996820
Change-Id: Ia7de7a05305095c8befee4f86181cf84d9737814
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants