Skip to content
Merged
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
9 changes: 9 additions & 0 deletions projects/eudsl-python-extras/mlir/extras/runtime/passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,12 @@ def convert_math_to_xevm(
`__spirv_ocl_` extended instruction set. Set the `convertToOCL` flag to
`false` to leave these ops alone instead.

Algebraic simplifications run ahead of the lowering, so the cheaper form is
what reaches the intrinsics: `math.powf %x, 2.0` becomes a multiply instead
of a call to `__spirv_ocl_native_powr`, and `exp(a) / exp(b)` becomes a
single `exp(a - b)` when the division may be reassociated (`arcp` or
`reassoc`). Ops these simplifications cannot rewrite are left as they are.

Args:
convert_arith: Convert supported Arith ops (e.g. arith.divf) as well.
convert_to_ocl: Convert Math ops without `afn` fastmath to precise OCL intrinsics.
Expand Down Expand Up @@ -6322,6 +6328,7 @@ def tosa_to_linalg(
self,
disable_tosa_decompositions: bool = None,
aggressive_reduce_constant: bool = None,
allow_non_finites: bool = None,
):
"""Lower TOSA to LinAlg on tensors

Expand All @@ -6331,12 +6338,14 @@ def tosa_to_linalg(
Args:
disable_tosa_decompositions: Disable tosa decompositions pass
aggressive_reduce_constant: Always perform the reduce constant optimization
allow_non_finites: When enabled, float min/max reductions are seeded with the infinite identity mandated by the TOSA specification. When disabled (default), the largest finite value is used instead. This controls only compiler-generated identity values; NaN results required by nan_mode are unaffected.
"""
self.add_pass(
"tosa-to-linalg",
**{
"disable-tosa-decompositions": disable_tosa_decompositions,
"aggressive-reduce-constant": aggressive_reduce_constant,
"allow-non-finites": allow_non_finites,
}
)
return self
Expand Down
9 changes: 9 additions & 0 deletions projects/mlir-python-mcp/mlir_python_mcp/passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,12 @@ def convert_math_to_xevm(
`__spirv_ocl_` extended instruction set. Set the `convertToOCL` flag to
`false` to leave these ops alone instead.

Algebraic simplifications run ahead of the lowering, so the cheaper form is
what reaches the intrinsics: `math.powf %x, 2.0` becomes a multiply instead
of a call to `__spirv_ocl_native_powr`, and `exp(a) / exp(b)` becomes a
single `exp(a - b)` when the division may be reassociated (`arcp` or
`reassoc`). Ops these simplifications cannot rewrite are left as they are.

Args:
convert_arith: Convert supported Arith ops (e.g. arith.divf) as well.
convert_to_ocl: Convert Math ops without `afn` fastmath to precise OCL intrinsics.
Expand Down Expand Up @@ -6322,6 +6328,7 @@ def tosa_to_linalg(
self,
disable_tosa_decompositions: bool = None,
aggressive_reduce_constant: bool = None,
allow_non_finites: bool = None,
):
"""Lower TOSA to LinAlg on tensors

Expand All @@ -6331,12 +6338,14 @@ def tosa_to_linalg(
Args:
disable_tosa_decompositions: Disable tosa decompositions pass
aggressive_reduce_constant: Always perform the reduce constant optimization
allow_non_finites: When enabled, float min/max reductions are seeded with the infinite identity mandated by the TOSA specification. When disabled (default), the largest finite value is used instead. This controls only compiler-generated identity values; NaN results required by nan_mode are unaffected.
"""
self.add_pass(
"tosa-to-linalg",
**{
"disable-tosa-decompositions": disable_tosa_decompositions,
"aggressive-reduce-constant": aggressive_reduce_constant,
"allow-non-finites": allow_non_finites,
}
)
return self
Expand Down
2 changes: 1 addition & 1 deletion third_party/llvm-project
Submodule llvm-project updated 1465 files
Loading