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

[PJRT] Fix stablehlo attribute parameters for buffer transpose and broadcast #19488

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PragmaTwice
Copy link
Member

If we copy a tensor from host to device in a multi-GPU environment (i.e. sharding is enabled, not a trivial copy), the frontend call of jax.device_put will go to DeviceInstance::TransposeBroadcastDeviceBuffer eventually.

And this function will generate a stablehlo program to be compiled and executed then. In the generated code, two operations (stablehlo.broadcast_in_dim and stablehlo.transpose) are included. According to the spec of StableHLO (and also the tblgen definitions), the parameter attribute permutation of stablehlo.transpose is typed DenseI64ArrayAttr.

However, in the function DeviceInstance::TransposeBroadcastDeviceBuffer, it will generate some code like "stablehlo.transpose"(%x) {permutation = dense<[1,2,3]> : tensor<3xi64>} : ..., which does not meet the definition of stablehlo.transpose and should be corrected as something like "stablehlo.transpose"(%x) {permutation = array<i64: 1,2,3>} : ....

This PR is to fix it.

ci-exactly: build_packages, test_pjrt

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

Successfully merging this pull request may close these issues.

1 participant