| 1773 | } // namespace |
| 1774 | |
| 1775 | StatusOr<bool> HloVerifier::Run(HloModule* module) { |
| 1776 | TF_RET_CHECK(!module->name().empty()); |
| 1777 | |
| 1778 | if (module->entry_computation()->IsFusionComputation()) { |
| 1779 | return InvalidArgument( |
| 1780 | "Module entry computation cannot be a fusion computation"); |
| 1781 | } |
| 1782 | |
| 1783 | TF_RETURN_IF_ERROR(VerifyHloStructure(module)); |
| 1784 | TF_RETURN_IF_ERROR(VerifyAsynchronousCopies(*module)); |
| 1785 | TF_RETURN_IF_ERROR(VerifyChannels(*module)); |
| 1786 | |
| 1787 | std::unique_ptr<ShapeVerifier> shape_verifier = |
| 1788 | target_metadata_->GetVerifier(); |
| 1789 | InstructionVerifier instruction_verifier(instruction_can_change_layout_func_); |
| 1790 | for (auto* computation : module->computations()) { |
| 1791 | TF_RETURN_IF_ERROR(computation->Accept(shape_verifier.get())); |
| 1792 | TF_RETURN_IF_ERROR(computation->Accept(&instruction_verifier)); |
| 1793 | } |
| 1794 | |
| 1795 | TF_RETURN_IF_ERROR(shape_verifier->VerifyEntryComputationLayout(*module)); |
| 1796 | TF_RETURN_IF_ERROR(VerifyEntryAndExitShapes(*module)); |
| 1797 | |
| 1798 | // If the module has a schedule, it must be valid. |
| 1799 | if (module->has_schedule()) { |
| 1800 | TF_RETURN_IF_ERROR(module->schedule().Verify()); |
| 1801 | } |
| 1802 | |
| 1803 | TF_RETURN_IF_ERROR(module->input_output_alias_config().Verify( |
| 1804 | *module, [this](const Shape& shape) -> int64 { |
| 1805 | if (target_metadata_->IsLayoutSensitive()) { |
| 1806 | return target_metadata_->ShapeSize(shape); |
| 1807 | } else { |
| 1808 | return 0; |
| 1809 | } |
| 1810 | })); |
| 1811 | |
| 1812 | TF_RETURN_IF_ERROR(module->dynamic_parameter_binding().Verify(*module)); |
| 1813 | TF_RETURN_IF_ERROR(VerifyLayoutConstrainedAllReduce(*module)); |
| 1814 | |
| 1815 | return false; |
| 1816 | } |
| 1817 | |
| 1818 | } // namespace xla |
nothing calls this directly
no test coverage detected