Skip to content

Commit

Permalink
Replace the use of xla::OkStatus with absl::OkStatus now that they're…
Browse files Browse the repository at this point in the history
… the same.

PiperOrigin-RevId: 635907580
  • Loading branch information
klucke authored and tensorflower-gardener committed May 21, 2024
1 parent 18dfbc3 commit dfe7580
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 65 deletions.
4 changes: 2 additions & 2 deletions third_party/xla/xla/hlo/ir/dfs_hlo_visitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ void DfsHloVisitorBase<HloInstructionPtr>::SetVisited(
template <typename HloInstructionPtr>
absl::Status DfsHloVisitorBase<HloInstructionPtr>::Preprocess(
HloInstructionPtr) {
return OkStatus();
return absl::OkStatus();
}

template <typename HloInstructionPtr>
absl::Status DfsHloVisitorBase<HloInstructionPtr>::Postprocess(
HloInstructionPtr) {
return OkStatus();
return absl::OkStatus();
}

// Explicit instantiations.
Expand Down
4 changes: 2 additions & 2 deletions third_party/xla/xla/hlo/ir/dfs_hlo_visitor_with_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class DfsHloVisitorWithDefaultBase
// Invoked to inform the visitor that the traversal has completed, and that
// the root was "root".
absl::Status FinishVisit(HloInstructionPtr /*root*/) override {
return OkStatus();
return absl::OkStatus();
}

private:
Expand Down Expand Up @@ -320,7 +320,7 @@ class DfsHloRewriteVisitor : public DfsHloVisitorWithDefault {

// Default visitor action is to do nothing and return OK.
absl::Status DefaultAction(HloInstruction* /*hlo_instruction*/) override {
return OkStatus();
return absl::OkStatus();
}

bool changed() const { return changed_; }
Expand Down
6 changes: 3 additions & 3 deletions third_party/xla/xla/hlo/ir/dynamic_parameter_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ absl::Status DynamicParameterBinding::Bind(
const DynamicDimension& dynamic_dimension) {
auto result = bindings_.emplace(dynamic_dimension, dynamic_parameter);
TF_RET_CHECK(result.second);
return OkStatus();
return absl::OkStatus();
}

std::optional<DynamicParameterBinding::DynamicSizeParameter>
Expand Down Expand Up @@ -71,7 +71,7 @@ absl::Status DynamicParameterBinding::ForEachBinding(BindingFn fn) const {
for (const auto& binding : bindings_) {
TF_RETURN_IF_ERROR(fn(binding.second, binding.first));
}
return OkStatus();
return absl::OkStatus();
}

absl::Status DynamicParameterBinding::Verify(
Expand Down Expand Up @@ -99,7 +99,7 @@ absl::Status DynamicParameterBinding::Verify(
->shape(),
dynamic_dimension.parameter_index)
.rank());
return OkStatus();
return absl::OkStatus();
});
}

Expand Down
14 changes: 7 additions & 7 deletions third_party/xla/xla/hlo/ir/hlo_computation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ absl::Status HloComputation::RemoveParameter(int64_t param_no) {
param_no++;
}

return OkStatus();
return absl::OkStatus();
}

HloInstruction* HloComputation::ReplaceParameter(
Expand Down Expand Up @@ -371,7 +371,7 @@ absl::Status HloComputation::RemoveUnusedParametersImpl(bool allow_non_fusion) {
}
}
param_instructions_.resize(param_instructions_.size() - removed);
return OkStatus();
return absl::OkStatus();
}

bool HloComputation::IsSafelyRemovable(const HloInstruction* instruction,
Expand Down Expand Up @@ -471,7 +471,7 @@ absl::Status HloComputation::RemoveInstructionAndUnusedOperands(
}
}
}
return OkStatus();
return absl::OkStatus();
}

absl::Status HloComputation::RemoveInstruction(HloInstruction* instruction) {
Expand Down Expand Up @@ -515,7 +515,7 @@ absl::Status HloComputation::RemoveInstructionImpl(HloInstruction* instruction,
DCHECK_EQ(instructions_.size() - to_be_deleted_.size(), instruction_count())
<< "instructions_.size(): " << instructions_.size()
<< ", to_be_deleted_.size(): " << to_be_deleted_.size();
return OkStatus();
return absl::OkStatus();
}

void HloComputation::Cleanup() {
Expand Down Expand Up @@ -1049,7 +1049,7 @@ HloComputation::CreateFromProto(
TF_RET_CHECK(parameters_seen_count == parameter_count)
<< "Not all parameters in range [0, " << parameter_count
<< ") were referenced";
return OkStatus();
return absl::OkStatus();
}());

auto computation = absl::WrapUnique(
Expand Down Expand Up @@ -1376,7 +1376,7 @@ absl::Status HloComputation::ReplaceInstruction(
ReplaceInstruction(old_instruction, new_instruction,
/*preserve_sharding=*/false));
DCHECK(changed);
return OkStatus();
return absl::OkStatus();
}

absl::StatusOr<bool> HloComputation::ReplaceInstructionWithDifferentShape(
Expand Down Expand Up @@ -1451,7 +1451,7 @@ absl::Status HloComputation::ReplaceInstructionWithDifferentShape(
old_instruction, new_instruction,
/*preserve_sharding=*/false));
DCHECK(changed);
return OkStatus();
return absl::OkStatus();
}

std::vector<HloInstruction*> HloComputation::CollectUnreachableRoots() const {
Expand Down
2 changes: 1 addition & 1 deletion third_party/xla/xla/hlo/ir/hlo_computation.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class HloComputation {
for (const auto& instruction : instructions_) {
TF_RETURN_IF_ERROR(func(instruction.get()));
}
return OkStatus();
return absl::OkStatus();
}

HloInstruction* last_added_instruction() const {
Expand Down
12 changes: 6 additions & 6 deletions third_party/xla/xla/hlo/ir/hlo_input_output_alias_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ absl::Status HloInputOutputAliasConfig::SetUpAlias(
VLOG(4) << "Set up alias between output index " << output_index.ToString()
<< " and parameter " << param_number << " at index "
<< param_index.ToString();
return OkStatus();
return absl::OkStatus();
}

HloInputOutputAliasProto HloInputOutputAliasConfig::ToProto() const {
Expand Down Expand Up @@ -189,7 +189,7 @@ absl::Status HloInputOutputAliasConfig::ForEachAliasWithStatus(
if (aliased) {
TF_RETURN_IF_ERROR(fn(output_index, *aliased));
}
return OkStatus();
return absl::OkStatus();
});
}

Expand Down Expand Up @@ -240,7 +240,7 @@ absl::Status HloInputOutputAliasConfig::Verify(
alias.parameter_index) == false);
*(param_has_seen[alias.parameter_number].mutable_element(
alias.parameter_index)) = true;
return OkStatus();
return absl::OkStatus();
});
}

Expand All @@ -256,14 +256,14 @@ absl::Status HloBufferDonorConfig::AddBufferDonor(
VLOG(4) << "Register the parameter " << param_number << " at index "
<< param_index.ToString() << " as a buffer donor.";
buffer_donor_.emplace(BufferDonor(param_number, param_index));
return OkStatus();
return absl::OkStatus();
}

absl::Status HloBufferDonorConfig::RemoveBufferDonor(
int64_t param_number, const ShapeIndex& param_index) {
TF_RET_CHECK(param_number >= 0) << param_number;
buffer_donor_.erase(BufferDonor(param_number, param_index));
return OkStatus();
return absl::OkStatus();
}

HloBufferDonorProto HloBufferDonorConfig::ToProto() const {
Expand Down Expand Up @@ -344,7 +344,7 @@ absl::Status HloBufferDonorConfig::Verify(const HloModule& module) const {

// Since buffer_donor_ is a set, we do not need to check if one input has
// registered as a buffer donor many times.
return OkStatus();
return absl::OkStatus();
}

std::ostream& operator<<(std::ostream& out,
Expand Down
32 changes: 16 additions & 16 deletions third_party/xla/xla/hlo/ir/hlo_instruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ absl::Status EraseElementFromVector(PtrVec<T>* container, T value) {
auto it = std::find(container->begin(), container->end(), value);
TF_RET_CHECK(it != container->end());
container->erase(it);
return OkStatus();
return absl::OkStatus();
}
} // namespace

Expand Down Expand Up @@ -2707,7 +2707,7 @@ absl::Status HloInstruction::AddControlDependencyTo(
instruction->rare()->control_predecessors, this));
instruction->mutable_rare()->control_predecessors.push_back(this);
}
return OkStatus();
return absl::OkStatus();
}

