Skip to content

Add support for deserializing xplanes to Jaxlib #29431

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

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
1 change: 1 addition & 0 deletions jax/_src/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def _parse_version(v: str) -> tuple[int, ...]:
from jaxlib._jax import pytree as pytree # noqa: F401
from jaxlib._jax import Device as Device # noqa: F401
from jaxlib import _profiler as _profiler # noqa: F401
from jaxlib import _profile_data as _profile_data # noqa: F401

import jaxlib.xla_client as xla_client # noqa: F401

Expand Down
5 changes: 5 additions & 0 deletions jax/_src/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@

from jax._src import xla_bridge
from jax._src.lib import _profiler
from jax._src.lib import _profile_data

ProfileData = _profile_data.ProfileData
ProfileEvent = _profile_data.ProfileEvent
ProfilePlane = _profile_data.ProfilePlane

_profiler_server: _profiler.ProfilerServer | None = None

Expand Down
9 changes: 3 additions & 6 deletions jax/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
from typing import Any

from jax._src.profiler import (
ProfileData as ProfileData,
ProfileEvent as ProfileEvent,
ProfileOptions as ProfileOptions,
ProfilePlane as ProfilePlane,
StepTraceAnnotation as StepTraceAnnotation,
TraceAnnotation as TraceAnnotation,
annotate_function as annotate_function,
Expand All @@ -29,9 +32,3 @@
stop_trace as stop_trace,
trace as trace,
)

# this is a temporary shim to please pytype in the meantime before the migration
# is complete for cl/760646494
ProfileData: Any = None
ProfileEvent: Any = None
ProfilePlane: Any = None
2 changes: 2 additions & 0 deletions jaxlib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pytype_strict_library(
"//jaxlib/mosaic/python:gpu_dialect",
"//jaxlib/mosaic/python:tpu_dialect",
"//jaxlib/triton",
"@xla//xla/python:_profile_data",
"@xla//xla/python:_profiler",
],
)
Expand Down Expand Up @@ -169,6 +170,7 @@ pywrap_library(
"//jaxlib/mlir/_mlir_libs:_stablehlo",
"//jaxlib/mlir/_mlir_libs:_tpu_ext",
"//jaxlib/mlir/_mlir_libs:_triton_ext",
"@xla//xla/python:_profile_data",
"@xla//xla/python:_profiler",
],
)
Expand Down
1 change: 1 addition & 0 deletions jaxlib/tools/build_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def prepare_wheel(wheel_sources_path: pathlib.Path, *, cpu, wheel_sources):
f"{source_file_prefix}jaxlib/weakref_lru_cache.pyi",
f"{source_file_prefix}jaxlib/_jax.{pyext}",
f"{source_file_prefix}jaxlib/_profiler.{pyext}",
f"{source_file_prefix}jaxlib/_profile_data.{pyext}",
],
)
# This file is required by PEP-561. It marks jaxlib as package containing
Expand Down
Loading