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

Enabling stablehlo-complex-math-expander pass is platform dependent #20903

Open
pearu opened this issue Dec 27, 2024 · 3 comments
Open

Enabling stablehlo-complex-math-expander pass is platform dependent #20903

pearu opened this issue Dec 27, 2024 · 3 comments
Assignees

Comments

@pearu
Copy link
Contributor

pearu commented Dec 27, 2024

Consider JAX expression

jax.numpy.log1p(jax.numpy.complex64(0))

and the corresponding compilation paths for CPU and CUDA platforms. Currently, the CUDA path never calls MlirToXlaComputation which is unexpected per #20853 (comment) .
In particular, the difference of CPU and CUDA compilation paths is as follows:

CPU:
xla::ifrt::PjRtLoadedExecutable::Create 
  -> xla::TfrtCpuClient::Compile 
  -> xla::MlirToXlaComputation

CUDA:
xla::ifrt::PjRtLoadedExecutable::Create 
  -> xla::PjRtCApiClient::Compile 
  -> xla::Serialize 
  -> xla::SerializeUsingVersionedStablehlo

In fact, no XlaComputation instance is created in the CUDA compilation path which indicates that calling MlirToXlaComputation is platform dependent.

The aim of this issue is to define a platform independent compilation path for the stablehlo-complex-math-expander pass that preferably uses MlirToXlaComputation.

Originally posted by @pearu in #20853 (comment)

@akuegel
Copy link
Member

akuegel commented Jan 7, 2025

Was this fixed with #20853 ?

@pearu
Copy link
Contributor Author

pearu commented Jan 7, 2025

No, #20853 just revealed this issue.

@GleasonK GleasonK self-assigned this Jan 9, 2025
@GleasonK
Copy link
Member

GleasonK commented Jan 9, 2025

There are a few StableHLO passes we want to run for all XLA PJRT plugins (complex math expanders, quantized math expanders, etc), and there isn't a good single place we can add these passes. Seems like plugins are using multiple methods to go from StableHLO->HLO which is surprising. This ticket is about consolidating to a single HLO conversion path for plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants