Skip to content

Commit

Permalink
#0: PLS SQUASH - final cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vtangTT committed May 24, 2024
1 parent ffd6246 commit 2cdac5b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ project(tt-metal
include(${CMAKE_SOURCE_DIR}/cmake/macros.cmake)
CHECK_COMPILERS()

include(${CMAKE_SOURCE_DIR}/cmake/macros.cmake)
CHECK_COMPILERS()

############################################################################################################################
# Find all required libraries to build
############################################################################################################################
Expand Down
18 changes: 12 additions & 6 deletions ttnn/cpp/pybind11/decorators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ttnn {
namespace decorators {

template <typename T, typename Return, typename... Args>
constexpr auto resolve_call_method(Return (*execute)(Args...)) {
constexpr auto resolve_call_method(Return (*execute_on_worker_thread)(Args...)) {
return [](const T& self, Args&&... args) { return self(std::forward<Args>(args)...); };
}

Expand All @@ -41,17 +41,23 @@ template <typename registered_operation_t, typename concrete_operation_t, typena
void add_operator_call(T& py_operation, const pybind_arguments_t<py_args_t...>& overload) {
std::apply(
[&py_operation](auto... args) {
py_operation.def("__call__", resolve_call_method<registered_operation_t>(&concrete_operation_t::execute), args...);
py_operation.def(
"__call__",
resolve_call_method<registered_operation_t>(&concrete_operation_t::execute_on_worker_thread),
args...);
},
overload.value);
}

template <typename registered_operation_t, typename concrete_operation_t, typename T, typename function_t, typename... py_args_t>
template <
typename registered_operation_t,
typename concrete_operation_t,
typename T,
typename function_t,
typename... py_args_t>
void add_operator_call(T& py_operation, const pybind_overload_t<function_t, py_args_t...>& overload) {
std::apply(
[&py_operation, &overload](auto... args) {
py_operation.def("__call__", overload.function, args...);
},
[&py_operation, &overload](auto... args) { py_operation.def("__call__", overload.function, args...); },
overload.args.value);
}

Expand Down

0 comments on commit 2cdac5b

Please sign in to comment.