Skip to content
Closed
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
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ message(STATUS "Using python executable '${PYTHON_EXECUTABLE}'")
set(_common_compile_options -Wno-deprecated-declarations -fPIC)

# Let files say "include <executorch/path/to/header.h>".
set(_common_include_directories ${CMAKE_CURRENT_SOURCE_DIR}/..)
find_package(Torch CONFIG REQUIRED)

set(_common_include_directories ${CMAKE_CURRENT_SOURCE_DIR}/.. ${TORCH_INCLUDE_DIRS})

#
# The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE}.
Expand Down Expand Up @@ -680,7 +682,6 @@ if(EXECUTORCH_BUILD_PYBIND)
endif()

# find pytorch lib, to allow pybind to take at::Tensor as input/output
find_package(Torch CONFIG REQUIRED)
find_library(
TORCH_PYTHON_LIBRARY torch_python PATHS "${TORCH_INSTALL_PREFIX}/lib"
)
Expand Down
14 changes: 8 additions & 6 deletions runtime/platform/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#pragma once

#include <c10/macros/Macros.h>

/*
* Compiler support checks. Follows the logic used by pytorch/c10/util/C++17.h
* but may support older versions.
Expand Down Expand Up @@ -55,9 +57,9 @@
*/

#define ET_NORETURN [[noreturn]]
#define ET_NOINLINE __attribute__((noinline))
#define ET_INLINE __attribute__((always_inline)) inline
#define ET_INLINE_ATTRIBUTE __attribute__((always_inline))
#define ET_NOINLINE C10_NOINLINE
#define ET_INLINE C10_ALWAYS_INLINE
#define ET_INLINE_ATTRIBUTE C10_ALWAYS_INLINE_ATTRIBUTE

#if defined(__GNUC__)

Expand Down Expand Up @@ -88,14 +90,14 @@
// do something
// }
#if (__cplusplus) >= 202002L

// TODO: backport these to c10 and remove ET definition
#define ET_LIKELY(expr) (expr) [[likely]]
#define ET_UNLIKELY(expr) (expr) [[unlikely]]

#else

#define ET_LIKELY(expr) (expr)
#define ET_UNLIKELY(expr) (expr)
#define ET_LIKELY(expr) C10_LIKELY(expr)
#define ET_UNLIKELY(expr) C10_UNLIKELY(expr)

#endif // (__cplusplus) >= 202002L

Expand Down
3 changes: 3 additions & 0 deletions runtime/platform/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ def define_common_targets():
exported_headers = [
"compiler.h",
],
exported_deps = [
"//caffe2/c10:c10",
] if not runtime.is_oss else [],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
Expand Down
Loading