forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GPU] Enable SDPA by default (openvinotoolkit#24757)
### Details: - Enabled SDPA by default - Added indirect inputs support (copy of openvinotoolkit#24665) - Updated SDPA decomposition rule to cover only well-checked cases - Updated functional tests accordingly
- Loading branch information
Showing
24 changed files
with
847 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
src/plugins/intel_gpu/include/intel_gpu/op/indirect_sdpa.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "intel_gpu/op/sdpa.hpp" | ||
#include "openvino/core/node.hpp" | ||
#include "openvino/core/partial_shape.hpp" | ||
#include "openvino/op/op.hpp" | ||
|
||
namespace ov { | ||
namespace intel_gpu { | ||
namespace op { | ||
|
||
class IndirectSDPA : public ov::intel_gpu::op::SDPA { | ||
public: | ||
OPENVINO_OP("IndirectSDPA", "gpu_opset"); | ||
|
||
IndirectSDPA() = default; | ||
|
||
IndirectSDPA(const ov::Output<Node>& Q, | ||
const ov::Output<Node>& K, | ||
const ov::Output<Node>& V, | ||
const ov::Output<Node>& beam_table, | ||
const bool is_causal, | ||
const int64_t indirect_axis, | ||
const std::vector<int64_t>& order_q, | ||
const std::vector<int64_t>& order_k, | ||
const std::vector<int64_t>& order_v, | ||
const std::vector<int64_t>& order_out, | ||
const ov::element::Type output_type = ov::element::undefined); | ||
|
||
IndirectSDPA(const ov::Output<Node>& Q, | ||
const ov::Output<Node>& K, | ||
const ov::Output<Node>& V, | ||
const ov::Output<Node>& attn_mask, | ||
const ov::Output<Node>& beam_table, | ||
const bool is_causal, | ||
const int64_t indirect_axis, | ||
const std::vector<int64_t>& order_q, | ||
const std::vector<int64_t>& order_k, | ||
const std::vector<int64_t>& order_v, | ||
const std::vector<int64_t>& order_out, | ||
const ov::element::Type output_type = ov::element::undefined); | ||
|
||
IndirectSDPA(const ov::Output<Node>& Q, | ||
const ov::Output<Node>& K, | ||
const ov::Output<Node>& V, | ||
const ov::Output<Node>& attn_mask, | ||
const ov::Output<Node>& scale, | ||
const ov::Output<Node>& beam_table, | ||
const bool is_causal, | ||
const int64_t indirect_axis, | ||
const std::vector<int64_t>& order_q, | ||
const std::vector<int64_t>& order_k, | ||
const std::vector<int64_t>& order_v, | ||
const std::vector<int64_t>& order_out, | ||
const ov::element::Type output_type = ov::element::undefined); | ||
|
||
bool visit_attributes(ov::AttributeVisitor &visitor) override; | ||
void validate_and_infer_types() override; | ||
|
||
std::shared_ptr<Node> clone_with_new_inputs(const ov::OutputVector& new_args) const override; | ||
|
||
ov::element::Type get_output_type() const { return m_output_type; } | ||
|
||
int64_t get_indirect_axis() const { return m_indirect_axis; } | ||
|
||
using ov::intel_gpu::op::SDPA::default_order; | ||
|
||
protected: | ||
int64_t m_indirect_axis = -1; | ||
}; | ||
|
||
} // namespace op | ||
} // namespace intel_gpu | ||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.