Skip to content

Commit

Permalink
chore: minor
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzhuofu committed Aug 11, 2024
1 parent ef118f9 commit 6a0bd4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/flexflow/utils/memory_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MemoryAllocator {
size_t instance_total_size, instance_allocated_size;
};

Legion::Memory get_proc_mem(Legion::Processor proc);
Legion::Memory get_proc_mem(Legion::Machine machine, Legion::Processor proc);

}; // namespace FlexFlow

Expand Down
7 changes: 4 additions & 3 deletions src/utils/memory_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ namespace FlexFlow {

using Legion::Machine;
using Legion::Memory;
using Legion::Processor;

Memory get_proc_mem(Legion::Processor proc) {
Memory get_proc_mem(Machine machine, Processor proc) {
// First try to allocate a managed memory (cudaMallocManaged)
Memory proc_mem = Machine::MemoryQuery(Machine::get_machine())
Memory proc_mem = Machine::MemoryQuery(machine)
.only_kind(Memory::GPU_MANAGED_MEM)
.best_affinity_to(proc)
.first();
if (proc_mem.capacity() > 0) {
return proc_mem;
}
// If managed memory is not available, try to allocate a framebuffer memory
proc_mem = Machine::MemoryQuery(Machine::get_machine())
proc_mem = Machine::MemoryQuery(machine)
.only_kind(Memory::GPU_FB_MEM)
.best_affinity_to(proc)
.first();
Expand Down

0 comments on commit 6a0bd4a

Please sign in to comment.