-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move common ET/Aten op stuff to ops/library.h
Differential Revision: D63983380 Pull Request resolved: #1116
- Loading branch information
Showing
8 changed files
with
81 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) Meta Platforms, Inc. and affiliates. | ||
// All rights reserved. | ||
// | ||
// This source code is licensed under the license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
#if defined(USE_ATEN) && !defined(USE_EXECUTORCH) | ||
#pragma message("USE_ATEN") | ||
#include <torch/library.h> | ||
#include <torch/script.h> | ||
#include <torch/torch.h> | ||
using Tensor = at::Tensor; | ||
#define TORCHAO_CHECK(cond, msg) TORCH_CHECK(cond, msg) | ||
|
||
#elif defined(USE_EXECUTORCH) && !defined(USE_ATEN) | ||
#pragma message("USE_EXECUTORCH") | ||
#include <executorch/extension/kernel_util/make_boxed_from_unboxed_functor.h> | ||
#include <executorch/runtime/kernel/kernel_includes.h> | ||
using Tensor = torch::executor::Tensor; | ||
using RuntimeContext = torch::executor::KernelRuntimeContext; | ||
#define TORCHAO_CHECK(cond, msg) ET_CHECK_MSG(cond, msg) | ||
|
||
#elif !defined(USE_EXECUTORCH) && !defined(USE_ATEN) | ||
#pragma message("Neither USE_ATEN or USE_EXECUTORCH defined") | ||
#include <stdexcept> | ||
|
||
#define TORCHAO_CHECK(cond, message) \ | ||
if (!(cond)) { \ | ||
throw std::runtime_error(message); \ | ||
} | ||
|
||
#else | ||
#error "Cannot define both USE_ATEN or USE_EXECUTORCH" | ||
#endif |
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 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