Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate LLVM at llvm/llvm-project@f739aa400416 #2683

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ workspace(name = "stablehlo")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

LLVM_COMMIT = "e86910337f98e57f5b9253f7d80d5b916eb1d97e"
LLVM_COMMIT = "f739aa4004165dc64d3a1f418d5ad3c84886f01a"

LLVM_SHA256 = "4ca0eff0ca86ed6f2fdb7682354fdf4c85151d90ac9fb6e55a868e4191359e9f"
LLVM_SHA256 = "85da134e7ba044ef50ebc009d1a57a87fb0e2db208a04650ef2fe564e9564aa7"

http_archive(
name = "llvm-raw",
Expand Down
2 changes: 1 addition & 1 deletion build_tools/llvm_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e86910337f98e57f5b9253f7d80d5b916eb1d97e
f739aa4004165dc64d3a1f418d5ad3c84886f01a
23 changes: 16 additions & 7 deletions build_tools/math/generate_ChloDecompositionPatternsMath.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,15 @@ def main(kind="CHLO"):

output_file = os.path.relpath(
os.path.normpath(
os.path.join(os.path.dirname(__file__), "..", "..", "stablehlo",
"transforms", output_filename)),
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"stablehlo",
"transforms",
output_filename,
)
),
os.getcwd(),
)

Expand Down Expand Up @@ -105,7 +112,8 @@ def main(kind="CHLO"):
func = getattr(fa.algorithms, fname, None)
if func is None:
warnings.warn(
f"{fa.algorithms.__name__} does not define {fname}. Skipping.")
f"{fa.algorithms.__name__} does not define {fname}. Skipping."
)
continue
ctx = fa.Context(paths=[fa.algorithms],
parameters=dict(rewrite_keep_integer_literals=True))
Expand All @@ -116,14 +124,15 @@ def main(kind="CHLO"):
sources[-1] += src
source = "\n\n".join(sources) + "\n"

if chloname.startswith('StableHLO_'):
if chloname.startswith("StableHLO_"):
# an ugly hack to fix the definition of stablehlo complex math
# functions. TODO(pearu): add the corresponding feature to
# functional_algorithms stablehlo printer
NameOp = chloname.split('_', 1)[1]
NameOp = chloname.split("_", 1)[1]
source = source.replace(
f'def : Pat<({chloname}',
f'def {NameOp}_ComplexElementType_ComplexMathExpander : Pat<({chloname}'
f"def : Pat<({chloname}",
f"def {NameOp}_ComplexElementType_ComplexMathExpander :"
f" Pat<({chloname}",
)

if os.path.isfile(output_file):
Expand Down
25 changes: 16 additions & 9 deletions build_tools/math/generate_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@
dict(name="acosh", mpmath_name="arccosh"),
dict(name="atanh", mpmath_name="arctanh"),
dict(name="square", mpmath_name="square"),
dict(name="log_plus_one",
mpmath_name="log1p",
namespace="stablehlo",
passes="--stablehlo-complex-math-expander"),
dict(
name="log_plus_one",
mpmath_name="log1p",
namespace="stablehlo",
passes="--stablehlo-complex-math-expander",
),
]


Expand Down Expand Up @@ -138,13 +140,16 @@ def main():
params = fa.utils.function_validation_parameters(opname, dtype)
max_ulp_difference = op.get(
"max_ulp_difference",
params.get("max_valid_ulp_count", default_max_ulp_difference))
params.get("max_valid_ulp_count", default_max_ulp_difference),
)

nmp = fa.utils.numpy_with_mpmath(
extra_prec_multiplier=op.get(
"extra_prec_multiplier",
params.get("extra_prec_multiplier",
default_extra_prec_multiplier)),
params.get(
"extra_prec_multiplier", default_extra_prec_multiplier
),
),
flush_subnormals=flush_subnormals,
)

Expand Down Expand Up @@ -208,8 +213,10 @@ def main():
continue

f = open(fname, "w")
f.write(f"// RUN: stablehlo-opt {passes} %s |"
" stablehlo-translate --interpret\n")
f.write(
f"// RUN: stablehlo-opt {passes} %s |"
" stablehlo-translate --interpret\n"
)
f.write(
"// This file is generated, see build_tools/math/README.md for more"
" information.\n")
Expand Down
2 changes: 2 additions & 0 deletions stablehlo/conversions/linalg/transforms/TypeConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ RemoveSignTypeConverter::RemoveSignTypeConverter() {

LinalgTypeConverter::LinalgTypeConverter() : RemoveSignTypeConverter() {
addArgumentMaterialization(scalarToTensor);
addSourceMaterialization(scalarToTensor);
addTargetMaterialization(scalarToTensor);
}

} // namespace mlir::stablehlo
Loading