-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose materialize functions in Chlo to Stablehlo lowering (#2665)
We want to perform constant propogation through `chlo.lgamma` in Enzyme-JaX [Kevin](EnzymeAD/Enzyme-JAX#182 (comment)) mentioned he was open to exposing some materialize functions (which are currently static, and not callable from [our pass](https://github.com/EnzymeAD/Enzyme-JAX/blob/main/src/enzyme_ad/jax/Passes/EnzymeHLOOpt.cpp) atm) @wsmoses @GleasonK
- Loading branch information
1 parent
2f6be83
commit 38fe0f4
Showing
3 changed files
with
83 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* Copyright 2024 The StableHLO Authors. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
==============================================================================*/ | ||
|
||
#ifndef STABLEHLO_TRANSFORMS_CHLO_DECOMP_UTILS_H_ | ||
#define STABLEHLO_TRANSFORMS_CHLO_DECOMP_UTILS_H_ | ||
|
||
#include "mlir/IR/Value.h" | ||
#include "mlir/IR/ValueRange.h" | ||
#include "mlir/Transforms/DialectConversion.h" | ||
|
||
namespace mlir { | ||
namespace stablehlo { | ||
|
||
// Utility functions used in the Chlo to stablehlo legalization. | ||
|
||
Value materializeLgamma(OpBuilder &rewriter, Location loc, ValueRange args); | ||
|
||
Value materializeDigamma(OpBuilder &rewriter, Location loc, ValueRange args); | ||
|
||
Value materializeZeta(OpBuilder &rewriter, Location loc, ValueRange args); | ||
|
||
Value materializePolygamma(OpBuilder &rewriter, Location loc, ValueRange args); | ||
|
||
} // namespace stablehlo | ||
} // namespace mlir | ||
|
||
#endif // STABLEHLO_TRANSFORMS_CHLO_DECOMP_UTILS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters