Skip to content

Commit

Permalink
Revert "Faster decorator (#5996)" (#6006)
Browse files Browse the repository at this point in the history
This reverts commit 0ba9198.

Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com>
  • Loading branch information
lixinqi and oneflow-ci-bot committed Aug 23, 2021
1 parent 3fba52f commit f7eeda7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions oneflow/core/common/decorator.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ struct WithDecorator final {
template<typename T, typename... Args>
struct Decorate<T (*)(Args...)> final {
template<T (*func)(Args...)>
struct FuncPtr final {
static constexpr T (*value)(Args...) = &Decorator<T, Args...>::template Call<func>;
};
static T Call(Args... args) {
return Decorator<T, Args...>::template Call<func>(args...);
}
};
};

#define DECORATE(fn_ptr, decorator) \
static_cast<decltype(fn_ptr)>( \
WithDecorator<decorator>::Decorate<decltype(fn_ptr)>::FuncPtr<fn_ptr>::value)
(&WithDecorator<decorator>::Decorate<decltype(fn_ptr)>::Call<fn_ptr>)

template<typename... Args>
struct ThreadLocalCopiable;
Expand Down

0 comments on commit f7eeda7

Please sign in to comment.