Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ XQAKernelRuntimeHashKey getRuntimeHashKeyFromXQAParams(XQAParams const& xqaParam
// precompiled XQA does not use is_fp8_output as hashing key
return {xqaParams.kv_cache_data_type, head_size, beam_width, kernel_num_q_heads_over_kv, kernel_m_tilesize,
xqaParams.paged_kv_cache ? static_cast<unsigned int>(xqaParams.tokens_per_block) : 0, xqaParams.paged_kv_cache,
xqaParams.multi_query_tokens, isXqaJit ? xqaParams.is_fp8_output : false};
xqaParams.multi_query_tokens, isXqaJit ? xqaParams.is_fp8_output : false,
isXqaJit ? std::optional(xqaParams.position_embedding_type) : std::nullopt};
}

} // namespace tensorrt_llm::kernels
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ struct XQAKernelRuntimeHashKey
bool paged_kv_cache;
bool multi_query_tokens;
bool is_fp8_output;
std::optional<PositionEmbeddingType> position_embedding_type;

bool operator==(XQAKernelRuntimeHashKey const& other) const
{
return kv_data_type == other.kv_data_type && head_size == other.head_size
&& num_q_heads_per_kv == other.num_q_heads_per_kv && beam_size == other.beam_size
&& multi_query_tokens == other.multi_query_tokens && m_tilesize == other.m_tilesize
&& tokens_per_page == other.tokens_per_page && paged_kv_cache == other.paged_kv_cache
&& is_fp8_output == other.is_fp8_output;
&& is_fp8_output == other.is_fp8_output && position_embedding_type == other.position_embedding_type;
}
};

Expand Down Expand Up @@ -103,6 +104,8 @@ struct XQAKernelRuntimeHasher
key ^= s.multi_query_tokens;
key <<= 1;
key ^= s.is_fp8_output;
key <<= 8;
key ^= static_cast<int8_t>(s.position_embedding_type.value_or(static_cast<PositionEmbeddingType>(-1)));
return key;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ using ::tensorrt_llm::kernels::XQAKernelMetaInfo;
XQAKernelRuntimeHashKey getRuntimeHashKeyFromKernelMeta(XQAKernelMetaInfo const& kernelMeta)
{
return {kernelMeta.mKVDataType, kernelMeta.mHeadDim, kernelMeta.mBeamWidth, kernelMeta.mNumQHeadsOverKV,
kernelMeta.mMTileSize, kernelMeta.mTokensPerPage, kernelMeta.mPagedKVCache, kernelMeta.mMultiQueryTokens,
0 /* xqa jit param is_fp8_output */};
kernelMeta.mMTileSize, kernelMeta.mTokensPerPage, kernelMeta.mPagedKVCache, kernelMeta.mMultiQueryTokens, false,
std::nullopt};
}

} // anonymous namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class XQAKernelList
}
XQAKernelRuntimeHashKey hash_key{kernelMeta.mKVDataType, kernelMeta.mHeadDim, kernelMeta.mBeamWidth,
kernelMeta.mNumQHeadsOverKV, kernelMeta.mMTileSize, kernelMeta.mTokensPerPage, kernelMeta.mPagedKVCache,
kernelMeta.mMultiQueryTokens, 0 /* xqa jit param is_fp8_output */};
kernelMeta.mMultiQueryTokens, false, std::nullopt};
Comment thread
lowsfer marked this conversation as resolved.

mFunctions.insert(std::make_pair(hash_key, funcInfo));
}
Expand Down Expand Up @@ -128,7 +128,8 @@ class XQAKernelList
XQAKernelRuntimeHashKey hash_key
= {xqaParams.kv_cache_data_type, head_size, beam_width, kernel_num_q_heads_over_kv, m_tilesize,
xqaParams.paged_kv_cache ? static_cast<unsigned int>(xqaParams.tokens_per_block) : 0,
xqaParams.paged_kv_cache, xqaParams.multi_query_tokens, 0 /* xqa jit param is_fp8_output */};
xqaParams.paged_kv_cache, xqaParams.multi_query_tokens, 0, /* xqa jit param is_fp8_output */
std::nullopt};
auto const findIter = mFunctions.find(hash_key);
return findIter != mFunctions.end();
}
Expand Down