| 56 | |
| 57 | namespace cpu_function_runtime { |
| 58 | size_t AlignedBufferBytes(const BufferInfo* buffer_infos, size_t n, |
| 59 | bool allocate_entry_params) { |
| 60 | size_t total = 0; |
| 61 | for (size_t i = 0; i < n; ++i) { |
| 62 | bool should_allocate = |
| 63 | buffer_infos[i].is_temp_buffer() || |
| 64 | (buffer_infos[i].is_entry_parameter() && allocate_entry_params); |
| 65 | |
| 66 | if (should_allocate) { |
| 67 | total += align_to(buffer_infos[i].size(), kAlign); |
| 68 | } |
| 69 | } |
| 70 | return total; |
| 71 | } |
| 72 | |
| 73 | void* MallocContiguousBuffers(const BufferInfo* buffer_infos, size_t n, |
| 74 | bool allocate_entry_params, void** bufs, |