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
cb283e98
"vscode:/vscode.git/clone" did not exist on "487170061582fff1b228097847f882aaf1853fd3"
Commit
cb283e98
authored
Jan 21, 2025
by
Ville Pietilä
Browse files
Small performance optimization.
parent
4c5ebf64
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
include/ck/utility/host_memory_allocator.hpp
include/ck/utility/host_memory_allocator.hpp
+10
-4
No files found.
include/ck/utility/host_memory_allocator.hpp
View file @
cb283e98
...
...
@@ -320,11 +320,11 @@ namespace memory {
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
std
::
vector
<
void
*>
keys
;
for
(
const
auto
&
[
p
,
_
]
:
allocated_memory_
)
{
keys
.
reserve
(
allocated_memory_
.
size
());
for
(
const
auto
&
[
p
,
_
]
:
allocated_memory_
)
{
keys
.
push_back
(
p
);
}
for
(
auto
p
:
keys
)
for
(
const
void
*
p
:
keys
)
{
if
(
canDeallocate
(
p
))
{
...
...
@@ -358,6 +358,13 @@ namespace memory {
bool
canDeallocate
(
void
*
p
)
{
const
bool
can_deallocate_on_host
=
host_destruct_events_
[
p
];
if
(
!
can_deallocate_on_host
)
{
return
false
;
}
bool
can_deallocate_on_device
=
false
;
hipError_t
state
=
hipEventQuery
(
device_destruct_events_
[
p
]);
if
(
state
==
hipSuccess
)
...
...
@@ -369,7 +376,6 @@ namespace memory {
throw
std
::
runtime_error
(
"Error querying event state: "
+
std
::
to_string
(
state
));
}
const
bool
can_deallocate_on_host
=
host_destruct_events_
[
p
];
return
can_deallocate_on_device
&&
can_deallocate_on_host
;
}
};
...
...
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