[profile] Preserve device instrumentation layout flags when writing profiles (#236081)

The LLVM options -pgo-instrument-entry and -pgo-instrument-loop-entries
control whether function entries and edges entering loops must be
instrumented. Both default to false for ordinary IR PGO. These settings
affect counter placement and are recorded as flags in the raw profile
header so profile use can reconstruct the same counter layout.

HIP users can specify different values for host and device compilation.
For example, -Xarch_device -mllvm=-pgo-instrument-entry=true enables
explicit entry counters for the device while the host keeps the default.
The host and device profiles then need different entry flags.

The ROCm collector currently writes device counters with the host runtime's
version flags. In this example, it incorrectly marks the device profile
as having entry instrumentation disabled. Profile use can then reconstruct
the wrong layout and associate counts with the wrong blocks.

Read and validate the device's profile-version variable separately from
the host's, then pass it to the existing raw-profile writer. This preserves
the device's own layout flags in its profile header so profile use can
interpret the device counters correctly.

GitOrigin-RevId: 070d7fffe83a05ccb7608ac5cace70a8b123a3b3
7 files changed