tlopex commented on code in PR #20035:
URL: https://github.com/apache/tvm/pull/20035#discussion_r3847772331
##########
src/runtime/vm/paged_kv_cache.cc:
##########
@@ -44,6 +49,56 @@ namespace tvm {
namespace runtime {
namespace vm {
+namespace {
+
+constexpr const char* kPagedKVCacheCheckpointRuntime =
"relax.vm.PagedAttentionKVCache";
+constexpr int64_t kPagedKVCacheCheckpointFormatVersion = 1;
+
+const char* AttnKindToString(AttnKind attn_kind) {
+ switch (attn_kind) {
+ case AttnKind::kMHA:
+ return "mha";
+ case AttnKind::kMLA:
+ return "mla";
+ case AttnKind::kLinearAttn:
+ return "linear";
+ case AttnKind::kMHASliding:
+ return "mha_sliding";
+ }
+ TVM_FFI_ICHECK(false) << "Unknown attention kind: " <<
static_cast<int>(attn_kind);
+ return "unknown";
+}
+
+const char* RoPEModeToString(RoPEMode rope_mode) {
+ switch (rope_mode) {
+ case RoPEMode::kNone:
+ return "none";
+ case RoPEMode::kNormal:
+ return "normal";
+ case RoPEMode::kInline:
+ return "inline";
+ }
+ TVM_FFI_ICHECK(false) << "Unknown RoPE mode: " <<
static_cast<int>(rope_mode);
+ return "unknown";
+}
+
+std::string Uint64ToHex(uint64_t value) {
+ std::ostringstream os;
+ os << std::hex << std::setw(16) << std::setfill('0') << value;
Review Comment:
`Uint64ToHex()` is locale-dependent, so the same hash may produce different
strings across environments; maybe we can call
`os.imbue(std::locale::classic())` before formatting it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]