diff --git a/projects/rocprofiler-systems/examples/jpegdecode/CMakeLists.txt b/projects/rocprofiler-systems/examples/jpegdecode/CMakeLists.txt index fd4a8c46b2..6b7cd5e9ed 100644 --- a/projects/rocprofiler-systems/examples/jpegdecode/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/jpegdecode/CMakeLists.txt @@ -65,6 +65,16 @@ if(EXISTS "${ROCmVersion_DIR}/share/rocjpeg/images") file(GLOB_RECURSE image_files "${ROCmVersion_DIR}/share/rocjpeg/images/*") file(COPY ${image_files} DESTINATION ${CMAKE_BINARY_DIR}/images) + set(NUM_COPIES 20) + + # Loop over each file and make additional copies + foreach(file ${image_files}) + get_filename_component(filename ${file} NAME) + foreach(i RANGE 1 ${NUM_COPIES}) + file(COPY ${file} + DESTINATION ${CMAKE_BINARY_DIR}/images/${filename}_copy${i}.jpg) + endforeach() + endforeach() else() message( AUTHOR_WARNING diff --git a/projects/rocprofiler-systems/examples/videodecode/CMakeLists.txt b/projects/rocprofiler-systems/examples/videodecode/CMakeLists.txt index fee5048610..6551da4f22 100644 --- a/projects/rocprofiler-systems/examples/videodecode/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/videodecode/CMakeLists.txt @@ -49,7 +49,7 @@ function(videodecode_message _MSG_TYPE) endfunction() # Find RocDecode -find_package(rocDecode REQUIRED) +find_package(rocDecode QUIET) if(NOT ROCDECODE_FOUND) videodecode_message(AUTHOR_WARNING "${PROJECT_NAME} skipped. Missing RocDecode...") return() diff --git a/projects/rocprofiler-systems/source/lib/core/categories.hpp b/projects/rocprofiler-systems/source/lib/core/categories.hpp index 2707378457..3824323acc 100644 --- a/projects/rocprofiler-systems/source/lib/core/categories.hpp +++ b/projects/rocprofiler-systems/source/lib/core/categories.hpp @@ -100,6 +100,8 @@ ROCPROFSYS_DEFINE_CATEGORY(category, rocm_scratch_memory, ROCPROFSYS_CATEGORY_RO ROCPROFSYS_DEFINE_CATEGORY(category, rocm_page_migration, ROCPROFSYS_CATEGORY_ROCM_PAGE_MIGRATION, "rocm_page_migration", "ROCm memory page migration") ROCPROFSYS_DEFINE_CATEGORY(category, rocm_counter_collection, ROCPROFSYS_CATEGORY_ROCM_COUNTER_COLLECTION, "rocm_counter_collection", "ROCm device counter collection") ROCPROFSYS_DEFINE_CATEGORY(category, rocm_marker_api, ROCPROFSYS_CATEGORY_ROCM_MARKER_API, "rocm_marker_api", "ROCTx labels") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_rocdecode_api, ROCPROFSYS_CATEGORY_ROCM_ROCDECODE_API, "rocm_rocdecode_api", "ROCm RocDecode API") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_rocjpeg_api, ROCPROFSYS_CATEGORY_ROCM_ROCJPEG_API, "rocm_rocjpeg_api", "ROCm RocJPEG API") ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi, ROCPROFSYS_CATEGORY_ROCM_SMI, "rocm_smi", "rocm-smi data") ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_busy, ROCPROFSYS_CATEGORY_ROCM_SMI_BUSY, "device_busy", "Busy percentage of a GPU device") ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_temp, ROCPROFSYS_CATEGORY_ROCM_SMI_TEMP, "device_temp", "Temperature of a GPU device") @@ -107,7 +109,6 @@ ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_power, ROCPROFSYS_CATEGORY_ROCM_SM ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_memory_usage, ROCPROFSYS_CATEGORY_ROCM_SMI_MEMORY_USAGE, "device_memory_usage", "Memory usage of a GPU device") ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_vcn_activity, ROCPROFSYS_CATEGORY_ROCM_SMI_VCN_ACTIVITY, "device_vcn_activity", "VCN Activity of a GPU device") ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_jpeg_activity, ROCPROFSYS_CATEGORY_ROCM_SMI_JPEG_ACTIVITY, "device_jpeg_activity", "JPEG Activity of a GPU device") -ROCPROFSYS_DEFINE_CATEGORY(category, rocm_rocdecode_api, ROCPROFSYS_CATEGORY_ROCM_ROCDECODE_API, "rocm_rocdecode_api", "ROCm ROCDecode API") ROCPROFSYS_DEFINE_CATEGORY(category, rocm_rccl, ROCPROFSYS_CATEGORY_ROCM_RCCL, "rccl", "ROCm Communication Collectives Library (RCCL) regions") ROCPROFSYS_DEFINE_CATEGORY(category, pthread, ROCPROFSYS_CATEGORY_PTHREAD, "pthread", "POSIX threading functions") ROCPROFSYS_DEFINE_CATEGORY(category, kokkos, ROCPROFSYS_CATEGORY_KOKKOS, "kokkos", "KokkosTools regions") @@ -166,6 +167,8 @@ using name = perfetto_category; ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_page_migration), \ ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_counter_collection), \ ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_marker_api), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_rocdecode_api), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_rocjpeg_api), \ ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi), \ ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_busy), \ ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_temp), \ @@ -173,7 +176,6 @@ using name = perfetto_category; ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_memory_usage), \ ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_vcn_activity), \ ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_jpeg_activity), \ - ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_rocdecode_api), \ ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_rccl), \ ROCPROFSYS_PERFETTO_CATEGORY(category::pthread), \ ROCPROFSYS_PERFETTO_CATEGORY(category::kokkos), \ diff --git a/projects/rocprofiler-systems/source/lib/core/config.cpp b/projects/rocprofiler-systems/source/lib/core/config.cpp index f77bc502e8..ebe82a0316 100644 --- a/projects/rocprofiler-systems/source/lib/core/config.cpp +++ b/projects/rocprofiler-systems/source/lib/core/config.cpp @@ -1885,7 +1885,9 @@ get_use_vaapi_tracing() std::string domains = static_cast&>(*_v->second).get(); auto domain_list = tim::delimit(domains, " ,;:\t\n"); return std::find(domain_list.begin(), domain_list.end(), "rocdecode_api") != - domain_list.end(); + domain_list.end() || + std::find(domain_list.begin(), domain_list.end(), "rocjpeg_api") != + domain_list.end(); // Check rocdecode_api or rocjpeg_api is present #else return false; #endif diff --git a/projects/rocprofiler-systems/source/lib/core/rocprofiler-sdk.cpp b/projects/rocprofiler-systems/source/lib/core/rocprofiler-sdk.cpp index 9b2fdad455..00c488dd79 100644 --- a/projects/rocprofiler-systems/source/lib/core/rocprofiler-sdk.cpp +++ b/projects/rocprofiler-systems/source/lib/core/rocprofiler-sdk.cpp @@ -360,9 +360,10 @@ get_callback_domains() ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API, ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API, ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT, -# if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \ +# if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 7) || \ ROCPROFILER_VERSION_MAJOR >= 1 ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API, + ROCPROFILER_CALLBACK_TRACING_ROCJPEG_API, # endif }; @@ -406,13 +407,6 @@ get_callback_domains() { _data.emplace(ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API); } -# if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \ - ROCPROFILER_VERSION_MAJOR >= 1 - else if(itr == "rocdecode_api") - { - _data.emplace(ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API); - } -# endif else { for(size_t idx = 0; idx < callback_tracing_info.size(); ++idx) diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys-user/rocprofiler-systems/categories.h b/projects/rocprofiler-systems/source/lib/rocprof-sys-user/rocprofiler-systems/categories.h index bba92e8338..bc14cb2b15 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys-user/rocprofiler-systems/categories.h +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys-user/rocprofiler-systems/categories.h @@ -52,12 +52,13 @@ extern "C" ROCPROFSYS_CATEGORY_ROCM_PAGE_MIGRATION, ROCPROFSYS_CATEGORY_ROCM_COUNTER_COLLECTION, ROCPROFSYS_CATEGORY_ROCM_MARKER_API, + ROCPROFSYS_CATEGORY_ROCM_ROCDECODE_API, + ROCPROFSYS_CATEGORY_ROCM_ROCJPEG_API, ROCPROFSYS_CATEGORY_ROCM_SMI, ROCPROFSYS_CATEGORY_ROCM_SMI_BUSY, ROCPROFSYS_CATEGORY_ROCM_SMI_TEMP, ROCPROFSYS_CATEGORY_ROCM_SMI_POWER, ROCPROFSYS_CATEGORY_ROCM_SMI_MEMORY_USAGE, - ROCPROFSYS_CATEGORY_ROCM_ROCDECODE_API, ROCPROFSYS_CATEGORY_ROCM_SMI_VCN_ACTIVITY, ROCPROFSYS_CATEGORY_ROCM_SMI_JPEG_ACTIVITY, ROCPROFSYS_CATEGORY_ROCM_RCCL, diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/rocprofiler-sdk.cpp b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/rocprofiler-sdk.cpp index 797e3ac66a..e7cd5da60f 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/rocprofiler-sdk.cpp +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/rocprofiler-sdk.cpp @@ -497,7 +497,7 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record, user_data, ts); break; } -#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \ +#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 7) || \ ROCPROFILER_VERSION_MAJOR >= 1 case ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API: { @@ -505,6 +505,12 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record, user_data, ts); break; } + case ROCPROFILER_CALLBACK_TRACING_ROCJPEG_API: + { + tool_tracing_callback_start(category::rocm_rocjpeg_api{}, record, + user_data, ts); + break; + } #endif case ROCPROFILER_CALLBACK_TRACING_NONE: case ROCPROFILER_CALLBACK_TRACING_LAST: @@ -576,7 +582,7 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record, ts, _bt_data); break; } -#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \ +#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 7) || \ ROCPROFILER_VERSION_MAJOR >= 1 case ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API: { @@ -584,6 +590,12 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record, user_data, ts, _bt_data); break; } + case ROCPROFILER_CALLBACK_TRACING_ROCJPEG_API: + { + tool_tracing_callback_stop(category::rocm_rocjpeg_api{}, record, + user_data, ts, _bt_data); + break; + } #endif case ROCPROFILER_CALLBACK_TRACING_NONE: case ROCPROFILER_CALLBACK_TRACING_LAST: @@ -1016,9 +1028,10 @@ tool_init(rocprofiler_client_finalize_t fini_func, void* user_data) ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API, ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API, ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API, -#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \ +#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 7) || \ ROCPROFILER_VERSION_MAJOR >= 1 ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API, + ROCPROFILER_CALLBACK_TRACING_ROCJPEG_API, #endif ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API }) diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-decode-tests.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-decode-tests.cmake index 3945ce22bf..96cd874199 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-decode-tests.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-decode-tests.cmake @@ -4,10 +4,15 @@ # # -------------------------------------------------------------------------------------- # -set(_decode_environment +set(_video_decode_environment "${_base_environment}" "ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch,memory_copy,rocdecode_api" - "ROCPROFSYS_ROCM_SMI_METRICS=busy,temp,power,vcn_activity,jpeg_activity,mem_usage" + "ROCPROFSYS_ROCM_SMI_METRICS=busy,temp,power,vcn_activity,mem_usage" + "ROCPROFSYS_SAMPLING_CPUS=none") +set(_jpeg_decode_environment + "${_base_environment}" + "ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch,memory_copy,rocjpeg_api" + "ROCPROFSYS_ROCM_SMI_METRICS=busy,temp,power,jpeg_activity,mem_usage" "ROCPROFSYS_SAMPLING_CPUS=none") rocprofiler_systems_add_test( @@ -15,7 +20,7 @@ rocprofiler_systems_add_test( NAME video-decode TARGET videodecode GPU ON - ENVIRONMENT "${_decode_environment}" + ENVIRONMENT "${_video_decode_environment}" RUN_ARGS -i ${PROJECT_BINARY_DIR}/videos -t 1 LABELS "decode") @@ -24,26 +29,42 @@ rocprofiler_systems_add_validation_test( PERFETTO_METRIC "rocm_rocdecode_api" PERFETTO_FILE "perfetto-trace.proto" LABELS "decode" - ARGS -l rocDecCreateVideoParser -c 2 -d 1 --counter-names "VCN Activity") + ARGS -l + rocDecCreateVideoParser + -c + 2 + -d + 1 + --counter-names + "VCN Activity" + -p) # -------------------------------------------------------------------------------------- # # -# image decode tests +# jpeg decode tests # # -------------------------------------------------------------------------------------- # rocprofiler_systems_add_test( SKIP_BASELINE SKIP_RUNTIME SKIP_REWRITE - NAME image-decode + NAME jpeg-decode TARGET jpegdecode GPU ON - ENVIRONMENT "${_decode_environment}" + ENVIRONMENT "${_jpeg_decode_environment}" RUN_ARGS -i ${PROJECT_BINARY_DIR}/images -b 32 LABELS "decode") rocprofiler_systems_add_validation_test( - NAME image-decode-sampling - PERFETTO_METRIC "host" + NAME jpeg-decode-sampling + PERFETTO_METRIC "rocm_rocjpeg_api" PERFETTO_FILE "perfetto-trace.proto" LABELS "decode" - ARGS -l jpegdecode -c 1 -d 0 --counter-names "JPEG Activity") + ARGS -l + rocJpegCreate + -c + 1 + -d + 1 + --counter-names + "JPEG Activity" + -p) diff --git a/projects/rocprofiler-systems/tests/validate-perfetto-proto.py b/projects/rocprofiler-systems/tests/validate-perfetto-proto.py index 4a173c9890..191d52ef1c 100755 --- a/projects/rocprofiler-systems/tests/validate-perfetto-proto.py +++ b/projects/rocprofiler-systems/tests/validate-perfetto-proto.py @@ -191,6 +191,8 @@ if __name__ == "__main__": total_value = 0 for row in sum_counter_values: total_value = row.total_value if row.total_value is not None else -1 + if args.print: + print(f"Total value of {counter_name} is {total_value}") if total_value <= 0: ret = 1