From 2c8cbf61c35bec20c7f81489330edbb8b4a11809 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Sun, 3 Jun 2018 15:13:48 -0500 Subject: [PATCH] Make emulator friendly Disable some tests that rely on features not typically available in emulator and use smaller data and iteration sets Change-Id: I587bf83162b114719e0361109ed44c6bf2adf34c --- rocrtst/suites/functional/memory_access.cc | 11 ++++++----- rocrtst/suites/performance/dispatch_time.cc | 5 +++++ rocrtst/suites/performance/enqueueLatency.cc | 5 +++++ rocrtst/suites/performance/memory_async_copy.cc | 2 +- rocrtst/suites/performance/memory_async_copy.h | 8 +++++++- rocrtst/suites/test_common/CMakeLists.txt | 5 +++++ rocrtst/suites/test_common/main.cc | 2 ++ rocrtst/suites/test_common/test_case_template.cc | 4 ++++ 8 files changed, 35 insertions(+), 7 deletions(-) diff --git a/rocrtst/suites/functional/memory_access.cc b/rocrtst/suites/functional/memory_access.cc index e4fc136b38..ce26127958 100755 --- a/rocrtst/suites/functional/memory_access.cc +++ b/rocrtst/suites/functional/memory_access.cc @@ -59,11 +59,6 @@ #include "hsa/hsa.h" #include "hsa/hsa_ext_finalize.h" -static const uint32_t kNumBufferElements = 256; - - - - #define RET_IF_HSA_ERR(err) { \ if ((err) != HSA_STATUS_SUCCESS) { \ @@ -156,7 +151,13 @@ static void PrintMemorySubtestHeader(const char *header) { std::cout << " *** Memory Subtest: " << header << " ***" << std::endl; } +#if ROCRTST_EMULATOR_BUILD +static const int kMemoryAllocSize = 8; +#else static const int kMemoryAllocSize = 1024; +#endif + + // Test to check GPU can read & write to system memory void MemoryAccessTest::GPUAccessToCPUMemoryTest(hsa_agent_t cpuAgent, hsa_agent_t gpuAgent) { diff --git a/rocrtst/suites/performance/dispatch_time.cc b/rocrtst/suites/performance/dispatch_time.cc index 79735e9b34..0cbe0ce92d 100755 --- a/rocrtst/suites/performance/dispatch_time.cc +++ b/rocrtst/suites/performance/dispatch_time.cc @@ -61,7 +61,12 @@ DispatchTime(bool defaultInterrupt, bool launchSingleKernel) : TestBase(), use_default_interupt_(defaultInterrupt), launch_single_(launchSingleKernel) { queue_size_ = 0; +#ifdef ROCRTST_EMULATOR_BUILD + num_batch_ = 10; +#else num_batch_ = 100000; +#endif + memset(&aql(), 0, sizeof(hsa_kernel_dispatch_packet_t)); dispatch_time_mean_ = 0.0; set_num_iteration(100); diff --git a/rocrtst/suites/performance/enqueueLatency.cc b/rocrtst/suites/performance/enqueueLatency.cc index 4f4fbc8a6c..991eb070a5 100755 --- a/rocrtst/suites/performance/enqueueLatency.cc +++ b/rocrtst/suites/performance/enqueueLatency.cc @@ -71,7 +71,12 @@ EnqueueLatency:: EnqueueLatency(bool enqueueSinglePacket) : TestBase(), enqueue_single_(enqueueSinglePacket) { queue_size_ = 0; +#if ROCRTST_EMULATOR_BUILD + num_of_pkts_ = 10; +#else num_of_pkts_ = 100000; +#endif + memset(&aql(), 0, sizeof(hsa_kernel_dispatch_packet_t)); enqueue_time_mean_ = 0.0; set_num_iteration(100); diff --git a/rocrtst/suites/performance/memory_async_copy.cc b/rocrtst/suites/performance/memory_async_copy.cc index c98dfb17b4..287637bfbc 100755 --- a/rocrtst/suites/performance/memory_async_copy.cc +++ b/rocrtst/suites/performance/memory_async_copy.cc @@ -449,7 +449,7 @@ void MemoryAsyncCopy::DisplayBenchmark(Transaction *t) const { printf("Data Size Avg Time(us) Avg BW(GB/s)" " Min Time(us) Peak BW(GB/s)\n"); - for (int i = 0; i < 20; i++) { + for (int i = 0; i < kNumGranularity; i++) { if (Size[i] > size) { break; } diff --git a/rocrtst/suites/performance/memory_async_copy.h b/rocrtst/suites/performance/memory_async_copy.h index 75cc02f79d..906b9f7f14 100755 --- a/rocrtst/suites/performance/memory_async_copy.h +++ b/rocrtst/suites/performance/memory_async_copy.h @@ -195,6 +195,12 @@ class MemoryAsyncCopy : public TestBase { protected: void PrintTransactionType(Transaction *t); +#if ROCRTST_EMULATOR_BUILD + static const int kNumGranularity = 1; + static constexpr const char* Str[kNumGranularity] = {"1k"}; + + static constexpr const size_t Size[kNumGranularity] = {1024}; +#else static const int kNumGranularity = 20; static constexpr const char* Str[kNumGranularity] = { @@ -206,7 +212,7 @@ class MemoryAsyncCopy : public TestBase { 256*1024, 512*1024, 1024*1024, 2048*1024, 4096*1024, 8*1024*1024, 16*1024*1024, 32*1024*1024, 64*1024*1024, 128*1024*1024, 256*1024*1024, 512*1024*1024}; - +#endif static constexpr const int kMaxCopySize = Size[kNumGranularity - 1]; // @Brief: Get real iteration number diff --git a/rocrtst/suites/test_common/CMakeLists.txt b/rocrtst/suites/test_common/CMakeLists.txt index 9b98bd21f6..14658547cd 100755 --- a/rocrtst/suites/test_common/CMakeLists.txt +++ b/rocrtst/suites/test_common/CMakeLists.txt @@ -166,6 +166,11 @@ if(${BUILD_TYPE} STREQUAL "Debug") add_definitions(-DDEBUG) endif() +if(${EMULATOR_BUILD}) +add_definitions(-DROCRTST_EMULATOR_BUILD=1) +endif() + + add_definitions(-D__linux__) add_definitions(-DLITTLEENDIAN_CPU=1) diff --git a/rocrtst/suites/test_common/main.cc b/rocrtst/suites/test_common/main.cc index 57fb1587a5..d4f6a300b1 100755 --- a/rocrtst/suites/test_common/main.cc +++ b/rocrtst/suites/test_common/main.cc @@ -192,6 +192,7 @@ TEST(rocrtstFunc, Signal_Create_Concurrently) { RunCustomTestEpilog(&sd); } +#ifndef ROCRTST_EMULATOR_BUILD TEST(rocrtstFunc, DISABLED_Aql_Barrier_Bit_Set) { AqlBarrierBitTest ab(true, false); RunCustomTestProlog(&ab); @@ -361,6 +362,7 @@ TEST(rocrtstStress, DISABLED_Memory_Concurrent_Pool_Info_Test) { mt.MemoryConcurrentPoolGetInfo(); RunCustomTestEpilog(&mt); } +#endif // ROCRTST_EMULATOR_BUILD TEST(rocrtstPerf, ENQUEUE_LATENCY) { EnqueueLatency singlePacketequeue(true); EnqueueLatency multiPacketequeue(false); diff --git a/rocrtst/suites/test_common/test_case_template.cc b/rocrtst/suites/test_common/test_case_template.cc index 6ae513b60f..bf483966c1 100755 --- a/rocrtst/suites/test_common/test_case_template.cc +++ b/rocrtst/suites/test_common/test_case_template.cc @@ -109,7 +109,11 @@ #include "hsa/hsa.h" #include "hsa/hsa_ext_finalize.h" +#ifdef ROCRTST_EMULATOR_BUILD +static const uint32_t kNumBufferElements = 4; +#else static const uint32_t kNumBufferElements = 256; +#endif #define RET_IF_HSA_ERR(err) { \ if ((err) != HSA_STATUS_SUCCESS) { \