[Tracy] Bump Tracy to 0.15 (#25241) Bumps Tracy from wolfpld/tracy@5479a42 (a post-v0.11.1 dev snapshot) to [v0.15.0](https://github.com/wolfpld/tracy/releases/tag/v0.15.0) (wolfpld/tracy@f2a4f25). Upstream changelog: [NEWS](https://github.com/wolfpld/tracy/blob/v0.15.0/NEWS). Notable Tracy changes: - Tracy now also Ships Prebuilt binaries for Linux and Mac (relates to #19841) - Loading traces from a URL in the web viewer (relates to #11957) - Sections and a C API for them (relates to #16051) - Messages: severity levels and filtering in the GUI - Bugfixes, e.g. we encountered some use-after-free on Android Changes apart from the actual bump: - Message severities: IREE_TRACE_MESSAGE levels now map to Tracy severities.Colors are unchanged. - Lock events: the release is now recorded before the unlock (iree_tracing_mutex_after_unlock → iree_tracing_mutex_before_unlock), matching upstream. prevents anohter Thread's lock being recorded before an unlock. - TracyClient CMake target: IREE sets TRACY_ENABLE ON, because Tracy now defaults it to OFF. Otherwise the exported target is empty for anything linking it. - No system zstd needed for iree-tracy-capture: it's built from source, and the libzstd-devel installs in the packaging scripts are gone. - Capture-tool dependencies: capstone moves to 6.0.0-Alpha11 and PPQSort to 1.0.6, with upstream's patches. Closes #21371 Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Stefan Schuermans <schuermans@roofline.ai>
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fee285..d0969cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -1015,6 +1015,9 @@ IREE_TRACING_PROVIDER STREQUAL "tracy") message(STATUS "Configuring third_party/tracy") list(APPEND CMAKE_MESSAGE_INDENT " ") + # Tracy >= 0.14 defaults TRACY_ENABLE to OFF. Keep it on so the exported + # TracyClient target is functional and propagates TRACY_ENABLE to consumers. + set(TRACY_ENABLE ON) add_subdirectory(third_party/tracy EXCLUDE_FROM_ALL) list(POP_BACK CMAKE_MESSAGE_INDENT) iree_install_targets(
diff --git a/build_tools/pkgci/build_linux_packages.sh b/build_tools/pkgci/build_linux_packages.sh index ee60221..b62305f 100755 --- a/build_tools/pkgci/build_linux_packages.sh +++ b/build_tools/pkgci/build_linux_packages.sh
@@ -240,8 +240,6 @@ echo "The architecture is aarch64 and we use manylinux 2_28 so install deps" yum install -y epel-release yum update -y - # Required for Tracy - yum install -y libzstd-devel yum install -y clang lld elif [[ "$uname_m" == "x86_64" ]]; then echo "The architecture is x86_64 so assume we are on a managed image with deps"
diff --git a/build_tools/python_deploy/build_linux_packages.sh b/build_tools/python_deploy/build_linux_packages.sh index ec7b7d5..4baa8a3 100755 --- a/build_tools/python_deploy/build_linux_packages.sh +++ b/build_tools/python_deploy/build_linux_packages.sh
@@ -222,8 +222,6 @@ echo "The architecture is aarch64 and we use manylinux 2_28 so install deps" yum install -y epel-release yum update -y - # Required for Tracy - yum install -y libzstd-devel yum install -y clang-20.1.8-2.module_el8.10.0+4062+b20d4441 lld-20.1.8-2.module_el8.10.0+4062+b20d4441 elif [[ "$uname_m" == "x86_64" ]]; then echo "The architecture is x86_64 so assume we are on a managed image with deps"
diff --git a/build_tools/third_party/tracy/CMakeLists.txt b/build_tools/third_party/tracy/CMakeLists.txt index 61b7a81..922c312 100644 --- a/build_tools/third_party/tracy/CMakeLists.txt +++ b/build_tools/third_party/tracy/CMakeLists.txt
@@ -11,33 +11,7 @@ set(TRACY_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../third_party/tracy") find_package(Threads REQUIRED) - -#------------------------------------------------------------------------------- -# Detect package manager -#------------------------------------------------------------------------------- - -message(STATUS "Checking for Tracy dependencies...") -find_program(PKGCONFIG pkg-config) -if(NOT PKGCONFIG) - message(STATUS "Could not find pkg-config to get dependencies; you need to specify them manually or use pkg-config") - message(STATUS " Ubuntu/Debian: `apt install pkg-config`") - message(STATUS " MacOS: `brew install pkg-config`") -else() - include(FindPkgConfig) - - # Deps slightly differ by platform but some are common. - pkg_check_modules(TRACY_DEPS - libzstd - ) - - if(NOT TRACY_DEPS_FOUND) - message(STATUS "Could not find Tracy dependencies (Tracy server will not be built).") - message(STATUS "To build Tracy, install libzstd:") - message(STATUS " Ubuntu/Debian: `apt install libzstd-dev`") - message(STATUS " MacOS: `brew install zstd`") - return() - endif() -endif() +find_package(Git QUIET) #------------------------------------------------------------------------------- # Source dependencies @@ -49,11 +23,12 @@ FetchContent_Declare( capstone GIT_REPOSITORY https://github.com/capstone-engine/capstone.git - GIT_TAG 97db712c91e964718f9cc300e81b9cf76b31a22e # 6.0.0-Alpha1 + GIT_TAG b2bf6327b5c7dc43829130b7ccdb02ef9a65a990 # 6.0.0-Alpha11 EXCLUDE_FROM_ALL ) set(CAPSTONE_X86_ATT_DISABLE ON CACHE BOOL "" FORCE) set(CAPSTONE_ALPHA_SUPPORT OFF CACHE BOOL "" FORCE) +set(CAPSTONE_ARC_SUPPORT OFF CACHE BOOL "" FORCE) set(CAPSTONE_HPPA_SUPPORT OFF CACHE BOOL "" FORCE) set(CAPSTONE_LOONGARCH_SUPPORT OFF CACHE BOOL "" FORCE) set(CAPSTONE_M680X_SUPPORT OFF CACHE BOOL "" FORCE) @@ -66,7 +41,6 @@ set(CAPSTONE_XCORE_SUPPORT OFF CACHE BOOL "" FORCE) set(CAPSTONE_TRICORE_SUPPORT OFF CACHE BOOL "" FORCE) set(CAPSTONE_TMS320C64X_SUPPORT OFF CACHE BOOL "" FORCE) -set(CAPSTONE_M680X_SUPPORT OFF CACHE BOOL "" FORCE) set(CAPSTONE_EVM_SUPPORT OFF CACHE BOOL "" FORCE) set(CAPSTONE_WASM_SUPPORT OFF CACHE BOOL "" FORCE) set(CAPSTONE_BPF_SUPPORT OFF CACHE BOOL "" FORCE) @@ -77,9 +51,29 @@ FetchContent_MakeAvailable(capstone) FetchContent_Declare( + zstd + GIT_REPOSITORY https://github.com/facebook/zstd.git + GIT_TAG f8745da6ff1ad1e7bab384bd1f9d742439278e99 # v1.5.7 + SOURCE_SUBDIR build/cmake + EXCLUDE_FROM_ALL +) +set(ZSTD_BUILD_SHARED OFF CACHE BOOL "" FORCE) +set(ZSTD_BUILD_PROGRAMS OFF CACHE BOOL "" FORCE) +set(ZSTD_BUILD_TESTS OFF CACHE BOOL "" FORCE) +set(ZSTD_BUILD_CONTRIB OFF CACHE BOOL "" FORCE) +FetchContent_MakeAvailable(zstd) + +# Upstream Tracy carries these patches against PPQSort; one fixes a +# binary_semaphore being released more than once. Upstream applies them with +# fuzz (via CPM), so reduce the required context to match. +FetchContent_Declare( PPQSort GIT_REPOSITORY https://github.com/GabTux/PPQSort.git - GIT_TAG 4b964020d67b435dae7ebac7b8f5ecea1f421c58 # v1.0.3 + GIT_TAG 21c5a20ca3daf572caaf0a8522db32e27e28fa1d # v1.0.6 + PATCH_COMMAND ${GIT_EXECUTABLE} apply -C1 --ignore-whitespace + ${TRACY_SOURCE_DIR}/cmake/ppqsort-nodebug.patch + ${TRACY_SOURCE_DIR}/cmake/ppqsort-semaphore.patch + UPDATE_DISCONNECTED 1 EXCLUDE_FROM_ALL ) FetchContent_MakeAvailable(PPQSort) @@ -99,22 +93,18 @@ ) target_include_directories(${name} PUBLIC - ${TRACY_SOURCE_DIR}/imgui - ${TRACY_DEPS_INCLUDE_DIRS} + ${TRACY_SOURCE_DIR}/public/common + ${TRACY_SOURCE_DIR}/server ${capstone_SOURCE_DIR}/include/capstone ) target_link_libraries(${name} PRIVATE - ${TRACY_DEPS_LIBRARIES} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT} capstone + libzstd PPQSort ) - target_link_directories(${name} - PRIVATE - ${TRACY_DEPS_LIBRARY_DIRS} - ) endfunction() #------------------------------------------------------------------------------- @@ -142,6 +132,51 @@ ) #------------------------------------------------------------------------------- +# Command line tool utilities +#------------------------------------------------------------------------------- + +file(GLOB UTIL_SRCS ${TRACY_SOURCE_DIR}/util/*.cpp) +add_library(IREETracyUtil + ${UTIL_SRCS} +) +setup_cxx_options(IREETracyUtil) +target_include_directories(IREETracyUtil + PUBLIC + ${TRACY_SOURCE_DIR}/util +) +target_link_libraries(IREETracyUtil + PRIVATE + IREETracyServer +) + +add_library(IREETracyGetOpt + ${TRACY_SOURCE_DIR}/getopt/getopt.c +) +target_include_directories(IREETracyGetOpt + PUBLIC + ${TRACY_SOURCE_DIR}/getopt +) + +# The capture tool prints the Tracy git revision it was built from. +set(_TRACY_GIT_REF "unknown") +if(GIT_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} -C ${TRACY_SOURCE_DIR} log -1 --format=%h + OUTPUT_VARIABLE _TRACY_GIT_REF_OUT + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE _TRACY_GIT_REF_RESULT + ERROR_QUIET + ) + if(_TRACY_GIT_REF_RESULT EQUAL 0 AND _TRACY_GIT_REF_OUT) + set(_TRACY_GIT_REF "${_TRACY_GIT_REF_OUT}") + endif() +endif() +file(CONFIGURE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/GitRef.hpp" + CONTENT "#pragma once\nnamespace tracy { static inline const char* GitRef = \"${_TRACY_GIT_REF}\"; }\n" +) + +#------------------------------------------------------------------------------- # Standalone capture server #------------------------------------------------------------------------------- @@ -153,8 +188,14 @@ OUTPUT_NAME "iree-tracy-capture" ) setup_cxx_options(IREETracyCaptureServer) +target_include_directories(IREETracyCaptureServer + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/generated +) target_link_libraries(IREETracyCaptureServer PRIVATE IREETracyCommon IREETracyServer + IREETracyUtil + IREETracyGetOpt )
diff --git a/build_tools/third_party/tracy_client/BUILD.overlay b/build_tools/third_party/tracy_client/BUILD.overlay index dd0c9d2..4bfe273 100644 --- a/build_tools/third_party/tracy_client/BUILD.overlay +++ b/build_tools/third_party/tracy_client/BUILD.overlay
@@ -23,6 +23,9 @@ "public/client/*.h", "public/client/*.hpp", "public/client/*.cpp", + "public/client/apple/*.cpp", + "public/client/windows/*.h", + "public/client/windows/*.cpp", ]), includes = [ "public",
diff --git a/compiler/src/iree/compiler/Utils/TracingUtils.h b/compiler/src/iree/compiler/Utils/TracingUtils.h index c481a39..396fb4e 100644 --- a/compiler/src/iree/compiler/Utils/TracingUtils.h +++ b/compiler/src/iree/compiler/Utils/TracingUtils.h
@@ -47,10 +47,24 @@ // Fork of IREE_TRACE_FRAME_MARK. #define IREE_COMPILER_TRACE_FRAME_MARK() ___tracy_emit_frame_mark(NULL) +// Maps IREE_TRACING_COMPILER_MESSAGE_LEVEL_* to Tracy message severities. +#define IREE_TRACING_COMPILER_MESSAGE_LEVEL_ERROR_SEVERITY \ + TracyMessageSeverityError +#define IREE_TRACING_COMPILER_MESSAGE_LEVEL_WARNING_SEVERITY \ + TracyMessageSeverityWarning +#define IREE_TRACING_COMPILER_MESSAGE_LEVEL_INFO_SEVERITY \ + TracyMessageSeverityInfo +#define IREE_TRACING_COMPILER_MESSAGE_LEVEL_VERBOSE_SEVERITY \ + TracyMessageSeverityTrace +#define IREE_TRACING_COMPILER_MESSAGE_LEVEL_DEBUG_SEVERITY \ + TracyMessageSeverityDebug + // Fork of IREE_TRACE_MESSAGE_DYNAMIC, taking std::string (or llvm::StringRef). #define IREE_COMPILER_TRACE_MESSAGE_DYNAMIC(level, value_string) \ - ___tracy_emit_messageC(value_string.data(), value_string.size(), \ - IREE_TRACING_COMPILER_MESSAGE_LEVEL_##level, 0) + ___tracy_emit_logString( \ + IREE_TRACING_COMPILER_MESSAGE_LEVEL_##level##_SEVERITY, \ + IREE_TRACING_COMPILER_MESSAGE_LEVEL_##level, 0, value_string.size(), \ + value_string.data()) // Adds a pass to |passManager| that marks the beginning of a named frame. // * |frameName| must be a null-terminated string
diff --git a/docs/website/docs/developers/performance/profiling-with-tracy.md b/docs/website/docs/developers/performance/profiling-with-tracy.md index c6e2eee..ecb005d 100644 --- a/docs/website/docs/developers/performance/profiling-with-tracy.md +++ b/docs/website/docs/developers/performance/profiling-with-tracy.md
@@ -85,15 +85,15 @@ You will need three things to capture a trace: -1. The Tracy profiler UI or CLI capture tool +1. The Tracy profiler UI or CLI capture tool [v0.15.0](https://github.com/wolfpld/tracy/releases/tag/v0.15.0) 2. A binary tool to trace, such as `iree-run-module`, built with tracing support enabled 3. A program to profile, e.g. a `.vmfb` file with parameters and input values The Tracy tools can either be downloaded from -[the official releases](https://github.com/wolfpld/tracy/releases) or they can -be built from source by using either the upstream CMake build or IREE's -[downstream CMake build](#building-tracy-from-source). +[the official releases](https://github.com/wolfpld/tracy/releases/tag/v0.15.0) +or they can be built from source by using either the upstream CMake build or +IREE's [downstream CMake build](#building-tracy-from-source). ### :octicons-rocket-16: Quickstart
diff --git a/runtime/src/iree/base/threading/mutex.c b/runtime/src/iree/base/threading/mutex.c index df7fad5..18f6f5d 100644 --- a/runtime/src/iree/base/threading/mutex.c +++ b/runtime/src/iree/base/threading/mutex.c
@@ -99,8 +99,8 @@ } void iree_mutex_unlock(iree_mutex_t* mutex) { + iree_tracing_mutex_before_unlock(mutex->lock_id); iree_mutex_impl_unlock(mutex); - iree_tracing_mutex_after_unlock(mutex->lock_id); } #else
diff --git a/runtime/src/iree/base/tracing/tracy.cc b/runtime/src/iree/base/tracing/tracy.cc index 8535661..06f59e4 100644 --- a/runtime/src/iree/base/tracing/tracy.cc +++ b/runtime/src/iree/base/tracing/tracy.cc
@@ -201,7 +201,7 @@ tracy::MemWrite(&item->zoneTextFat.text, reinterpret_cast<uint64_t>(name_ptr)); tracy::MemWrite(&item->zoneTextFat.size, - static_cast<uint64_t>(name_length)); + static_cast<uint16_t>(name_length)); TracyQueueCommitC(zoneTextFatThread); } @@ -317,7 +317,7 @@ } } -void iree_tracing_mutex_after_unlock(uint32_t lock_id) { +void iree_tracing_mutex_before_unlock(uint32_t lock_id) { auto item = tracy::Profiler::QueueSerial(); tracy::MemWrite(&item->hdr.type, tracy::QueueType::LockRelease); tracy::MemWrite(&item->lockReleaseShared.thread, tracy::GetThreadHandle()); @@ -347,18 +347,20 @@ context_id %= 255; } - uint8_t context_flags = 0; + tracy::GpuContextFlags context_flags = tracy::GpuContextNone; if (is_calibrated) { // Tell tracy we'll be passing calibrated timestamps and not to mess with // the times. We'll periodically send GpuCalibration events in case the // times drift. - context_flags |= tracy::GpuContextCalibration; + context_flags = tracy::GpuContextCalibration; } { auto* item = tracy::Profiler::QueueSerial(); tracy::MemWrite(&item->hdr.type, tracy::QueueType::GpuNewContext); - tracy::MemWrite(&item->gpuNewContext.cpuTime, cpu_timestamp); - tracy::MemWrite(&item->gpuNewContext.gpuTime, gpu_timestamp); + tracy::MemWrite(&item->gpuNewContext.cpuTime, + static_cast<int64_t>(cpu_timestamp)); + tracy::MemWrite(&item->gpuNewContext.gpuTime, + static_cast<int64_t>(gpu_timestamp)); memset(&item->gpuNewContext.thread, 0, sizeof(item->gpuNewContext.thread)); tracy::MemWrite(&item->gpuNewContext.period, timestamp_period); tracy::MemWrite(&item->gpuNewContext.context, context_id); @@ -378,7 +380,8 @@ tracy::MemWrite(&item->hdr.type, tracy::QueueType::GpuContextName); tracy::MemWrite(&item->gpuContextNameFat.context, context_id); tracy::MemWrite(&item->gpuContextNameFat.ptr, (uint64_t)cloned_name); - tracy::MemWrite(&item->gpuContextNameFat.size, name_length); + tracy::MemWrite(&item->gpuContextNameFat.size, + static_cast<uint16_t>(name_length)); tracy::Profiler::QueueSerialFinish(); } @@ -508,8 +511,8 @@ iree_tracing_context_t* context, iree_tracing_executor_id_t executor_id, int64_t cpu_delta, uint64_t host_timestamp, uint64_t executor_timestamp) { IREE_TRACING_CONTEXT_BEGIN_WRITE(context, tracy::QueueType::GpuCalibration); - tracy::MemWrite(&item->gpuCalibration.gpuTime, executor_timestamp); - tracy::MemWrite(&item->gpuCalibration.cpuTime, host_timestamp); + tracy::MemWrite(&item->gpuCalibration.gpuTime, (int64_t)executor_timestamp); + tracy::MemWrite(&item->gpuCalibration.cpuTime, (int64_t)host_timestamp); tracy::MemWrite(&item->gpuCalibration.cpuDelta, cpu_delta); tracy::MemWrite(&item->gpuCalibration.context, executor_id); IREE_TRACING_CONTEXT_END_WRITE(context); @@ -519,7 +522,7 @@ uint64_t timestamp, const iree_tracing_location_t* src_loc) { IREE_TRACING_CONTEXT_BEGIN_WRITE(context, tracy::QueueType::ZoneBegin); - tracy::MemWrite(&item->zoneBegin.time, timestamp); + tracy::MemWrite(&item->zoneBegin.time, (int64_t)timestamp); tracy::MemWrite(&item->zoneBegin.srcloc, reinterpret_cast<uint64_t>(src_loc)); IREE_TRACING_CONTEXT_END_WRITE(context); } @@ -527,7 +530,7 @@ void iree_tracing_context_zone_end(iree_tracing_context_t* context, uint64_t timestamp) { IREE_TRACING_CONTEXT_BEGIN_WRITE(context, tracy::QueueType::ZoneEnd); - tracy::MemWrite(&item->zoneEnd.time, timestamp); + tracy::MemWrite(&item->zoneEnd.time, (int64_t)timestamp); IREE_TRACING_CONTEXT_END_WRITE(context); } @@ -566,19 +569,19 @@ #if IREE_TRACING_CONTEXT_SERIAL_FALLBACK auto* item = tracy::Profiler::QueueSerial(); tracy::MemWrite(&item->hdr.type, tracy::QueueType::GpuZoneBeginSerial); - tracy::MemWrite(&item->gpuZoneBegin.cpuTime, timestamp); - tracy::MemWrite(&item->gpuZoneBegin.srcloc, src_loc); + tracy::MemWrite(&item->gpuZoneBegin.cpuTime, (int64_t)timestamp); + tracy::MemWrite(&item->gpuZoneBegin.srcloc, (uint64_t)src_loc); tracy::MemWrite(&item->gpuZoneBegin.thread, context->thread_id); tracy::MemWrite(&item->gpuZoneBegin.queryId, query_id); tracy::MemWrite(&item->gpuZoneBegin.context, executor_id); tracy::Profiler::QueueSerialFinish(); #else IREE_TRACING_CONTEXT_BEGIN_WRITE(context, tracy::QueueType::GpuZoneBegin); - tracy::MemWrite(&item->gpuZoneBegin.cpuTime, timestamp); + tracy::MemWrite(&item->gpuZoneBegin.cpuTime, (int64_t)timestamp); tracy::MemWrite(&item->gpuZoneBegin.thread, context->thread_id); tracy::MemWrite(&item->gpuZoneBegin.queryId, query_id); tracy::MemWrite(&item->gpuZoneBegin.context, executor_id); - tracy::MemWrite(&item->gpuZoneBegin.srcloc, src_loc); + tracy::MemWrite(&item->gpuZoneBegin.srcloc, (uint64_t)src_loc); IREE_TRACING_CONTEXT_END_WRITE(context); #endif // IREE_TRACING_CONTEXT_SERIAL_FALLBACK } @@ -589,14 +592,14 @@ #if IREE_TRACING_CONTEXT_SERIAL_FALLBACK auto* item = tracy::Profiler::QueueSerial(); tracy::MemWrite(&item->hdr.type, tracy::QueueType::GpuZoneEndSerial); - tracy::MemWrite(&item->gpuZoneEnd.cpuTime, timestamp); + tracy::MemWrite(&item->gpuZoneEnd.cpuTime, (int64_t)timestamp); tracy::MemWrite(&item->gpuZoneEnd.thread, context->thread_id); tracy::MemWrite(&item->gpuZoneEnd.queryId, query_id); tracy::MemWrite(&item->gpuZoneEnd.context, executor_id); tracy::Profiler::QueueSerialFinish(); #else IREE_TRACING_CONTEXT_BEGIN_WRITE(context, tracy::QueueType::GpuZoneEnd); - tracy::MemWrite(&item->gpuZoneEnd.cpuTime, timestamp); + tracy::MemWrite(&item->gpuZoneEnd.cpuTime, (int64_t)timestamp); tracy::MemWrite(&item->gpuZoneEnd.thread, context->thread_id); tracy::MemWrite(&item->gpuZoneEnd.queryId, query_id); tracy::MemWrite(&item->gpuZoneEnd.context, executor_id); @@ -611,13 +614,13 @@ iree_tracing_gpu_zone_notify(executor_id, query_id, query_timestamp); auto* item = tracy::Profiler::QueueSerial(); tracy::MemWrite(&item->hdr.type, tracy::QueueType::GpuTime); - tracy::MemWrite(&item->gpuTime.gpuTime, query_timestamp); + tracy::MemWrite(&item->gpuTime.gpuTime, (int64_t)query_timestamp); tracy::MemWrite(&item->gpuTime.queryId, query_id); tracy::MemWrite(&item->gpuTime.context, executor_id); tracy::Profiler::QueueSerialFinish(); #else IREE_TRACING_CONTEXT_BEGIN_WRITE(context, tracy::QueueType::GpuTime); - tracy::MemWrite(&item->gpuTime.gpuTime, query_timestamp); + tracy::MemWrite(&item->gpuTime.gpuTime, (int64_t)query_timestamp); tracy::MemWrite(&item->gpuTime.queryId, query_id); tracy::MemWrite(&item->gpuTime.context, executor_id); IREE_TRACING_CONTEXT_END_WRITE(context); @@ -644,8 +647,12 @@ uint64_t timestamp, const char* value) { IREE_TRACING_CONTEXT_BEGIN_WRITE(context, tracy::QueueType::MessageLiteral); - tracy::MemWrite(&item->messageLiteral.time, timestamp); - tracy::MemWrite(&item->messageLiteral.text, (uint64_t)value); + tracy::MemWrite(&item->messageLiteral.time, (int64_t)timestamp); + tracy::MemWrite(&item->messageLiteral.textAndMetadata, + tracy::TaggedUserlandAddress( + (uint64_t)value, tracy::MakeMessageMetadata( + tracy::MessageSourceType::User, + tracy::MessageSeverity::Info))); IREE_TRACING_CONTEXT_END_WRITE(context); } @@ -655,8 +662,12 @@ auto ptr = (char*)tracy::tracy_malloc(value_length); memcpy(ptr, value, value_length); IREE_TRACING_CONTEXT_BEGIN_WRITE(context, tracy::QueueType::Message); - tracy::MemWrite(&item->messageFat.time, timestamp); - tracy::MemWrite(&item->messageFat.text, (uint64_t)ptr); + tracy::MemWrite(&item->messageFat.time, (int64_t)timestamp); + tracy::MemWrite(&item->messageFat.textAndMetadata, + tracy::TaggedUserlandAddress( + (uint64_t)ptr, tracy::MakeMessageMetadata( + tracy::MessageSourceType::User, + tracy::MessageSeverity::Info))); tracy::MemWrite(&item->messageFat.size, (uint16_t)value_length); IREE_TRACING_CONTEXT_END_WRITE(context); } @@ -678,7 +689,7 @@ const char* plot_name, int64_t value) { IREE_TRACING_CONTEXT_BEGIN_WRITE(context, tracy::QueueType::PlotDataInt); tracy::MemWrite(&item->plotDataInt.name, (uint64_t)plot_name); - tracy::MemWrite(&item->plotDataInt.time, timestamp); + tracy::MemWrite(&item->plotDataInt.time, (int64_t)timestamp); tracy::MemWrite(&item->plotDataInt.val, value); IREE_TRACING_CONTEXT_END_WRITE(context); }
diff --git a/runtime/src/iree/base/tracing/tracy.h b/runtime/src/iree/base/tracing/tracy.h index 2635cc9..155783a 100644 --- a/runtime/src/iree/base/tracing/tracy.h +++ b/runtime/src/iree/base/tracing/tracy.h
@@ -147,7 +147,7 @@ void iree_tracing_mutex_before_lock(uint32_t lock_id); void iree_tracing_mutex_after_lock(uint32_t lock_id); void iree_tracing_mutex_after_try_lock(uint32_t lock_id, bool was_acquired); -void iree_tracing_mutex_after_unlock(uint32_t lock_id); +void iree_tracing_mutex_before_unlock(uint32_t lock_id); #if IREE_TRACING_FEATURES & IREE_TRACING_FEATURE_INSTRUMENTATION_DEVICE @@ -280,15 +280,26 @@ #define IREE_TRACE_FRAME_MARK_END_NAMED(name_literal) \ ___tracy_emit_frame_mark_end(name_literal) -#define IREE_TRACE_MESSAGE(level, value_literal) \ - ___tracy_emit_messageLC(value_literal, IREE_TRACING_MESSAGE_LEVEL_##level, 0) +// Maps IREE_TRACING_MESSAGE_LEVEL_* to Tracy message severities. +#define IREE_TRACING_MESSAGE_LEVEL_ERROR_SEVERITY TracyMessageSeverityError +#define IREE_TRACING_MESSAGE_LEVEL_WARNING_SEVERITY TracyMessageSeverityWarning +#define IREE_TRACING_MESSAGE_LEVEL_INFO_SEVERITY TracyMessageSeverityInfo +#define IREE_TRACING_MESSAGE_LEVEL_VERBOSE_SEVERITY TracyMessageSeverityTrace +#define IREE_TRACING_MESSAGE_LEVEL_DEBUG_SEVERITY TracyMessageSeverityDebug + +#define IREE_TRACE_MESSAGE(level, value_literal) \ + ___tracy_emit_logStringL(IREE_TRACING_MESSAGE_LEVEL_##level##_SEVERITY, \ + IREE_TRACING_MESSAGE_LEVEL_##level, 0, \ + value_literal) #define IREE_TRACE_MESSAGE_COLORED(color, value_literal) \ - ___tracy_emit_messageLC(value_literal, color, 0) -#define IREE_TRACE_MESSAGE_DYNAMIC(level, value, value_length) \ - ___tracy_emit_messageC(value, value_length, \ - IREE_TRACING_MESSAGE_LEVEL_##level, 0) -#define IREE_TRACE_MESSAGE_DYNAMIC_COLORED(color, value, value_length) \ - ___tracy_emit_messageC(value, value_length, color, 0) + ___tracy_emit_logStringL(TracyMessageSeverityInfo, color, 0, value_literal) +#define IREE_TRACE_MESSAGE_DYNAMIC(level, value, value_length) \ + ___tracy_emit_logString(IREE_TRACING_MESSAGE_LEVEL_##level##_SEVERITY, \ + IREE_TRACING_MESSAGE_LEVEL_##level, 0, value_length, \ + value) +#define IREE_TRACE_MESSAGE_DYNAMIC_COLORED(color, value, value_length) \ + ___tracy_emit_logString(TracyMessageSeverityInfo, color, 0, value_length, \ + value) // Utilities: #define IREE_TRACE_IMPL_GET_VARIADIC_HELPER_(_1, _2, _3, NAME, ...) NAME @@ -307,24 +318,24 @@ #define IREE_TRACE_ALLOC(ptr, size) \ ___tracy_emit_memory_alloc_callstack(ptr, size, \ - IREE_TRACING_MAX_CALLSTACK_DEPTH, 0) + IREE_TRACING_MAX_CALLSTACK_DEPTH) #define IREE_TRACE_FREE(ptr) \ - ___tracy_emit_memory_free_callstack(ptr, IREE_TRACING_MAX_CALLSTACK_DEPTH, 0) + ___tracy_emit_memory_free_callstack(ptr, IREE_TRACING_MAX_CALLSTACK_DEPTH) #define IREE_TRACE_ALLOC_NAMED(name, ptr, size) \ ___tracy_emit_memory_alloc_callstack_named( \ - ptr, size, IREE_TRACING_MAX_CALLSTACK_DEPTH, 0, name) + ptr, size, IREE_TRACING_MAX_CALLSTACK_DEPTH, name) #define IREE_TRACE_FREE_NAMED(name, ptr) \ ___tracy_emit_memory_free_callstack_named( \ - ptr, IREE_TRACING_MAX_CALLSTACK_DEPTH, 0, name) + ptr, IREE_TRACING_MAX_CALLSTACK_DEPTH, name) #else -#define IREE_TRACE_ALLOC(ptr, size) ___tracy_emit_memory_alloc(ptr, size, 0) -#define IREE_TRACE_FREE(ptr) ___tracy_emit_memory_free(ptr, 0) +#define IREE_TRACE_ALLOC(ptr, size) ___tracy_emit_memory_alloc(ptr, size) +#define IREE_TRACE_FREE(ptr) ___tracy_emit_memory_free(ptr) #define IREE_TRACE_ALLOC_NAMED(name_literal, ptr, size) \ - ___tracy_emit_memory_alloc_named(ptr, size, 0, name_literal) + ___tracy_emit_memory_alloc_named(ptr, size, name_literal) #define IREE_TRACE_FREE_NAMED(name_literal, ptr) \ - ___tracy_emit_memory_free_named(ptr, 0, name_literal) + ___tracy_emit_memory_free_named(ptr, name_literal) #endif // IREE_TRACING_FEATURE_ALLOCATION_CALLSTACKS
diff --git a/third_party/tracy b/third_party/tracy index 5479a42..f2a4f25 160000 --- a/third_party/tracy +++ b/third_party/tracy
@@ -1 +1 @@ -Subproject commit 5479a42ef9346b64e6d1b860ae58aa8abdb0c7f6 +Subproject commit f2a4f2529e7e71844c9e434b877770a21ecf7587