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
jerrrrry
infinicore
Commits
1f871ea9
Unverified
Commit
1f871ea9
authored
Dec 17, 2025
by
thatPepe
Committed by
GitHub
Dec 17, 2025
Browse files
Merge pull request #797 from gongchensu/Issue/794
Issue/794 - Use native musaEventElapsedTime API.
parents
726eacf8
8739920b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
18 deletions
+1
-18
src/infinirt/moore/infinirt_moore.cc
src/infinirt/moore/infinirt_moore.cc
+1
-18
No files found.
src/infinirt/moore/infinirt_moore.cc
View file @
1f871ea9
#include "infinirt_moore.h"
#include "../../utils.h"
#include <chrono>
#include <musa_runtime.h>
#include <musa_runtime_api.h>
...
...
@@ -83,23 +82,7 @@ infiniStatus_t eventDestroy(infinirtEvent_t event) {
}
infiniStatus_t
eventElapsedTime
(
float
*
ms_ptr
,
infinirtEvent_t
start
,
infinirtEvent_t
end
)
{
// MUSA may not have direct musaEventElapsedTime API
// Use a fallback method: synchronize events and measure CPU time difference
// Note: This includes synchronization overhead, so timing may not be as accurate
// as native GPU event timing, but it allows benchmarking to work
// Synchronize start event and record CPU time
CHECK_MUSART
(
musaEventSynchronize
((
musaEvent_t
)
start
));
auto
start_cpu_time
=
std
::
chrono
::
steady_clock
::
now
();
// Synchronize end event and record CPU time
CHECK_MUSART
(
musaEventSynchronize
((
musaEvent_t
)
end
));
auto
end_cpu_time
=
std
::
chrono
::
steady_clock
::
now
();
// Calculate elapsed time in milliseconds
auto
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
end_cpu_time
-
start_cpu_time
);
*
ms_ptr
=
static_cast
<
float
>
(
duration
.
count
())
/
1000.0
f
;
CHECK_MUSART
(
musaEventElapsedTime
(
ms_ptr
,
(
musaEvent_t
)
start
,
(
musaEvent_t
)
end
));
return
INFINI_STATUS_SUCCESS
;
}
...
...
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