Skip to content

Commit d0007f3

Browse files
btiplitzdanpovey
authored andcommitted
[src] CUDA allocator: fix order of next largest block (#3739)
1 parent 6f329a6 commit d0007f3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cudamatrix/cu-allocator.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void CuMemoryAllocator::RemoveFromFreeBlocks(MemoryBlock *block) {
152152
largest_free_block_[subregion_index] = 0;
153153
else
154154
largest_free_block_[subregion_index] =
155-
subregion->free_blocks.begin()->first;
155+
subregion->free_blocks.rbegin()->first;
156156
}
157157
}
158158

@@ -212,7 +212,7 @@ void* CuMemoryAllocator::MallocFromSubregion(SubRegion *subregion,
212212
largest_free_block_[subregion_index] = 0;
213213
else
214214
largest_free_block_[subregion_index] =
215-
subregion->free_blocks.begin()->first;
215+
subregion->free_blocks.rbegin()->first;
216216
}
217217

218218
KALDI_PARANOID_ASSERT(block_size >= size && block->allocated == false);
@@ -605,7 +605,7 @@ void CuMemoryAllocator::SortSubregions() {
605605
if (subregions_[i]->free_blocks.empty())
606606
largest_free_block_[i] = 0;
607607
else
608-
largest_free_block_[i] = subregions_[i]->free_blocks.begin()->first;
608+
largest_free_block_[i] = subregions_[i]->free_blocks.rbegin()->first;
609609
}
610610
}
611611

0 commit comments

Comments
 (0)