Skip to content

[FEA] Apply GpuTransitionOverrides to GpuSubqueryBroadcast's broadcast child consistently in non-AQE mode #14892

@wjxiz1992

Description

@wjxiz1992

Background

#14833 / #14837 fixed DPP broadcast duplication in non-AQE mode by adding fixupNonAdaptiveBroadcastReuse — a post-hoc pass that walks the final plan, indexes the main-plan GpuBroadcastExchangeExecs, and rewrites matching DPP-side GpuBroadcastExchangeExecs to ReusedExchangeExec.

@revans2 observed on the PR that the root cause is upstream of this fixup: GpuSubqueryBroadcastExec builds its underlying GpuBroadcastExchangeExec directly during GpuOverrides via exMeta.convertToGpu(), which bypasses GpuTransitionOverrides. Because of that bypass, insertCoalesce / optimizeCoalesce add GpuCoalesceBatches to the main-plan broadcast but not to the DPP-side broadcast — exactly the structural divergence that breaks ReuseExchangeAndSubquery's canonical-equality match.

The fixup pass paper-overs the symptom. The cleaner fix is to make the DPP-side broadcast go through the same GpuTransitionOverrides rewrites as any other broadcast, so the two converge to identical shapes at the same point in the pipeline and ReuseExchangeAndSubquery works without any rapids-side post-processing.

Goal

Apply GpuTransitionOverrides (or at least the insertCoalesce / optimizeCoalesce rewrites it depends on) to the broadcast child that GpuSubqueryBroadcastExec.convertToGpu constructs, so that:

  1. The non-AQE DPP-side GpuBroadcastExchangeExec ends up structurally identical to the main-plan broadcast for the same logical CPU exchange.
  2. Spark's stock ReuseExchangeAndSubquery matches them without any rapids-side intervention.
  3. fixupNonAdaptiveBroadcastReuse (added in [BUG] Dedup GpuBroadcastExchange across DPP subqueries in non-AQE mode #14837) becomes redundant and can be removed.
  4. Other transition-order divergences that might surface in the future — not just GpuCoalesceBatches — are handled by the same consistent rewrite path, so we do not accumulate more special-case fixups.

Scope notes

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions