Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ add_dependencies(msplat_core metallib)

# --- CLI binary ---

add_executable(msplat cli/msplat.cpp)
add_executable(msplat cli/msplat.mm)
target_link_libraries(msplat PRIVATE
msplat_core
CLI11::CLI11
Expand Down
8 changes: 8 additions & 0 deletions cli/msplat.cpp → cli/msplat.mm
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ int main(int argc, char *argv[]) {

auto bench_start = cpu_now();
for (; step <= (size_t)numIters; step++) {
// Per-iteration autorelease pool. Each step creates autoreleased
// Metal objects (command buffers, encoders, transient textures);
// without draining them every iteration they accumulate for the
// entire run and OOM-kill the process around step ~12k. Wrapping
// the body drains them at the end of each step. This file is
// compiled as Obj-C++ (.mm) so @autoreleasepool is available.
@autoreleasepool {
Camera &cam = cams[camsIter.next()];

auto iter_start = cpu_now();
Expand Down Expand Up @@ -180,6 +187,7 @@ int main(int argc, char *argv[]) {
memcpy(valImg.ptr(), rgb_cpu.data_ptr(), valImg.data.size() * sizeof(float));
imwriteRGB((fs::path(valRender) / (std::to_string(step) + ".png")).string(), valImg);
}
} // @autoreleasepool
}

if (benchmarking && !bench_iter_ms.empty()) {
Expand Down
Loading