Skip to content

Export shape assertions to support implicit broadcasting with unbounded dynamic shapes #6232

@sdasgup3

Description

@sdasgup3

🚀 Feature

Per ref and ref, PyTorch allows constraints over unbounded dynamic dimensions. The shape constraints are preserved in the FX graph. The issue is to track that the constraint are also exported via PyTorch/XLA bridge to support implicit broadcasting with unbounded dynamic shapes. .

Motivation

With static and bounded dynamic shapes it is feasible to check at compile time if the broadcasting rules are met. With unbounded dynamic shapes, we need to rely on runtime guards (which we refer as shape assertions) to ensure the participating shapes in broadcasting are valid. With that said, typical code generation for implicit broadcasting with unbounded shapes consists of two parts: (A) shape assertions, and (B) broadcasting sequence, which actuallly does the broadcasting assuming all the shape assertions hold good.

The PR #6219 supports implicit broadcasting with unbouned dynamism in PyTorch/XLA/. The support involves just broadcast sequence (refer to B above) assuming that the participating shapes met the broadcasting rules at runtime. The issue make sure the assumption is codified by exporting the shape assertions.

Metadata

Metadata

Labels

dynamismDynamic Shape Features

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions