File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 99 hiprtc = None
1010
1111
12+ def hip_check (call_result ):
13+ """helper function to check return values of hip calls"""
14+ err = call_result [0 ]
15+ result = call_result [1 :]
16+ if len (result ) == 1 :
17+ result = result [0 ]
18+ if isinstance (err , hip .hipError_t ) and err != hip .hipError_t .hipSuccess :
19+ _ , error_name = hip .hipGetErrorName (err )
20+ _ , error_str = hip .hipGetErrorString (err )
21+ raise RuntimeError (f"{ error_name } : { error_str } " )
22+ return result
23+
24+
1225class HipRuntimeObserver (BenchmarkObserver ):
1326 """Observer that measures time using CUDA events during benchmarking."""
1427
@@ -24,7 +37,7 @@ def __init__(self, dev):
2437
2538 def after_finish (self ):
2639 # Time is measured in milliseconds
27- EventElapsedTime = hip .hipEventElapsedTime (self .start , self .end )
40+ EventElapsedTime = hip_check ( hip .hipEventElapsedTime (self .start , self .end ) )
2841 self .times .append (EventElapsedTime )
2942
3043 def get_results (self ):
You can’t perform that action at this time.
0 commit comments