Files
pytorch/torch/nativert/executor/memory/Bump.cpp
dolpm 9665702c64 [nativert] reland D76832891 remove designated initializer cpp20 (#156565)
Summary: fix windows build broke in https://github.com/pytorch/pytorch/pull/156508

Test Plan:
ci

Rollback Plan:

Differential Revision: D77080420

Pull Request resolved: https://github.com/pytorch/pytorch/pull/156565
Approved by: https://github.com/zhxchen17
2025-06-24 02:38:08 +00:00

25 lines
533 B
C++

#include <torch/nativert/executor/memory/Bump.h>
namespace torch::nativert {
LayoutPlan BumpAllocationPlanner(
const std::vector<AllocationSpec>& allocation_specs) {
LayoutPlan plan;
auto& allocations = plan.allocations;
auto& total_size = plan.total_size;
allocations.reserve(allocation_specs.size());
for (const auto& spec : allocation_specs) {
allocations.push_back(Allocation{
spec.size,
total_size,
});
total_size += spec.size;
}
return plan;
}
} // namespace torch::nativert