diff --git a/projects/rocr-runtime/rocrtst/samples/CMakeLists.txt b/projects/rocr-runtime/rocrtst/samples/CMakeLists.txt index e8f5f7501d..e9cd4f99a4 100755 --- a/projects/rocr-runtime/rocrtst/samples/CMakeLists.txt +++ b/projects/rocr-runtime/rocrtst/samples/CMakeLists.txt @@ -126,6 +126,10 @@ else() set(ISDEBUG 1) endif() +if(${EMULATOR_BUILD}) +add_definitions(-DROCRTST_EMULATOR_BUILD=1) +endif() + # Set Name for Samples Project # diff --git a/projects/rocr-runtime/rocrtst/samples/binary_search/binary_search.cc b/projects/rocr-runtime/rocrtst/samples/binary_search/binary_search.cc index f16938c0a3..07db231034 100755 --- a/projects/rocr-runtime/rocrtst/samples/binary_search/binary_search.cc +++ b/projects/rocr-runtime/rocrtst/samples/binary_search/binary_search.cc @@ -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. /* diff --git a/projects/rocr-runtime/rocrtst/samples/ipc/ipc.cc b/projects/rocr-runtime/rocrtst/samples/ipc/ipc.cc index 1e3b3afa89..52302a00bf 100755 --- a/projects/rocr-runtime/rocrtst/samples/ipc/ipc.cc +++ b/projects/rocr-runtime/rocrtst/samples/ipc/ipc.cc @@ -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; diff --git a/projects/rocr-runtime/rocrtst/suites/functional/ipc.cc b/projects/rocr-runtime/rocrtst/suites/functional/ipc.cc index 4a39a6030d..28f532815e 100755 --- a/projects/rocr-runtime/rocrtst/suites/functional/ipc.cc +++ b/projects/rocr-runtime/rocrtst/suites/functional/ipc.cc @@ -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); diff --git a/projects/rocr-runtime/rocrtst/suites/test_common/main.cc b/projects/rocr-runtime/rocrtst/suites/test_common/main.cc index ba8a81262d..71c473f4c1 100755 --- a/projects/rocr-runtime/rocrtst/suites/test_common/main.cc +++ b/projects/rocr-runtime/rocrtst/suites/test_common/main.cc @@ -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;