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

#sdy support JAX callbacks through the Shardy XLA round-trip pipeline. #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
10 changes: 10 additions & 0 deletions shardy/dialect/sdy/ir/test/tensor_sharding_verification.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,16 @@ func.func @sharding_bound_manual_computation(%arg0: tensor<16x32xf32>) -> tensor

// -----

sdy.mesh @maximal_mesh = <[], device_ids=[0]>

func.func @maximal_sharding_with_dim_shardings(%arg0: tensor<8x8xf32>) -> tuple<tensor<8x8xf32>> {
// expected-error @+1 {{a maximal sharding must have no dimension shardings}}
%0 = stablehlo.custom_call @sdy_testonly(%arg0) {sdy.sharding = #sdy.sharding_per_value<[<@maximal_mesh, [{}, {}]>]>} : (tensor<8x8xf32>) -> tuple<tensor<8x8xf32>>
return %0 : tuple<tensor<8x8xf32>>
}

// -----

sdy.mesh @mesh = <["a"=2]>

func.func @two_tuple(%arg0: tensor<8x8xf32>) -> tuple<tensor<8x8xf32>, tensor<8x8xf32>> {
Expand Down
10 changes: 9 additions & 1 deletion shardy/dialect/sdy/ir/verifiers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,15 @@ LogicalResult verifyTensorShardingAttr(TensorShardingAttr shardingAttr,
bool checkDivisibility,
ManualAxisToOwner alreadyManualAxes) {
if (mesh.isMaximal()) {
// TODO(bartchr): add some checks after XLA change lands.
// A maximal sharding says that this op should be executed on a single
// device. Skip checking against the type of the op. Just make sure there
// are no dimension shardings and replicated axes.
if (!shardingAttr.getDimShardings().empty() ||
!shardingAttr.getReplicatedAxes().empty()) {
return emitError(
"a maximal sharding must have no dimension shardings and "
"no replicated axes.");
}
return success();
}
auto tensorType = dyn_cast<ShapedType>(type);
Expand Down