[RFC] Deprecate DivergenceAnalysis & LegacyDivergenceAnalysis

Hi everyone,


@sameerds has implemented a replacement for the existing DivergenceAnalysis passes called “UniformityAnalysis”.
It is a generalization of divergence analysis that supports irreducible control flow, see: RFC: Uniformity Analysis for Irreducible Control Flow

Over the last month, we have replaced all in-tree users of DA/LegacyDA with UA with great success. No correctness issues were encountered at all, and neither LLVM or the AMDGPU backend depend on (Legacyt)DivergenceAnalysis anymore.

This is a proposal to deprecate both DA and LegacyDA, because:

  • UA has all the same features as DA/LegacyDA.
  • LegacyDA has incorrect corner cases, DA is correct but limited to reducible control flow. UA has neither of those issues.
  • UA is generic and works with MIR as well.

There is no good reason left for downstream users to rely on DA/LegacyDA anymore.

Actions Proposed

  • Deprecate LegacyDA/DA now:
  • Remove LegacyDA/DA after LLVM 17.0.0 is released (branches).
    • This gives downstream users a full release cycle (about 3 months IIRC) to make the switch to UA.
  • Deprecate the useGPUDivergenceAnalysis TTI hook.
    • Q: can this just be removed immediately or do we also need to deprecate?

I think we should just do it soon. The downstream migration process is pretty straightforward and simple.

I’d just delete it

1 Like

+1 for a single DivergenceAnalysis

I’ve thought a bit more about this one and I think it’s better to leave it for now, and just delete it when the passes are deleted. I’m not sure if there’s any downstream users of that hook but if there is, they may still need to switch between the DA and Legacy DA

Heads up, the discussion on the review seems to lean toward just removing the analysis now instead of deprecating it, as it’s not an API we’d consider “stable”. I also agree, but I will put this on hold for a few days in case someone has an objection.

Review: ⚙ D148116 [Analysis] Remove DA & LegacyDA