This is an archive of the discontinued LLVM Phabricator instance.

[PseudoProbe] Remove unnecessary asserts about non-zero discriminator.
ClosedPublic

Authored by hoy on Jul 13 2023, 5:23 PM.

Details

Summary

Despite previous efforts in fixing accidentally setting deduplication factor and avoiding enforcing a callsite debug loc for pseudo probes, I'm still seeing an IR probe having a non-zero discriminator. This time it is due to the merge of two probes with irreconsilable debug locations and the merged probe ends up getting the original callsite locs. Therefore I'm removing the assert about IR probe should always have a zero discriminator. This safe since

  • Probe discriminators are only emitted in FS-AFDO mode; and
  • The first FS discriminator assigning pass always clears non-discriminators left over from IR passes.

Diff Detail

Event Timeline

hoy created this revision.Jul 13 2023, 5:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 5:23 PM
hoy requested review of this revision.Jul 13 2023, 5:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 5:23 PM

In general if the effort to make sure probe has zero discriminator is too much, it makes sense to just rely on discriminator clean up instead during FS discriminator assignment for probes. I'm curious though what exposed this case? IIRC, we didn't hit this assert for a while now.

hoy added a comment.Jul 14 2023, 9:19 AM

In general if the effort to make sure probe has zero discriminator is too much, it makes sense to just rely on discriminator clean up instead during FS discriminator assignment for probes. I'm curious though what exposed this case? IIRC, we didn't hit this assert for a while now.

Yeah, it was good for a while until incrPGO was on. I suspect incrPGO opened more opportunity for optimizations and exposed this issue.

wenlei accepted this revision.Jul 14 2023, 7:53 PM

In general if the effort to make sure probe has zero discriminator is too much, it makes sense to just rely on discriminator clean up instead during FS discriminator assignment for probes. I'm curious though what exposed this case? IIRC, we didn't hit this assert for a while now.

Yeah, it was good for a while until incrPGO was on. I suspect incrPGO opened more opportunity for optimizations and exposed this issue.

Since we already did many fixes, if it's just one or two more fixes, do you think we could try to keep it?

I don't have a strong opinion, so accepting anyways.

This revision is now accepted and ready to land.Jul 14 2023, 7:53 PM
hoy added a comment.Jul 17 2023, 9:28 AM

In general if the effort to make sure probe has zero discriminator is too much, it makes sense to just rely on discriminator clean up instead during FS discriminator assignment for probes. I'm curious though what exposed this case? IIRC, we didn't hit this assert for a while now.

Yeah, it was good for a while until incrPGO was on. I suspect incrPGO opened more opportunity for optimizations and exposed this issue.

Since we already did many fixes, if it's just one or two more fixes, do you think we could try to keep it?

There doesn't seem to be a very clean fix for this issue. The debug loc merge API (getMergedLocation) takes two DebugLoc params, so to tell if they are from two probes we would need to go above a level but there are quite a few places doing code merge.