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
12 changes: 10 additions & 2 deletions backends/vulkan/runtime/graph/ops/impl/SDPA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,10 @@ void update_cache_impl(ComputeGraph& graph, const std::vector<ValueRef>& args) {
add_sdpa_kv_cache_update_node(graph, input_pos_symint, value, cache);
}

void sdpa_impl(ComputeGraph& graph, const std::vector<ValueRef>& args) {
void sdpa_impl_with_shader_override(
ComputeGraph& graph,
const std::vector<ValueRef>& args,
const ValueRef shader_override) {
int arg_idx = 0;
const ValueRef q_projected = args[arg_idx++];
const ValueRef k_cache = args[arg_idx++];
Expand Down Expand Up @@ -792,7 +795,12 @@ void sdpa_impl(ComputeGraph& graph, const std::vector<ValueRef>& args) {
/*k=*/kDummyValueRef,
input_pos_symint,
out,
SDPAMode::LLM);
SDPAMode::LLM,
shader_override);
}

void sdpa_impl(ComputeGraph& graph, const std::vector<ValueRef>& args) {
sdpa_impl_with_shader_override(graph, args, kDummyValueRef);
}

void sdpa_with_kv_cache_impl(
Expand Down
5 changes: 5 additions & 0 deletions backends/vulkan/runtime/graph/ops/impl/SDPA.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ namespace vkcompute {
//
enum class SDPAMode { LLM, FUSED };

void sdpa_impl_with_shader_override(
ComputeGraph& graph,
const std::vector<ValueRef>& args,
ValueRef shader_override);

void add_sdpa_compute_attn_weights_node(
ComputeGraph& graph,
const ValueRef q,
Expand Down
Loading