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

Update xla to use mlir rather than backend-specific-translations #314

Open
wants to merge 4 commits 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
9 changes: 2 additions & 7 deletions envpool/python/xla_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from jax import core, dtypes
from jax import numpy as jnp
from jax.core import ShapedArray
from jax.interpreters import xla
from jax.interpreters import mlir, xla
from jax.lib import xla_client


Expand Down Expand Up @@ -91,12 +91,7 @@ def translation(c: Any, *args: Any, platform: str = "cpu") -> Any:
prim.multiple_results = (len(out_specs) > 1)
prim.def_impl(partial(xla.apply_primitive, prim))
prim.def_abstract_eval(abstract)
xla.backend_specific_translations["cpu"][prim] = partial(
translation, platform="cpu"
)
xla.backend_specific_translations["gpu"][prim] = partial(
translation, platform="gpu"
)
mlir.register_lowering(prim, translation)

def call(*args: Any) -> Any:
return prim.bind(*args)
Expand Down
Loading