From c26b32b0f77a70e6bdf9e7e911980b4322c03788 Mon Sep 17 00:00:00 2001 From: gobhardw Date: Wed, 12 Jul 2023 12:18:55 +0530 Subject: [PATCH] Fixing ATT outdata in test run Change-Id: If5bb2ead00179503bfa0d9a118b9e04d3f810319 [ROCm/rocprofiler commit: e88cad28b6bb6463812c8bb78aface88218817f3] --- .../profiler/apps/hip_kernels.cpp | 2 -- .../featuretests/profiler/profiler_gtest.cpp | 25 +++++++++---------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/projects/rocprofiler/tests-v2/featuretests/profiler/apps/hip_kernels.cpp b/projects/rocprofiler/tests-v2/featuretests/profiler/apps/hip_kernels.cpp index 1a6b856a11..ed229db94c 100644 --- a/projects/rocprofiler/tests-v2/featuretests/profiler/apps/hip_kernels.cpp +++ b/projects/rocprofiler/tests-v2/featuretests/profiler/apps/hip_kernels.cpp @@ -88,8 +88,6 @@ int LaunchVectorAddKernel() { } if (errors != 0) { printf("FAILED: %d errors\n", errors); - } else { - printf("PASSED!\n"); } HIP_ASSERT(hipFree(deviceA)); diff --git a/projects/rocprofiler/tests-v2/featuretests/profiler/profiler_gtest.cpp b/projects/rocprofiler/tests-v2/featuretests/profiler/profiler_gtest.cpp index da53932d5a..7b3fecc935 100644 --- a/projects/rocprofiler/tests-v2/featuretests/profiler/profiler_gtest.cpp +++ b/projects/rocprofiler/tests-v2/featuretests/profiler/profiler_gtest.cpp @@ -587,8 +587,9 @@ TEST_F(LoadUnloadTest, WhenLoadingSecondTimeThenToolLoadsUnloadsSuccessfully) { class ATTCollection : public ::testing::Test { public: - virtual void SetUp(){}; + virtual void SetUp(){bCollected = false;}; virtual void TearDown(){}; + static bool bCollected; static void FlushCallback(const rocprofiler_record_header_t* record, const rocprofiler_record_header_t* end_record, @@ -606,30 +607,25 @@ class ATTCollection : public ::testing::Test { const char* kernel_name_c = static_cast(malloc(name_length * sizeof(char))); rocprofiler_query_kernel_info(ROCPROFILER_KERNEL_NAME, att_tracer_record->kernel_id, &kernel_name_c); - int gpu_index = att_tracer_record->gpu_id.handle; - printf("Kernel Info:\n\tGPU Index: %d\n\tKernel Name: %s\n", gpu_index, kernel_name_c); // Get the number of shader engine traces int se_num = att_tracer_record->shader_engine_data_count; // iterate over each shader engine att trace for (int i = 0; i < se_num; i++) { - printf("\n\n-------------- shader_engine %d --------------\n\n", i); - rocprofiler_record_se_att_data_t* se_att_trace = - &att_tracer_record->shader_engine_data[i]; - uint32_t size = se_att_trace->buffer_size; - const unsigned short* data_buffer_ptr = - reinterpret_cast(se_att_trace->buffer_ptr); - - // Print the buffer in terms of shorts (16 bits) - for (uint32_t j = 0; j < (size / sizeof(short)); j++) - printf("%04x\n", data_buffer_ptr[j]); + if (!att_tracer_record->shader_engine_data) + continue; + auto se_att_trace = att_tracer_record->shader_engine_data[i]; + if (!se_att_trace.buffer_ptr || !se_att_trace.buffer_size) + continue; + bCollected = true; } } rocprofiler_next_record(record, &record, session_id, buffer_id); } } }; +bool ATTCollection::bCollected = false; TEST_F(ATTCollection, WhenRunningATTItCollectsTraceData) { int result = ROCPROFILER_STATUS_ERROR; @@ -690,6 +686,9 @@ TEST_F(ATTCollection, WhenRunningATTItCollectsTraceData) { // finalize att tracing by destroying rocprofiler object result = rocprofiler_finalize(); EXPECT_EQ(ROCPROFILER_STATUS_SUCCESS, result); + + //check if we got data from any shader engine + EXPECT_EQ(bCollected, true); } /*