Skip to content

Commit

Permalink
Revert "#5389: added map from operation to golden function so that go…
Browse files Browse the repository at this point in the history
…lden function can be accessed in fast runtime mode as well"

This reverts commit 0018217.
  • Loading branch information
arakhmati committed May 20, 2024
1 parent 0018217 commit e3a5220
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
1 change: 0 additions & 1 deletion ttnn/ttnn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ def manage_config(name, value):
query_registered_operations,
register_pre_operation_hook,
register_post_operation_hook,
get_golden_function,
)

import ttnn.experimental
Expand Down
21 changes: 5 additions & 16 deletions ttnn/ttnn/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,13 +729,6 @@ def query_registered_operations(include_experimental=False):
return ttnn_operations


OPERATION_TO_GOLDEN_FUNCTION = {}


def get_golden_function(operation):
return OPERATION_TO_GOLDEN_FUNCTION[operation]


def register_operation(
*,
name=None,
Expand All @@ -750,10 +743,8 @@ def register_operation(
):
def operation_decorator(function: callable):
global REGISTERED_APIS
global OPERATION_TO_GOLDEN_FUNCTION

if ttnn.CONFIG.enable_fast_runtime_mode:
OPERATION_TO_GOLDEN_FUNCTION[function] = golden_function
return function

is_cpp_function = hasattr(function, "__ttnn__")
Expand Down Expand Up @@ -791,19 +782,17 @@ def wrapper(*args, **kwargs):
allow_to_fallback_to_golden_function_on_failure=allow_to_fallback_to_golden_function_on_failure,
)

if api in REGISTERED_APIS:
raise RuntimeError(f"{api} is already registered")
REGISTERED_APIS.add(api)

if is_method:

@wraps(api)
def method_call(self, *function_args, **function_kwargs):
return api(self, *function_args, **function_kwargs)

api = method_call

if api in REGISTERED_APIS:
raise RuntimeError(f"{api} is already registered")
REGISTERED_APIS.add(api)

OPERATION_TO_GOLDEN_FUNCTION[api] = golden_function
return method_call

return api

Expand Down

0 comments on commit e3a5220

Please sign in to comment.