Verify the validity of ProgramDesc
| 39 | namespace { |
| 40 | // Verify the validity of ProgramDesc |
| 41 | void CheckProgramDescValidity(std::shared_ptr<cpp::ProgramDesc> program_desc, |
| 42 | int inst_block_size) { |
| 43 | CHECK(program_desc) << "Error, program_desc is nullptr"; |
| 44 | auto block_size = program_desc->BlocksSize(); |
| 45 | CHECK_GT(block_size, 0) << "No block exists in current program_desc"; |
| 46 | // TODD(hong19860320) Only support updating the block desc which already |
| 47 | // exists in the origin program desc |
| 48 | CHECK_LE(block_size, inst_block_size) << "Invalid block size, expected (0," |
| 49 | << inst_block_size << "] but got " |
| 50 | << block_size; |
| 51 | } |
| 52 | |
| 53 | std::map<std::string, cpp::VarDesc> ClearBlockDescInfo( |
| 54 | cpp::BlockDesc* block_desc) { |
no test coverage detected