From 2e238786550c505c52988c2a47337d58831100ba Mon Sep 17 00:00:00 2001 From: kahmed10 <15948690+kahmed10@users.noreply.github.com> Date: Sat, 11 Jan 2025 06:12:53 -0600 Subject: [PATCH] Fix memory_coloring pass when MIGRAPHX_NSTREAMS > 2 I noticed allocation segments reaching close to uint64 max value, which clearly would throw an out of memory error when trying to allocate on the GPU. This happened when MIGRAPHX_NSTREAMS was set to 2 or greater and the model somehow was large enough to trigger it. Changing from `auto` to `size_t` seems to fix the issue. --- src/memory_coloring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/memory_coloring.cpp b/src/memory_coloring.cpp index 3753f549000..d7aa0349c72 100644 --- a/src/memory_coloring.cpp +++ b/src/memory_coloring.cpp @@ -177,9 +177,9 @@ struct allocation_segment { assert(ins->get_shape().bytes() > 0); // Compute alignment - auto n = 1 + (ins->get_shape().bytes() - 1) / alignment; + std::size_t n = 1 + (ins->get_shape().bytes() - 1) / alignment; assert(n > 0); - auto start = 0; + std::size_t start = 0; // Insert at end if it cant fit at the begining if(segments.empty() or segments.begin()->first <= n) {