Skip to content

Commit

Permalink
Check if a sharding custom call has a sharding before accessing the s…
Browse files Browse the repository at this point in the history
…aid sharding object.

PiperOrigin-RevId: 676042171
  • Loading branch information
Google-ML-Automation committed Sep 18, 2024
1 parent 2d1f7b7 commit a1299f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xla/service/sharding_propagation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1465,10 +1465,10 @@ absl::StatusOr<bool> ProcessShardingInstruction(
for (auto it = instructions.rbegin(); it != instructions.rend(); ++it) {
HloInstruction* instruction = *it;
if (instruction->IsCustomCall("Sharding")) {
HloSharding original_sharding = instruction->sharding();
TF_RET_CHECK(instruction->has_sharding())
<< "Sharding instruction must have a sharding attribute";
VLOG(3) << "ProcessShardingInstruction: " << instruction->ToString();
HloSharding original_sharding = instruction->sharding();

std::vector<int64_t> unspec_dims;
TF_RETURN_IF_ERROR(sharding_op_util::ParseAttributes(
Expand Down

0 comments on commit a1299f8

Please sign in to comment.