forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sahar/contrib ops branch #295
Draft
sfatimar
wants to merge
5
commits into
master
Choose a base branch
from
sahar/contrib_ops_branch
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#include "contrib_ops/openvino/beam_search.h" | ||
|
||
namespace onnxruntime { | ||
namespace contrib { | ||
namespace openvino_ep { | ||
|
||
#define REGISTER_KERNEL_TYPED(T) \ | ||
ONNX_OPERATOR_TYPED_KERNEL_EX( \ | ||
BeamSearch, \ | ||
kMSDomain, \ | ||
1, \ | ||
T, \ | ||
kOpenVINOExecutionProvider, \ | ||
(*KernelDefBuilder::Create()) \ | ||
.TypeConstraint("T", DataTypeImpl::GetTensorType<T>()), \ | ||
BeamSearch); | ||
|
||
REGISTER_KERNEL_TYPED(float) | ||
|
||
BeamSearch::BeamSearch(const OpKernelInfo& info) | ||
: onnxruntime::contrib::transformers::BeamSearch(info) { | ||
|
||
} | ||
|
||
Status BeamSearch::ComputeInternal(OpKernelContext* context) const { | ||
return onnxruntime::contrib::transformers::BeamSearch::Compute(context); | ||
} | ||
|
||
Status BeamSearch::Compute(OpKernelContext* context) const { | ||
auto s = ComputeInternal(context); | ||
return s; | ||
} | ||
|
||
} // namespace cuda | ||
} // namespace contrib | ||
} // namespace onnxruntime |
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,29 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
Check warning Code scanning / lintrunner CLANGFORMAT/format
See https://clang.llvm.org/docs/ClangFormat.html.
Run `lintrunner -a` to apply this patch.
|
||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include "core/providers/shared_library/provider_api.h" | ||
#include "contrib_ops/cpu/transformers/beam_search.h" | ||
|
||
namespace onnxruntime { | ||
|
||
class SessionState; | ||
|
||
namespace contrib { | ||
|
||
namespace openvino_ep { | ||
|
||
class BeamSearch final : public onnxruntime::contrib::transformers::BeamSearch { | ||
public: | ||
BeamSearch(const OpKernelInfo& info); | ||
|
||
Status Compute(OpKernelContext* context) const override; | ||
|
||
private: | ||
Status ComputeInternal(OpKernelContext* context) const; | ||
}; | ||
|
||
} // namespace openvino | ||
} // namespace contrib | ||
} // namespace onnxruntime |
40 changes: 40 additions & 0 deletions
40
onnxruntime/contrib_ops/openvino/openvino_contrib_kernels.cc
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,40 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
Check warning Code scanning / lintrunner CLANGFORMAT/format
See https://clang.llvm.org/docs/ClangFormat.html.
Run `lintrunner -a` to apply this patch.
|
||
// Licensed under the MIT License. | ||
|
||
#include "contrib_ops/openvino/openvino_contrib_kernels.h" | ||
|
||
using namespace onnxruntime::common; | ||
|
||
namespace onnxruntime { | ||
namespace contrib { | ||
namespace openvino_ep { | ||
|
||
class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kOpenVINOExecutionProvider, kMSDomain, 1, float, BeamSearch); | ||
|
||
template <> | ||
KernelCreateInfo BuildKernelCreateInfo<void>() { | ||
KernelCreateInfo info; | ||
return info; | ||
} | ||
|
||
Status RegisterOpenVINOContribKernels(KernelRegistry& kernel_registry) { | ||
static const BuildKernelCreateInfoFn function_table[] = { | ||
BuildKernelCreateInfo<void>, // default entry to avoid the list become empty after ops-reducing | ||
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kOpenVINOExecutionProvider, kMSDomain, 1, float, BeamSearch)> | ||
}; | ||
|
||
for (auto& function_table_entry : function_table) { | ||
KernelCreateInfo info = function_table_entry(); | ||
if (info.kernel_def != nullptr) { // filter disabled entries where type is void | ||
ORT_RETURN_IF_ERROR(kernel_registry.Register(std::move(info))); | ||
//return kernel_registry.Register(std::move(info)); | ||
} | ||
} | ||
|
||
return Status::OK(); | ||
} | ||
|
||
} // namespace openvino | ||
} // namespace contrib | ||
} // namespace onnxruntime | ||
|
14 changes: 14 additions & 0 deletions
14
onnxruntime/contrib_ops/openvino/openvino_contrib_kernels.h
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,14 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
Check warning Code scanning / lintrunner CLANGFORMAT/format
See https://clang.llvm.org/docs/ClangFormat.html.
Run `lintrunner -a` to apply this patch.
|
||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
#include "core/common/status.h" | ||
#include "core/providers/shared_library/provider_api.h" | ||
|
||
namespace onnxruntime { | ||
namespace contrib { | ||
namespace openvino_ep { | ||
Status RegisterOpenVINOContribKernels(KernelRegistry& kernel_registry); | ||
} // namespace OpenVINO | ||
} // namespace contrib | ||
} // namespace onnxruntime |
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / lintrunner
CLANGFORMAT/format