-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug[next]: respect DEFAULT_BACKEND and no_backend mechanism #1380
bug[next]: respect DEFAULT_BACKEND and no_backend mechanism #1380
Conversation
src/gt4py/next/ffront/decorator.py
Outdated
@@ -495,7 +495,7 @@ def program(*, backend: Optional[ppi.ProgramExecutor]) -> Callable[[types.Functi | |||
def program( | |||
definition=None, | |||
*, | |||
backend=None, | |||
backend=eve.NOTHING, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document this mechanism and why this is needed. For readability it might also help to not use eve.Nothing
, but something explicit, e.g. introduce
class UseDefaultBackendMarker:
pass
and then
backend=eve.NOTHING, | |
backend=UseDefaultBackendMarker, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a concrete comment that you like to have? The docstring of eve.NOTHING explains it already. Should I mention that None
means no backend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this:
# If unspecified `DEFAULT_BACKEND`, by default being embedded execution, is used. We use
# `eve.NOTHING` here instead of `None` since `None` is already used to specify embedded execution.
# As a result we are still able to temporarily switch to a different default backend (e.g. in the
# tests to disable execution without explicit backend selection).
Could also be description of the backend keyword argument in the docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just reading this line again yesterday and scratched my head on why exactly we had to use this mechanism and since I was already told I thought a comment would make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will add the extended comment in a next PR
tests/next_tests/integration_tests/feature_tests/ffront_tests/ffront_test_utils.py
Outdated
Show resolved
Hide resolved
tests/next_tests/integration_tests/feature_tests/ffront_tests/ffront_test_utils.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Till Ehrengruber <[email protected]>
fixes #1376.
Thanks @DropD for the testcase.
Needs to be merged after #1365, replaces #1364.