Skip to content

[Coverage] ProfileData: Handle MC/DC Bitmap as BitVector. NFC. #80608

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

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

chapuni
Copy link
Contributor

@chapuni chapuni commented Feb 4, 2024

  • getFunctionBitmap() stores not std::vector<uint8_t> but BitVector.
  • CounterMappingContext holds Bitmap (instead of the ref of bytes)
  • Bitmap and BitmapIdx are used instead of evaluateBitmap().

FIXME: InstrProfRecord itself should handle Bitmap as BitVector.

* `getFunctionBitmap()` stores not `std::vector<uint8_t>` but `BitVector`.
* `CounterMappingContext` holds `Bitmap` (instead of the ref of bytes)
* `Bitmap` and `BitmapIdx` are used insted of `evaluateBitmap()`.
@chapuni chapuni requested review from ornata and evodius96 February 4, 2024 17:48
@ornata
Copy link

ornata commented Feb 5, 2024

Cool, this looks a lot cleaner.

Are there performance improvements as a result of this change?

The BitVector container provides a dynamic size set of bits for manipulation. It supports individual bit setting/testing, as well as set operations. The set operations take time O(size of bitvector), but operations are performed one word at a time, instead of one bit at a time. This makes the BitVector very fast for set operations compared to other containers. Use the BitVector when you expect the number of set bits to be high (i.e. a dense set).
(https://llvm.org/docs/ProgrammersManual.html#bitvector)

If there are, it would be nice to include them in the commit message.

@chapuni
Copy link
Contributor Author

chapuni commented Feb 5, 2024

@ornata Thanks for the look.

Are there performance improvements as a result of this change?

I haven't measured yet. Since llvm-cov is still so slow with the large data, I think we have to improve it. We could measure then.

If there are, it would be nice to include them in the commit message.

I know I haven't done completely. I guess InstrProfReader could decode ULEB128 into BitVector directly.
It was not my task for now, since it doesn't prevent my improvements.
So, it'd be happy to do when we could improve InstrProfReader.

@chapuni chapuni merged commit 4926f12 into llvm:main Feb 5, 2024
@chapuni chapuni deleted the mcdc/bitmap branch February 5, 2024 03:55
@chapuni
Copy link
Contributor Author

chapuni commented Feb 5, 2024

Seems this doesn't work on bigendian hosts.
https://lab.llvm.org/buildbot/#/builders/72/builds/2335

@chapuni
Copy link
Contributor Author

chapuni commented Feb 5, 2024

agozillon pushed a commit to agozillon/llvm-project that referenced this pull request Feb 5, 2024
…80608)

* `getFunctionBitmap()` stores not `std::vector<uint8_t>` but
`BitVector`.
* `CounterMappingContext` holds `Bitmap` (instead of the ref of bytes)
* `Bitmap` and `BitmapIdx` are used instead of `evaluateBitmap()`.

FIXME: `InstrProfRecord` itself should handle `Bitmap` as `BitVector`.
agozillon pushed a commit to agozillon/llvm-project that referenced this pull request Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants