Skip to content

Conversation

@shelkesagar29
Copy link
Collaborator

@shelkesagar29 shelkesagar29 commented Jun 10, 2025

This PR integrates the following internal changes into OSS.

commit c6f9d4b57ae793b08ddf415529a83e2aca6df5ce
Author: Sagar Shelke [email protected]
Date: Tue Jun 10 14:27:27 2025 -0700

[Dialect/Plan] Add constant foldable subgraph analysis pass.

This MR adds a generic pass for constant foldable subgraph analysis pass. This pass
implements the following three things,
1. A forward data flow analysis to find constant foldable ops.
2. Use clustering to find constant foldable subgraphs.
3. Outline constant foldable subgraphs to `func.func` with
`plan.constant_foldable` attributes.
Pass option `skipClustering` allows user to extend default pass behavior
and skip certain ops from outlining.

MLIR test cases are added including region ops tests.

commit 5fad6480597ee15bdb4a8c04c033b7ef6beff2d0
Author: Christopher Bate [email protected]
Date: Tue Jun 10 19:27:04 2025 +0000

NFC: remove unused functions

commit 7eb853f52525756e399a7fc6fdc4ab25244d6f94
Author: Chris Bate [email protected]
Date: Tue Jun 10 12:06:51 2025 -0700

[compiler] Create InferTensorValueRangeInterface

Previously, our TensorValueBoundsAnalysis was only able to analyze values
that were either constant or were produced by the result of `plan.with_values`.
This worked because we rely on `plan.with_values` to link integer range
analysis and the TensorValueBoundsAnalysis. However, after clustering there
can occur edge cases where the `plan.with_values` op is not present.
Furthermore, eventually we would like to avoid creating `plan.with_values`
ops in the first place since they temporarily bloat the IR.

This commit adds a new interface, InferTensorValueRangeInterface, that allows
operations to participate in the TensorValueBoundsAnalysis. The logic
for `plan.with_values` is implemented using the interface, and this change
adds an implementation and test for `stablehlo.convert`. Besides this
new behavior for `stablehlo.convert`, this change is a pure refactor and
no other new behavior is added.

commit d49fe69e08d79db07bf9f801427c97f6bfbdfcda
Author: Christopher Bate [email protected]
Date: Fri Jun 6 17:03:45 2025 +0000

NFC: Move `python` under `integrations/python`

Moves the `python` directory under `integrations/python` to better
reflect that, like PJRT, the Python packages are a downstream consumer of
the MLIR-TensorRT compiler/runtime libraries.

commit ef5490368b2235e80bb21a6aca39db43d24f1c47
Author: Sagar Shelke [email protected]
Date: Sat Jun 7 14:27:21 2025 -0700

[tensorrt] Implement inliner inferface for TensorRT dialect

This MR implements `DialectInlinerInterface` for the TensorRT dialect.
All ops in TensorRT dialect are pure and thus can be inlined, except `module`,
`call` and `call_alloc`. Upstream `--inline` pass doesn't inline operation with
  callop interface (`call` and `call_alloc`) because these operations in TensorRT dialect
are referring to callee in different symbol table comapred to their own.

MLIR valid and invalid test is added.

commit cd56aa6a511e2091fcd86106f20d27ff3673db75
Author: Christopher Bate [email protected]
Date: Wed Jun 11 14:26:03 2025 +000

Fix build with BUILD_SHARED_LIBS=ON

The new InferTensorValueRangeInterface was used without correctly
specifying the library dependency the PlanIR and StablehloExtIR
libraries.

GitOrigin-RevId: cd56aa6a511e2091fcd86106f20d27ff3673db75

@shelkesagar29 shelkesagar29 force-pushed the move_internal_changes branch from ed8d6c7 to bf192ff Compare June 11, 2025 00:24
@shelkesagar29 shelkesagar29 changed the title Move internal changes Integrate internal changes Jun 11, 2025
@christopherbate christopherbate force-pushed the move_internal_changes branch 2 times, most recently from 0c9f6a0 to b6b9d81 Compare June 11, 2025 16:02
This PR integrates the following internal changes into OSS.

commit c6f9d4b57ae793b08ddf415529a83e2aca6df5ce
Author: Sagar Shelke <[email protected]>
Date:   Tue Jun 10 14:27:27 2025 -0700

    [Dialect/Plan] Add constant foldable subgraph analysis pass.

    This MR adds a generic pass for constant foldable subgraph analysis pass. This pass
    implements the following three things,
    1. A forward data flow analysis to find constant foldable ops.
    2. Use clustering to find constant foldable subgraphs.
    3. Outline constant foldable subgraphs to `func.func` with
    `plan.constant_foldable` attributes.
    Pass option `skipClustering` allows user to extend default pass behavior
    and skip certain ops from outlining.

    MLIR test cases are added including region ops tests.

commit 5fad6480597ee15bdb4a8c04c033b7ef6beff2d0
Author: Christopher Bate <[email protected]>
Date:   Tue Jun 10 19:27:04 2025 +0000

    NFC: remove unused functions

commit 7eb853f52525756e399a7fc6fdc4ab25244d6f94
Author: Chris Bate <[email protected]>
Date:   Tue Jun 10 12:06:51 2025 -0700

    [compiler] Create InferTensorValueRangeInterface

    Previously, our TensorValueBoundsAnalysis was only able to analyze values
    that were either constant or were produced by the result of `plan.with_values`.
    This worked because we rely on `plan.with_values` to link integer range
    analysis and the TensorValueBoundsAnalysis. However, after clustering there
    can occur edge cases where the `plan.with_values` op is not present.
    Furthermore, eventually we would like to avoid creating `plan.with_values`
    ops in the first place since they temporarily bloat the IR.

    This commit adds a new interface, InferTensorValueRangeInterface, that allows
    operations to participate in the TensorValueBoundsAnalysis. The logic
    for `plan.with_values` is implemented using the interface, and this change
    adds an implementation and test for `stablehlo.convert`. Besides this
    new behavior for `stablehlo.convert`, this change is a pure refactor and
    no other new behavior is added.

commit d49fe69e08d79db07bf9f801427c97f6bfbdfcda
Author: Christopher Bate <[email protected]>
Date:   Fri Jun 6 17:03:45 2025 +0000

    NFC: Move `python` under `integrations/python`

    Moves the `python` directory under `integrations/python` to better
    reflect that, like PJRT, the Python packages are a downstream consumer of
    the MLIR-TensorRT compiler/runtime libraries.

commit ef5490368b2235e80bb21a6aca39db43d24f1c47
Author: Sagar Shelke <[email protected]>
Date:   Sat Jun 7 14:27:21 2025 -0700

    [tensorrt] Implement inliner inferface for TensorRT dialect

    This MR implements `DialectInlinerInterface` for the TensorRT dialect.
    All ops in TensorRT dialect are pure and thus can be inlined, except `module`,
    `call` and `call_alloc`. Upstream `--inline` pass doesn't inline operation with
     callop interface (`call` and `call_alloc`) because these operations in TensorRT dialect
    are referring to callee in different symbol table comapred to their own.

    MLIR valid and invalid test is added.

commit cd56aa6a511e2091fcd86106f20d27ff3673db75
Author: Christopher Bate <[email protected]>
Date:   Wed Jun 11 14:26:03 2025 +000

    Fix build with BUILD_SHARED_LIBS=ON

    The new InferTensorValueRangeInterface was used without correctly
    specifying the library dependency the PlanIR and StablehloExtIR
    libraries.

GitOrigin-RevId: cd56aa6a511e2091fcd86106f20d27ff3673db75
@christopherbate christopherbate force-pushed the move_internal_changes branch from b6b9d81 to df020d1 Compare June 11, 2025 16:06
@christopherbate christopherbate merged commit a62916f into main Jun 11, 2025
1 check passed
@christopherbate christopherbate deleted the move_internal_changes branch June 11, 2025 16:26
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.

4 participants