Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
composable_kernel_ROCM
Commits
5471fad5
Commit
5471fad5
authored
Dec 19, 2024
by
Ville Pietilä
Browse files
Change pinned host memory pool default configuration.
parent
ab7855a3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
include/ck/utility/host_memory_allocator.hpp
include/ck/utility/host_memory_allocator.hpp
+4
-5
No files found.
include/ck/utility/host_memory_allocator.hpp
View file @
5471fad5
...
...
@@ -15,7 +15,7 @@
#include "unistd.h"
CK_DECLARE_ENV_VAR_BOOL
(
CK_USE_DYNAMIC_MEM_POOL
)
CK_DECLARE_ENV_VAR_BOOL
(
CK_PREFER_
NEW
_PINNED_MEM
_ALLOCATION
)
CK_DECLARE_ENV_VAR_BOOL
(
CK_PREFER_
RECYCLED
_PINNED_MEM
)
namespace
ck
{
namespace
memory
{
...
...
@@ -44,7 +44,6 @@ namespace memory {
if
(
enableLogging_
)
std
::
cout
<<
"[ DynamicMemPool ] Deleting pool for process "
<<
pid_
<<
"..."
<<
std
::
endl
;
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
for
(
auto
&
[
size
,
q
]
:
memory_pool_
)
{
clearMemoryPoolQueue
(
q
);
...
...
@@ -150,7 +149,7 @@ namespace memory {
enableLogging_
(
ck
::
EnvIsEnabled
(
CK_ENV
(
CK_LOGGING
))),
pid_
(
getpid
()),
offsetInBytes_
(
0
),
prefer
NewAllocation
_
(
ck
::
EnvIsEnabled
(
CK_ENV
(
CK_PREFER_
NEW
_PINNED_MEM
_ALLOCATION
)))
prefer
RecycledMem
_
(
ck
::
EnvIsEnabled
(
CK_ENV
(
CK_PREFER_
RECYCLED
_PINNED_MEM
)))
{
hip_check_error
(
hipHostMalloc
(
&
pinnedMemoryBaseAddress_
,
memoryPoolSizeInBytes_
));
if
(
enableLogging_
)
...
...
@@ -172,7 +171,7 @@ namespace memory {
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
if
(
prefer
NewAllocation
_
&&
offsetInBytes_
+
sizeInBytes
<
memoryPoolSizeInBytes_
)
if
(
!
prefer
RecycledMem
_
&&
offsetInBytes_
+
sizeInBytes
<
memoryPoolSizeInBytes_
)
{
return
allocateNewMemory
(
sizeInBytes
);
}
...
...
@@ -226,7 +225,7 @@ namespace memory {
bool
enableLogging_
;
int
pid_
;
int
offsetInBytes_
;
bool
prefer
NewAllocation
_
;
bool
prefer
RecycledMem
_
;
void
*
allocateNewMemory
(
size_t
sizeInBytes
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment