| 145 | } |
| 146 | |
| 147 | string HloDataflowAnalysis::ToString() const { |
| 148 | string out = StrCat("HloDataflowAnalysis, module ", module_.name(), "\n"); |
| 149 | StrAppend(&out, " Instruction value sets:\n"); |
| 150 | for (const HloComputation* computation : module_.computations()) { |
| 151 | for (const HloInstruction* instruction : computation->instructions()) { |
| 152 | StrAppend(&out, "Instruction: \n ", instruction->name(), ":\n"); |
| 153 | if (instruction->shape().IsTuple()) { |
| 154 | GetInstructionValueSet(instruction) |
| 155 | .ForEachElement([this, &instruction, &out]( |
| 156 | const ShapeIndex& index, |
| 157 | const HloValueSet& value_set) { |
| 158 | StrAppend(&out, " tuple index ", index.ToString(), ":\n"); |
| 159 | for (const HloValue* value : value_set.values()) { |
| 160 | StrAppend(&out, " ", value->ToShortString(), |
| 161 | ValueIsDefinedAt(instruction, index) ? " (def)" : "", |
| 162 | "\n"); |
| 163 | } |
| 164 | }); |
| 165 | } else { |
| 166 | const HloValueSet& top_level_value_set = |
| 167 | GetValueSet(instruction, /*index=*/{}); |
| 168 | for (const HloValue* value : top_level_value_set.values()) { |
| 169 | StrAppend(&out, " ", value->ToShortString(), |
| 170 | ValueIsDefinedAt(instruction) ? " (def)" : "", "\n"); |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | } |
| 175 | StrAppend(&out, " HloValues:\n"); |
| 176 | for (const HloValue* value : values()) { |
| 177 | StrAppend(&out, value->ToString(/*indent=*/4)); |
| 178 | } |
| 179 | return out; |
| 180 | } |
| 181 | |
| 182 | bool HloDataflowAnalysis::Phi( |
| 183 | HloInstruction* instruction, |
no test coverage detected