Skip to content

Support bounded dynamism in cdist forward and backward - #7207

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1031530705
Open

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1031530705

Conversation

@copybara-service

Copy link
Copy Markdown

Support bounded dynamism in cdist forward and backward

Preserves #stablehlo.bounds encodings across cdist forward and backward
lowering, including tensors with multiple bounded dynamic dimensions:

  • Broadcast cdist operands directly via BroadcastIfNeeded and
    InferBroadcastDimensions instead of static BroadcastInDim or Unsqueeze
    (since stablehlo.reshape only supports a single bounded dynamic dimension),
    and preserve bounds when casting the p = inf mask in _cdist_backward.
  • Remove the duplicate BuildZeroNorm helper and delegate p = 0 to
    BuildPNormShlo.
  • Re-enable cdist in compiled bounded dynamism tests (COMPILE) and add
    bounded dynamism backward and multi-dynamic-dim tests.

Generated from cl/1031530705

Preserves `#stablehlo.bounds` encodings across `cdist` forward and backward
lowering, including tensors with multiple bounded dynamic dimensions:
- Broadcast `cdist` operands directly via `BroadcastIfNeeded` and
  `InferBroadcastDimensions` instead of static `BroadcastInDim` or `Unsqueeze`
  (since `stablehlo.reshape` only supports a single bounded dynamic dimension),
  and preserve bounds when casting the `p = inf` mask in `_cdist_backward`.
- Remove the duplicate `BuildZeroNorm` helper and delegate `p = 0` to
  `BuildPNormShlo`.
- Re-enable `cdist` in compiled bounded dynamism tests (`COMPILE`) and add
  bounded dynamism backward and multi-dynamic-dim tests.

Generated from cl/1031530705

PiperOrigin-RevId: 1031530705

This branch has not been deployed

No deployments
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.

1 participant