SWDEV-289401 - Catch2 tests for hip event APIs
Change-Id: I7c28f842282e07c21656fb92ddbb1a9ad32d752c
[ROCm/hip commit: 5816d20752]
이 커밋은 다음에 포함됨:
1 부모
7ee9099c3e
커밋
6c8eeb09d7
10 파일이 변경됨
+576
-18
검색과 일치하는 파일 없음
@@ -49,6 +49,11 @@ THE SOFTWARE.
|
||||
#define HIP_ASSERT(x) \
|
||||
{ REQUIRE((x)); }
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <chrono>
|
||||
#endif
|
||||
|
||||
// Utility Functions
|
||||
namespace HipTest {
|
||||
@@ -57,4 +62,28 @@ static inline int getDeviceCount() {
|
||||
HIP_CHECK(hipGetDeviceCount(&dev));
|
||||
return dev;
|
||||
}
|
||||
|
||||
// Returns the current system time in microseconds
|
||||
static inline long long get_time() {
|
||||
return std::chrono::high_resolution_clock::now().time_since_epoch()
|
||||
/std::chrono::microseconds(1);
|
||||
}
|
||||
|
||||
static inline double elapsed_time(long long startTimeUs, long long stopTimeUs) {
|
||||
return ((double)(stopTimeUs - startTimeUs)) / ((double)(1000));
|
||||
}
|
||||
|
||||
static inline unsigned setNumBlocks(unsigned blocksPerCU, unsigned threadsPerBlock, size_t N) {
|
||||
int device;
|
||||
HIP_CHECK(hipGetDevice(&device));
|
||||
hipDeviceProp_t props;
|
||||
HIP_CHECK(hipGetDeviceProperties(&props, device));
|
||||
|
||||
unsigned blocks = props.multiProcessorCount * blocksPerCU;
|
||||
if (blocks * threadsPerBlock > N) {
|
||||
blocks = (N + threadsPerBlock - 1) / threadsPerBlock;
|
||||
}
|
||||
|
||||
return blocks;
|
||||
}
|
||||
}
|
||||
새 이슈에서 참조
사용자 차단