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
a19235d4
Commit
a19235d4
authored
Dec 19, 2024
by
Ville Pietilä
Browse files
Fixed cleaning up pinned host memory after deallocate.
parent
578fd2d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
include/ck/utility/host_memory_allocator.hpp
include/ck/utility/host_memory_allocator.hpp
+14
-1
No files found.
include/ck/utility/host_memory_allocator.hpp
View file @
a19235d4
...
@@ -5,13 +5,18 @@
...
@@ -5,13 +5,18 @@
#include <hip/hip_runtime.h>
#include <hip/hip_runtime.h>
#include "ck/host_utility/hip_check_error.hpp"
#include "ck/host_utility/hip_check_error.hpp"
#include "ck/utility/env.hpp"
#include <map>
#include <map>
#include <queue>
#include <queue>
#include <mutex>
#include <mutex>
#include <cstddef>
#include <cstddef>
#include <limits>
#include <limits>
#include <type_traits>
#include "unistd.h"
#include "unistd.h"
CK_DECLARE_ENV_VAR_BOOL
(
CK_USE_DYNAMIC_MEM_POOL
)
CK_DECLARE_ENV_VAR_BOOL
(
CK_PREFER_NEW_PINNED_MEM_ALLOCATION
)
namespace
ck
{
namespace
ck
{
namespace
memory
{
namespace
memory
{
...
@@ -296,7 +301,15 @@ namespace memory {
...
@@ -296,7 +301,15 @@ namespace memory {
return
static_cast
<
T
*>
(
memory_pool
.
allocate
(
sizeInBytes
));
return
static_cast
<
T
*>
(
memory_pool
.
allocate
(
sizeInBytes
));
}
}
void
deallocate
(
T
*
p
,
std
::
size_t
n
)
{
void
deallocate
(
T
*
p
,
std
::
size_t
n
)
{
if
constexpr
(
std
::
is_destructible_v
<
T
>
)
{
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
p
[
i
].
~
T
();
}
}
auto
&
memory_pool
=
get_memory_pool
();
auto
&
memory_pool
=
get_memory_pool
();
const
size_t
sizeInBytes
=
n
*
sizeof
(
T
);
const
size_t
sizeInBytes
=
n
*
sizeof
(
T
);
memory_pool
.
deallocate
(
p
,
sizeInBytes
);
memory_pool
.
deallocate
(
p
,
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