Bumping tracy version and fixing API usage. (#3328)
diff --git a/SUBMODULE_VERSIONS b/SUBMODULE_VERSIONS
index c8b0e73..c30d5f6 100644
--- a/SUBMODULE_VERSIONS
+++ b/SUBMODULE_VERSIONS
@@ -15,6 +15,6 @@
f8bf11a0253a32375c32cad92c841237b96696c0 third_party/spirv_headers
57eb48aed36160c4876bc8310d9ca84d42ee9e2a third_party/swiftshader
7ea86e9de8a5b6426e7291e0e5477ddaee83ba88 third_party/tensorflow
-864d86e8b6d21449474db5e9313dbff90aa9c24f third_party/tracy
+a9a09ab0940408898fccfdcfe2bb8dc19b50f13c third_party/tracy
9bd3f561bcee3f01d22912de10bb07ce4e23d378 third_party/vulkan_headers
909f36b714c9239ee0b112a321220213a474ba53 third_party/vulkan_memory_allocator
diff --git a/iree/base/tracing.cc b/iree/base/tracing.cc
index 7049d39..15301ad 100644
--- a/iree/base/tracing.cc
+++ b/iree/base/tracing.cc
@@ -68,12 +68,13 @@
TracyLfqCommitC;
}
#endif // TRACY_NO_VERIFY
- auto name_ptr =
- reinterpret_cast<char*>(tracy::tracy_malloc(name_length + 1));
+ auto name_ptr = reinterpret_cast<char*>(tracy::tracy_malloc(name_length));
memcpy(name_ptr, name, name_length);
- name_ptr[name_length] = '\0';
TracyLfqPrepareC(tracy::QueueType::ZoneName);
- tracy::MemWrite(&item->zoneText.text, reinterpret_cast<uint64_t>(name_ptr));
+ tracy::MemWrite(&item->zoneTextFat.text,
+ reinterpret_cast<uint64_t>(name_ptr));
+ tracy::MemWrite(&item->zoneTextFat.size,
+ static_cast<uint64_t>(name_length));
TracyLfqCommitC;
}
@@ -84,22 +85,9 @@
const char* file_name, size_t file_name_length, uint32_t line,
const char* function_name, size_t function_name_length, const char* name,
size_t name_length) {
- // NOTE: cloned from tracy::Profiler::AllocSourceLocation so that we can use
- // the string lengths we already have.
- const uint32_t src_loc_length =
- static_cast<uint32_t>(4 + 4 + 4 + function_name_length + 1 +
- file_name_length + 1 + name_length);
- auto ptr = reinterpret_cast<char*>(tracy::tracy_malloc(src_loc_length));
- memcpy(ptr, &src_loc_length, 4);
- memset(ptr + 4, 0, 4);
- memcpy(ptr + 8, &line, 4);
- memcpy(ptr + 12, function_name, function_name_length + 1);
- memcpy(ptr + 12 + function_name_length + 1, file_name, file_name_length + 1);
- if (name_length) {
- memcpy(ptr + 12 + function_name_length + 1 + file_name_length + 1, name,
- name_length);
- }
- uint64_t src_loc = reinterpret_cast<uint64_t>(ptr);
+ uint64_t src_loc = tracy::Profiler::AllocSourceLocation(
+ line, file_name, file_name_length, function_name, function_name_length,
+ name, name_length);
const iree_zone_id_t zone_id = tracy::GetProfiler().GetNextZoneId();
@@ -152,3 +140,19 @@
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
+
+#if defined(__cplusplus) && \
+ (IREE_TRACING_FEATURES & IREE_TRACING_FEATURE_ALLOCATION_TRACKING)
+
+void* operator new(size_t count) noexcept {
+ auto ptr = malloc(count);
+ IREE_TRACE_ALLOC(ptr, count);
+ return ptr;
+}
+
+void operator delete(void* ptr) noexcept {
+ IREE_TRACE_FREE(ptr);
+ free(ptr);
+}
+
+#endif // __cplusplus && IREE_TRACING_FEATURE_ALLOCATION_TRACKING
diff --git a/iree/base/tracing.h b/iree/base/tracing.h
index 03de9b6..d8026a9 100644
--- a/iree/base/tracing.h
+++ b/iree/base/tracing.h
@@ -355,14 +355,14 @@
#define IREE_TRACE_ALLOC(ptr, size) \
___tracy_emit_memory_alloc_callstack(ptr, size, \
- IREE_TRACING_MAX_CALLSTACK_DEPTH)
+ IREE_TRACING_MAX_CALLSTACK_DEPTH, 0)
#define IREE_TRACE_FREE(ptr) \
- ___tracy_emit_memory_free_callstack(ptr, IREE_TRACING_MAX_CALLSTACK_DEPTH)
+ ___tracy_emit_memory_free_callstack(ptr, IREE_TRACING_MAX_CALLSTACK_DEPTH, 0)
#else
-#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(ptr, size) ___tracy_emit_memory_alloc(ptr, size, 0)
+#define IREE_TRACE_FREE(ptr) ___tracy_emit_memory_free(ptr, 0)
#endif // IREE_TRACING_FEATURE_ALLOCATION_CALLSTACKS
@@ -371,24 +371,11 @@
#define IREE_TRACE_FREE(ptr)
#endif // IREE_TRACING_FEATURE_ALLOCATION_TRACKING
-#ifdef __cplusplus
-
-#if IREE_TRACING_FEATURES & IREE_TRACING_FEATURE_ALLOCATION_TRACKING
-
-inline void* operator new(size_t count) {
- auto ptr = malloc(count);
- IREE_TRACE_ALLOC(ptr, count);
- return ptr;
-}
-
-inline void operator delete(void* ptr) noexcept {
- IREE_TRACE_FREE(ptr);
- free(ptr);
-}
-
-#endif // IREE_TRACING_FEATURE_ALLOCATION_TRACKING
-
-#endif // __cplusplus
+#if defined(__cplusplus) && \
+ (IREE_TRACING_FEATURES & IREE_TRACING_FEATURE_ALLOCATION_TRACKING)
+void* operator new(size_t count) noexcept;
+void operator delete(void* ptr) noexcept;
+#endif // __cplusplus && IREE_TRACING_FEATURE_ALLOCATION_TRACKING
//===----------------------------------------------------------------------===//
// Instrumentation C++ RAII types, wrappers, and macros
diff --git a/third_party/tracy b/third_party/tracy
index 864d86e..a9a09ab 160000
--- a/third_party/tracy
+++ b/third_party/tracy
@@ -1 +1 @@
-Subproject commit 864d86e8b6d21449474db5e9313dbff90aa9c24f
+Subproject commit a9a09ab0940408898fccfdcfe2bb8dc19b50f13c