Skip to content

Commit 64d6eb3

Browse files
mjklemmskc7
andauthored
[Flang][experimental] Improve Umpire support (llvm#2112)
Co-authored-by: Sankisa, Krishna (Chaitanya) <[email protected]>
1 parent f1da67f commit 64d6eb3

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,11 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
833833

834834
addFortranDialectOptions(Args, CmdArgs);
835835

836-
if (Args.hasArg(options::OPT_ffast_amd_memory_allocator))
836+
if (Args.hasArg(options::OPT_ffast_amd_memory_allocator)) {
837837
CmdArgs.push_back("-ffast-amd-memory-allocator");
838+
CmdArgs.push_back("-mmlir");
839+
CmdArgs.push_back("-use-alloc-runtime");
840+
}
838841

839842
// 'flang -E' always produces output that is suitable for use as fixed form
840843
// Fortran. However it is only valid free form source if the original is also

flang-rt/lib/amd/amd_alloc.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
namespace Fortran::runtime::amd {
3535

36-
extern bool amdAllocatorEnabled; // connects to descriptor.h
3736
static bool debugEnabled;
3837
static umpire_resourcemanager resourceManager;
3938
static umpire_allocator memoryPool;
@@ -75,7 +74,7 @@ void registerUmpireAllocator(
7574
pool.c_str());
7675
}
7776
#endif // ALLOC_DEBUG
78-
// Configure a dynanmically growing memory pool.
77+
// Configure a dynamically growing memory pool.
7978
umpire_allocator allocator;
8079
umpire_resourcemanager_get_instance(&resourceManager);
8180
umpire_resourcemanager_get_allocator_by_name(
@@ -181,9 +180,6 @@ void RTDEF(AMDRegisterAllocator)() {
181180
}
182181
registerUmpireAllocator(allocSpec.second, initialSize, blockSize);
183182
}
184-
185-
// enable the allocator in the allocator infrastructure
186-
amdAllocatorEnabled = true;
187183
}
188184

189185
void RTDEF(AMDAllocatableSetAllocIdx)(Descriptor &descriptor, int pos) {

flang/test/Lower/AMDGPU/allocate_runtime_alloc_idx.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! RUN: %flang -target amdgcn-- -ffast-amd-memory-allocator -mmlir -use-alloc-runtime -S -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK
1+
! RUN: %flang -target amdgcn-- -ffast-amd-memory-allocator -S -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK
22
subroutine allocate_deallocate()
33
real, allocatable :: x
44
! CHECK: call void @_FortranAAMDAllocatableSetAllocIdx({{.*}}, i32 1)

0 commit comments

Comments
 (0)