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

fix compatibility issues with gpu_triton and tl_ir method access #272

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions jax_triton/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

"""Library for JAX-Triton integrations."""
import jaxlib
from jax._src.lib import gpu_triton
from jax_triton import utils
from jax_triton.triton_lib import triton_call
from jax.experimental.pallas import cdiv
Expand All @@ -23,8 +22,13 @@
from jax_triton.version import __version__
from jax_triton.version import __version_info__

get_compute_capability = gpu_triton.get_compute_capability
if jaxlib.version.__version_info__ >= (0, 4, 25):
from jax._src.pallas import triton
get_compute_capability = triton.get_compute_capability

if jaxlib.version.__version_info__ >= (0, 4, 14):
from jax._src.lib import gpu_triton
get_compute_capability = gpu_triton.get_compute_capability
try:
get_serialized_metadata = gpu_triton.get_serialized_metadata
except AttributeError:
Expand Down
3 changes: 1 addition & 2 deletions jax_triton/triton_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import triton.language as tl
from triton.runtime import autotuner
import triton._C.libtriton as _triton
from triton._C.libtriton import ir as tl_ir
import triton.backends.nvidia.compiler as cb

CAN_USE_TRITON = True
Expand Down Expand Up @@ -172,7 +171,7 @@ def compile_ttir_to_ptx_inplace(
with tempfile.NamedTemporaryFile(mode="wb") as f:
ttir.operation.write_bytecode(f)
f.flush()
ttir = tl_ir.parse_mlir_module(f.name, context)
ttir = _triton.ir.parse_mlir_module(f.name, context)
ttir.context = context
try:
metadata = dict()
Expand Down