absl::Status HloInstruction::RemoveControlDependencyTo(
Expand All @@ -2721,7 +2721,7 @@ absl::Status HloInstruction::RemoveControlDependencyTo(
TF_RETURN_IF_ERROR(EraseElementFromVector(
&instruction->mutable_rare()->control_predecessors, this));
}
return OkStatus();
return absl::OkStatus();
}

absl::Status HloInstruction::DropAllControlDeps() {
Expand All @@ -2738,7 +2738,7 @@ absl::Status HloInstruction::DropAllControlDeps() {
r->control_successors.clear();
r->control_predecessors.clear();
}
return OkStatus();
return absl::OkStatus();
}

absl::Status HloInstruction::SafelyDropAllControlDependencies() {
Expand All @@ -2751,7 +2751,7 @@ absl::Status HloInstruction::SafelyDropAllControlDependencies() {
}
}
TF_RETURN_IF_ERROR(DropAllControlDeps());
return OkStatus();
return absl::OkStatus();
}

bool HloInstruction::HasControlDependencies() const {
Expand All @@ -2767,7 +2767,7 @@ absl::Status HloInstruction::CopyAllControlDepsTo(HloInstruction* start,
for (auto* ctrl_succ : control_successors()) {
TF_RETURN_IF_ERROR(end->AddControlDependencyTo(ctrl_succ));
}
return OkStatus();
return absl::OkStatus();
}

bool HloInstruction::IdenticalInternal(
Expand Down Expand Up @@ -3057,7 +3057,7 @@ absl::Status HloInstruction::ReplaceUseWithDifferentShape(
TF_RETURN_IF_ERROR(
Cast<HloFusionInstruction>(user)->DeduplicateFusionOperands());
}
return OkStatus();
return absl::OkStatus();
}

absl::Status HloInstruction::ReplaceUseWith(HloInstruction* user,
Expand Down Expand Up @@ -3085,7 +3085,7 @@ absl::Status HloInstruction::ReplaceUseWithDifferentShape(
<< " to be equal to " << ToString();
user->operands_[operand_number] = new_producer;
new_producer->AddUser(user);
return OkStatus();
return absl::OkStatus();
}

absl::Status HloInstruction::ReplaceOperandWith(int64_t operand_num,
Expand All @@ -3104,7 +3104,7 @@ absl::Status HloInstruction::ReplaceOperandWithDifferentShape(
TF_RET_CHECK(operand_num < operand_count());
HloInstruction* old_operand = mutable_operand(operand_num);
if (old_operand == new_operand) {
return OkStatus();
return absl::OkStatus();
}

operands_[operand_num] = new_operand;
Expand All @@ -3116,15 +3116,15 @@ absl::Status HloInstruction::ReplaceOperandWithDifferentShape(
old_operand->RemoveUser(this);
}
new_operand->AddUser(this);
return OkStatus();
return absl::OkStatus();
}

// Copy all the instructions in the given fusion instruction into the fusion
// instruction's parent computation and replace the use of the fusion
// instruction with the copy of the fusion expression root.
absl::Status HloInstruction::Defuse() {
if (opcode() != HloOpcode::kFusion) {
return OkStatus();
return absl::OkStatus();
}
VLOG(2) << "Defusing instruction: " << ToString();

Expand Down Expand Up @@ -3187,7 +3187,7 @@ absl::Status HloInstruction::ReplaceAllUsesWithDifferentShape(
parent_->set_root_instruction(new_producer,
/*accept_different_shape=*/true);
}
return OkStatus();
return absl::OkStatus();
}

absl::Status HloInstruction::ReplaceAllUsesWith(HloInstruction* new_producer,
Expand Down Expand Up @@ -3235,7 +3235,7 @@ absl::Status HloInstruction::ReplaceAllUsesWithDifferentShape(
/*accept_different_shape=*/true);
}

return OkStatus();
return absl::OkStatus();
}

bool HloInstruction::IsEffectiveBitcast() const {
Expand Down Expand Up @@ -4438,7 +4438,7 @@ static absl::Status PostOrderDFS(
std::reverse(dfs_stack.begin() + old_dfs_stack_size, dfs_stack.end());
} while (!dfs_stack.empty());

return OkStatus();
return absl::OkStatus();
}

template <typename HloInstructionPtr>
Expand All @@ -4452,7 +4452,7 @@ absl::Status HloInstruction::Accept(
if (call_finish_visit) {
TF_RETURN_IF_ERROR(visitor->FinishVisit(this));
}
return OkStatus();
return absl::OkStatus();
}

// Explicit instantiations.
Expand All @@ -4479,7 +4479,7 @@ absl::Status HloInstruction::AcceptWithOperandOrder(
VLOG(3) << "HloInstruction::AcceptWithOperandOrder AFTER FINISH VISIT";
}
VLOG(2) << "HloInstruction::AcceptWithOperandOrder EXIT";
return OkStatus();
return absl::OkStatus();
}

const Shape& HloInstruction::shape() const { return shape_; }
Expand Down
2 changes: 1 addition & 1 deletion third_party/xla/xla/hlo/ir/hlo_instruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ class HloInstruction {

absl::Status set_backend_config(const tsl::protobuf::Message& proto) {
backend_config_ = BackendConfigWrapper(proto);
return OkStatus();
return absl::OkStatus();
}

// Getter/setter for raw JSON-encoded backend config. Prefer the
Expand Down
6 changes: 3 additions & 3 deletions third_party/xla/xla/hlo/ir/hlo_instructions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2518,7 +2518,7 @@ std::unique_ptr<HloInstruction> HloFusionInstruction::CloneWithNewOperandsImpl(

absl::Status HloFusionInstruction::DeduplicateFusionOperands() {
if (IsCustomFusion()) {
return OkStatus();
return absl::OkStatus();
}
absl::flat_hash_map<const HloInstruction*, int> operand_indices;
std::vector<int> operands_to_remove;
Expand All @@ -2533,12 +2533,12 @@ absl::Status HloFusionInstruction::DeduplicateFusionOperands() {
}
}
if (operands_to_remove.empty()) {
return OkStatus();
return absl::OkStatus();
}
TF_RETURN_IF_ERROR(fused_instructions_computation()
->RemoveUnusedParametersFromFusedComputation());
RemoveOperandsAtAscendingIndices(operands_to_remove);
return OkStatus();
return absl::OkStatus();
}

HloCallInstruction::HloCallInstruction(const Shape& shape,
Expand Down
8 changes: 4 additions & 4 deletions third_party/xla/xla/hlo/ir/hlo_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ absl::Status HloModule::set_schedule(HloSchedule schedule) {
TF_RET_CHECK(schedule.module() == this);
TF_RETURN_IF_ERROR(schedule.Verify());
schedule_ = std::move(schedule);
return OkStatus();
return absl::OkStatus();
}

void HloModule::ReplaceEntryComputation(HloComputation* entry_computation) {
Expand Down Expand Up @@ -199,7 +199,7 @@ absl::Status HloModule::RemoveEmbeddedComputation(HloComputation* to_remove) {
TF_RET_CHECK(it != computations_.end());
TF_RET_CHECK(it->get() == to_remove);
computations_.erase(it);
return OkStatus();
return absl::OkStatus();
}

HloComputation* HloModule::AddEmbeddedComputation(
Expand Down Expand Up @@ -537,7 +537,7 @@ absl::Status HloModule::CheckUniqueNamesAndIdsForComputationsAndInstructions()
instruction_ids.insert(instruction->unique_id());
}
}
return OkStatus();
return absl::OkStatus();
}

/* static */
Expand Down Expand Up @@ -1136,7 +1136,7 @@ absl::Status HloModule::RemoveUnusedComputations() {
for (auto computation : to_remove) {
TF_RETURN_IF_ERROR(RemoveEmbeddedComputation(computation));
}
return OkStatus();
return absl::OkStatus();
}

HloComputation* HloModule::DeepCloneComputation(HloComputation* computation,
Expand Down

0 comments on commit dfe7580

Please sign in to comment.