-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new API to register custom ops into ExecuTorch (#2916)
Summary: Pull Request resolved: #2916 Retry of D55713944 Differential Revision: D55856491
- Loading branch information
1 parent
7d4bafc
commit 203c9d2
Showing
11 changed files
with
102 additions
and
120 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
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
Empty file.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <executorch/runtime/kernel/kernel_includes.h> | ||
|
||
namespace torch { | ||
namespace executor { | ||
|
||
namespace native { | ||
|
||
Tensor& sdpa_with_kv_cache_out( | ||
RuntimeContext& ctx, | ||
const Tensor& q_projected, | ||
const Tensor& k_projected, | ||
const Tensor& v_projected, | ||
Tensor& key_cache, | ||
Tensor& value_cache, | ||
const int64_t start_pos, | ||
const int64_t seq_len, | ||
const optional<Tensor>& attn_mask, | ||
const double dropout_p, | ||
const bool is_causal, | ||
// @lint-ignore CLANGTIDY facebook-hte-ParameterMightThrowOnCopy | ||
const optional<double> scale, | ||
Tensor& output); | ||
|
||
Tensor& flash_attention_kernel_out( | ||
RuntimeContext& ctx, | ||
const Tensor& query, | ||
const Tensor& key, | ||
const Tensor& value, | ||
const optional<Tensor>& attn_mask, | ||
const double dropout_p, | ||
const bool is_causal, | ||
// @lint-ignore CLANGTIDY facebook-hte-ParameterMightThrowOnCopy | ||
const optional<double> scale, | ||
Tensor& output); | ||
|
||
} // namespace native | ||
} // namespace executor | ||
} // namespace torch |
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
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