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

Clean up conditional lowering of tan after JAX v0.4.34 release. #24405

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
11 changes: 1 addition & 10 deletions jax/_src/lax/lax.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
from jax._src.lax.utils import (
_input_dtype, dtype_to_string, standard_abstract_eval,
standard_multi_result_abstract_eval, standard_primitive)
from jax._src.lib import version as jaxlib_version
from jax._src.lib.mlir import ir
from jax._src.lib.mlir.dialects import chlo
from jax._src.lib.mlir.dialects import hlo
Expand Down Expand Up @@ -2367,15 +2366,7 @@ def _tan_impl(x):

tan_p = standard_unop(_float | _complex, 'tan')
ad.defjvp2(tan_p, lambda g, ans, x: mul(g, _const(x, 1) + square(ans)))
# TODO(b/368011034): Remove after jaxlib 0.4.34 release. In 0.4.33, this
# lowering is mostly supported, but it fails on export or with the PJRT plugin
# because those modes target an older StableHLO version, and the
# compatibility updates from https://github.com/openxla/xla/pull/16649 aren't
# included in the 0.4.33 release.
if jaxlib_version <= (0, 4, 33):
mlir.register_lowering(tan_p, partial(_nary_lower_hlo, chlo.tan))
else:
mlir.register_lowering(tan_p, partial(_nary_lower_hlo, hlo.tan))
mlir.register_lowering(tan_p, partial(_nary_lower_hlo, hlo.tan))

def asin_impl(x):
if dtypes.issubdtype(_dtype(x), np.complexfloating):
Expand Down
Loading