| 211 | }; |
| 212 | |
| 213 | std::string BufferAssignmentToString(const BufferAssignment& assignment) { |
| 214 | std::ostringstream out; |
| 215 | for (const auto& p : assignment.param_to_alloc_idx) { |
| 216 | int param_idx = p.first; |
| 217 | int allocation_idx = p.second; |
| 218 | out << "Param: " << param_idx << " (allocation " << allocation_idx << "): "; |
| 219 | auto p2 = assignment.buffers_shape.find(allocation_idx); |
| 220 | Check(p2 != assignment.buffers_shape.end(), |
| 221 | "Shape not found for parameter: " + std::to_string(param_idx)); |
| 222 | out << TupleShapeToString(p2->second) |
| 223 | << ", size = " << assignment.buffers_size[allocation_idx] << "\n"; |
| 224 | } |
| 225 | return out.str(); |
| 226 | } |
| 227 | |
| 228 | // RAII table for the given assignment: mapping from a allocation idx to the |
| 229 | // actual allocation. |