More emulator friendly tests/examples
Change-Id: I27ab26add14743dfb065238129c14b48913d9df8
[ROCm/ROCR-Runtime commit: 12a81ae96f]
This commit is contained in:
@@ -126,6 +126,10 @@ else()
|
||||
set(ISDEBUG 1)
|
||||
endif()
|
||||
|
||||
if(${EMULATOR_BUILD})
|
||||
add_definitions(-DROCRTST_EMULATOR_BUILD=1)
|
||||
endif()
|
||||
|
||||
# Set Name for Samples Project
|
||||
#
|
||||
|
||||
|
||||
@@ -62,9 +62,15 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#ifndef ROCRTST_EMULATOR_BUILD
|
||||
static const uint32_t kBinarySearchLength = 512;
|
||||
static const uint32_t kBinarySearchFindMe = 108;
|
||||
static const uint32_t kWorkGroupSize = 256;
|
||||
#else
|
||||
static const uint32_t kBinarySearchLength = 16;
|
||||
static const uint32_t kBinarySearchFindMe = 6;
|
||||
static const uint32_t kWorkGroupSize = 8;
|
||||
#endif
|
||||
|
||||
// Hold all the info specific to binary search
|
||||
typedef struct BinarySearch {
|
||||
@@ -110,9 +116,9 @@ typedef struct BinarySearch {
|
||||
void InitializeBinarySearch(BinarySearch* bs) {
|
||||
bs->kernel_file_name = "./binary_search_kernels.hsaco";
|
||||
bs->kernel_name = "binarySearch";
|
||||
bs->length = 512;
|
||||
bs->find_me = 108;
|
||||
bs->work_group_size = 256;
|
||||
bs->length = kBinarySearchLength;
|
||||
bs->find_me = kBinarySearchFindMe;
|
||||
bs->work_group_size = kWorkGroupSize;
|
||||
bs->num_sub_divisions = bs->length / bs->work_group_size;
|
||||
}
|
||||
|
||||
@@ -586,13 +592,12 @@ hsa_status_t Run(BinarySearch* bs) {
|
||||
if (bs->work_group_size > 64) {
|
||||
bs->work_group_size = 64;
|
||||
bs->num_sub_divisions = bs->length / bs->work_group_size;
|
||||
|
||||
if (bs->num_sub_divisions < bs->work_group_size) {
|
||||
bs->num_sub_divisions = bs->work_group_size;
|
||||
}
|
||||
|
||||
bs->work_grid_size = bs->num_sub_divisions;
|
||||
}
|
||||
if (bs->num_sub_divisions < bs->work_group_size) {
|
||||
bs->num_sub_divisions = bs->work_group_size;
|
||||
}
|
||||
|
||||
bs->work_grid_size = bs->num_sub_divisions;
|
||||
|
||||
// Explanation of BinarySearch algorithm.
|
||||
/*
|
||||
|
||||
@@ -132,9 +132,15 @@ static hsa_status_t FindDevicePool(hsa_amd_memory_pool_t pool, void* data) {
|
||||
|
||||
if (err == HSA_STATUS_INFO_BREAK) {
|
||||
args->gpu_pool = pool;
|
||||
|
||||
|
||||
#ifdef ROCRTST_EMULATOR_BUILD
|
||||
args->gpu_mem_granule = 4;
|
||||
#else
|
||||
err = hsa_amd_memory_pool_get_info(args->gpu_pool,
|
||||
HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_GRANULE, &args->gpu_mem_granule);
|
||||
RET_IF_HSA_ERR(err);
|
||||
#endif
|
||||
|
||||
// We found what we were looking for, so return HSA_STATUS_INFO_BREAK
|
||||
return HSA_STATUS_INFO_BREAK;
|
||||
|
||||
@@ -270,8 +270,12 @@ void IPCTest::Run(void) {
|
||||
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
|
||||
|
||||
size_t gpu_mem_granule;
|
||||
#ifdef ROCRTST_EMULATOR_BUILD
|
||||
gpu_mem_granule = 4;
|
||||
#else
|
||||
err = hsa_amd_memory_pool_get_info(device_pool(),
|
||||
HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_GRANULE, &gpu_mem_granule);
|
||||
#endif
|
||||
|
||||
if (verbosity() >= VERBOSE_STANDARD) {
|
||||
fprintf(stdout, "Using: %s (%d) and %s (%d)\n", name1, loc1, name2, loc2);
|
||||
|
||||
@@ -413,14 +413,6 @@ TEST(rocrtstStress, Queue_LoadStore_Write_Index_ConcurrentTest) {
|
||||
Qw.QueueLoadStoreWriteIndexAtomic();
|
||||
RunCustomTestEpilog(&Qw);
|
||||
}
|
||||
#endif // ROCRTST_EMULATOR_BUILD
|
||||
|
||||
TEST(rocrtstPerf, ENQUEUE_LATENCY) {
|
||||
EnqueueLatency singlePacketequeue(true);
|
||||
EnqueueLatency multiPacketequeue(false);
|
||||
RunGenericTest(&singlePacketequeue);
|
||||
RunGenericTest(&multiPacketequeue);
|
||||
}
|
||||
|
||||
TEST(rocrtstPerf, Memory_Async_Copy) {
|
||||
MemoryAsyncCopy mac;
|
||||
@@ -433,6 +425,14 @@ TEST(rocrtstPerf, Memory_Async_Copy) {
|
||||
// another gpu
|
||||
RunGenericTest(&mac);
|
||||
}
|
||||
#endif // ROCRTST_EMULATOR_BUILD
|
||||
|
||||
TEST(rocrtstPerf, ENQUEUE_LATENCY) {
|
||||
EnqueueLatency singlePacketequeue(true);
|
||||
EnqueueLatency multiPacketequeue(false);
|
||||
RunGenericTest(&singlePacketequeue);
|
||||
RunGenericTest(&multiPacketequeue);
|
||||
}
|
||||
|
||||
TEST(rocrtstPerf, Memory_Async_Copy_NUMA) {
|
||||
MemoryAsyncCopyNUMA numa;
|
||||
|
||||
Verwijs in nieuw issue
Block a user