aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2024-12-02 12:21:53 +0100
committerGitHub Enterprise <[email protected]>2024-12-02 12:21:53 +0100
commite6f44577f469e891ed8dab1492a4c53224e0b765 (patch)
tree47334606ce62fb6bf1975cdc09276ced335599f4 /src/zencore/include
parent5.5.15-pre0 (diff)
downloadzen-e6f44577f469e891ed8dab1492a4c53224e0b765.tar.xz
zen-e6f44577f469e891ed8dab1492a4c53224e0b765.zip
added support for dynamic LLM tags (#245)
* added FLLMTag which can be used to register memory tags outside of core * changed `UE_MEMSCOPE` -> `ZEN_MEMSCOPE` for consistency * instrumented some subsystems with dynamic tags
Diffstat (limited to 'src/zencore/include')
-rw-r--r--src/zencore/include/zencore/memory/llm.h16
-rw-r--r--src/zencore/include/zencore/memory/tagtrace.h19
2 files changed, 26 insertions, 9 deletions
diff --git a/src/zencore/include/zencore/memory/llm.h b/src/zencore/include/zencore/memory/llm.h
index 4f1c9de77..ea7f68cc6 100644
--- a/src/zencore/include/zencore/memory/llm.h
+++ b/src/zencore/include/zencore/memory/llm.h
@@ -28,4 +28,20 @@ enum class ELLMTag : uint8_t
GenericTagCount
};
+struct FLLMTag
+{
+public:
+ FLLMTag(const char* TagName);
+ FLLMTag(const char* TagName, const FLLMTag& ParentTag);
+
+ inline int32_t GetTag() const { return m_Tag; }
+ inline int32_t GetParentTag() const { return m_ParentTag; }
+
+private:
+ int32_t m_Tag = -1;
+ int32_t m_ParentTag = -1;
+
+ void AssignAndAnnounceNewTag(const char* TagName);
+};
+
} // namespace zen
diff --git a/src/zencore/include/zencore/memory/tagtrace.h b/src/zencore/include/zencore/memory/tagtrace.h
index f51b21466..8b5fc0e67 100644
--- a/src/zencore/include/zencore/memory/tagtrace.h
+++ b/src/zencore/include/zencore/memory/tagtrace.h
@@ -9,6 +9,7 @@
namespace zen {
enum class ELLMTag : uint8_t;
+struct FLLMTag;
int32_t MemoryTrace_AnnounceCustomTag(int32_t Tag, int32_t ParentTag, const char* Display);
int32_t MemoryTrace_GetActiveTag();
@@ -42,6 +43,7 @@ class FMemScope
public:
FMemScope(); // Used with SetTagAndActivate
FMemScope(int32_t InTag, bool bShouldActivate = true);
+ FMemScope(FLLMTag InTag, bool bShouldActivate = true);
FMemScope(ELLMTag InTag, bool bShouldActivate = true);
~FMemScope();
@@ -75,19 +77,18 @@ private:
};
////////////////////////////////////////////////////////////////////////////////
-# define UE_MEMSCOPE(InTag) FMemScope PREPROCESSOR_JOIN(MemScope, __LINE__)(InTag);
-# define UE_MEMSCOPE_PTR(InPtr) FMemScopePtr PREPROCESSOR_JOIN(MemPtrScope, __LINE__)((uint64)InPtr);
-# define UE_MEMSCOPE_DEFAULT(InTag) FDefaultMemScope PREPROCESSOR_JOIN(MemScope, __LINE__)(InTag);
-# define UE_MEMSCOPE_UNINITIALIZED(Line) FMemScope PREPROCESSOR_JOIN(MemScope, Line);
+# define ZEN_MEMSCOPE(InTag) FMemScope PREPROCESSOR_JOIN(MemScope, __LINE__)(InTag);
+# define ZEN_MEMSCOPE_PTR(InPtr) FMemScopePtr PREPROCESSOR_JOIN(MemPtrScope, __LINE__)((uint64)InPtr);
+# define ZEN_MEMSCOPE_DEFAULT(InTag) FDefaultMemScope PREPROCESSOR_JOIN(MemScope, __LINE__)(InTag);
+# define ZEN_MEMSCOPE_UNINITIALIZED(Line) FMemScope PREPROCESSOR_JOIN(MemScope, Line);
#else // UE_MEMORY_TAGS_TRACE_ENABLED
////////////////////////////////////////////////////////////////////////////////
-# define UE_MEMSCOPE(...)
-# define UE_MEMSCOPE_PTR(...)
-# define UE_MEMSCOPE_DEFAULT(...)
-# define UE_MEMSCOPE_UNINITIALIZED(...)
-# define UE_MEMSCOPE_ACTIVATE(...)
+# define ZEN_MEMSCOPE(...)
+# define ZEN_MEMSCOPE_PTR(...)
+# define ZEN_MEMSCOPE_DEFAULT(...)
+# define ZEN_MEMSCOPE_UNINITIALIZED(...)
#endif // UE_MEMORY_TAGS_TRACE_ENABLED
}