Repository navigation
Closed
Labels
Description
What happened?
For jax>=0.5.1, e.g. 0.5.x and 0.6.x, IREE PJRT plugin will fail to initialize in jax since PJRT_Memory-series APIs are not supported. However in previous versions, these APIs are optional in XLA PJRT client of jax and will not cause the initialization fail.
Here are error messages for such case:
$ JAX_PLATFORMS=iree_cpu JAX_TRACEBACK_FILTERING=off python integrations/pjrt/test/test_add.py (base)
WARNING:2025-05-28 12:01:36,621:jax._src.xla_bridge:822: Platform 'iree_cpu' is experimental and not all JAX functionality may be correctly supported!
WARNING:jax._src.xla_bridge:Platform 'iree_cpu' is experimental and not all JAX functionality may be correctly supported!
[IREE-PJRT] DEBUG: Using IREE compiler binary: /home/twice/miniforge3/lib/python3.12/site-packages/iree/compiler/_mlir_libs/libIREECompiler.so
[IREE-PJRT] DEBUG: Compiler Version: 3.5.0rc20250527 @ c33d26025df21501630acac8fef883ea689b86b7 (API version 1.4)
[IREE-PJRT] DEBUG: Partitioner was not enabled. The partitioner can be enabled by setting the 'PARTITIONER_LIB_PATH' config var ('IREE_PJRT_PARTITIONER_LIB_PATH' env var)
[IREE-PJRT] DEBUG: CPU driver created
Traceback (most recent call last):
File "/home/twice/projects/iree/integrations/pjrt/test/test_add.py", line 7, in <module>
a = jax.numpy.asarray([1, 2, 3, 4, 5, 6, 7, 8, 9])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/numpy/lax_numpy.py", line 5732, in asarray
return array(a, dtype=dtype, copy=bool(copy), order=order, device=device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/numpy/lax_numpy.py", line 5553, in array
out_array: Array = lax_internal._convert_element_type(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/lax/lax.py", line 1727, in _convert_element_type
return convert_element_type_p.bind(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/core.py", line 531, in bind
return self._true_bind(*args, **params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/core.py", line 551, in _true_bind
return self.bind_with_trace(prev_trace, args, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/lax/lax.py", line 4897, in _convert_element_type_bind_with_trace
operand = core.Primitive.bind_with_trace(convert_element_type_p, trace, args, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/core.py", line 556, in bind_with_trace
return trace.process_primitive(self, args, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/core.py", line 1060, in process_primitive
return primitive.impl(*args, **params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/dispatch.py", line 88, in apply_primitive
outs = fun(*args)
^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/traceback_util.py", line 182, in reraise_with_filtered_traceback
return fun(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/pjit.py", line 334, in cache_miss
executable, pgle_profiler) = _python_pjit_helper(fun, jit_info, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/pjit.py", line 195, in _python_pjit_helper
out_flat, compiled, profiler = _pjit_call_impl_python(*args_flat, **p.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/pjit.py", line 1884, in _pjit_call_impl_python
return compiled.unsafe_call(*args), compiled, pgle_profiler
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/profiler.py", line 354, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/interpreters/pxla.py", line 1292, in __call__
input_bufs = self.in_handler(args)
^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/interpreters/pxla.py", line 1179, in __call__
return self.handler(input_buffers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/profiler.py", line 354, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/interpreters/pxla.py", line 137, in shard_args
return shard_arg_handlers[type(arg)]([arg], shardings, layouts,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/interpreters/pxla.py", line 219, in _shard_np_array
results.append(batched_device_put(aval, sharding, shards, devices))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/twice/miniforge3/lib/python3.12/site-packages/jax/_src/interpreters/pxla.py", line 246, in batched_device_put
return xc.batched_device_put(aval, sharding, xs, list(devices), committed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jaxlib._jax.XlaRuntimeError: UNIMPLEMENTED: /home/twice/projects/iree/integrations/pjrt/src/iree_pjrt/common/api_impl.cc:745: UNIMPLEMENTED; PJRT_Device_DefaultMemory
Steps to reproduce your issue
- Install iree-base-compiler and iree-pjrt-plugin-cpu
- Run any jax program (with jax>=0.5.1) with
JAX_PLATFORMS=iree_cpu - See the error
What component(s) does this issue relate to?
No response
Version information
No response
Additional context
No response
Activity
[PJRT] Support PJRT_Memory related APIs in IREE PJRT plugin (#20911)
[PJRT] Support PJRT_Memory related APIs in IREE PJRT plugin (#20911)