Skip to content
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

refactor[next]: workflowify PAST -> ITIR toolchain step #1479

Merged
merged 55 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e351cf7
initial steps
nfarabullini Feb 28, 2024
ca4768f
progress
nfarabullini Feb 28, 2024
4d05daa
fix for test
nfarabullini Feb 28, 2024
775372d
Merge branch 'main' of https://github.com/nfarabullini/gt4py into c20…
nfarabullini Feb 29, 2024
ee6a764
ran pre-commit with ruff
nfarabullini Feb 29, 2024
6302c2a
fixed ruff errors
nfarabullini Feb 29, 2024
1cdbefd
streamline PAST stage
Feb 29, 2024
565a2fa
Merge branch 'c20_workflowefy' into c20-workflowify
Feb 29, 2024
209faa3
first attempt at as_program function generator
Feb 29, 2024
23bab15
Merge branch 'main' into c20-workflowify
Mar 1, 2024
065fe50
try linecache fix
Mar 1, 2024
35e90b2
fix __globals__ of generated function
Mar 1, 2024
54ebebd
fix as_program (?)
Mar 1, 2024
df34976
roundtrip conversion skeleton
Mar 1, 2024
c925663
edits
nfarabullini Mar 1, 2024
aef1438
workflowify double roundtrip
Mar 4, 2024
cdbb909
Merge branch 'c20-workflowify' into c20_workflowefy
Mar 4, 2024
f9b4198
edit for dims
nfarabullini Mar 4, 2024
55e24f2
small fix
nfarabullini Mar 4, 2024
b382ba2
added code for nested tuples
nfarabullini Mar 4, 2024
b4ee386
left over code
nfarabullini Mar 4, 2024
2796327
separate transforms from compile workflow, fix fendef call
Mar 4, 2024
7ff19a3
[wip] refactor backend to split transforms and executor
Mar 4, 2024
8218da6
[wip] refactor backend / executor
Mar 5, 2024
701b330
edits for past_to_func
nfarabullini Mar 5, 2024
81e6a99
[wip] refactor backend to start from PAST
Mar 6, 2024
3022f20
Merge branch 'main' of https://github.com/nfarabullini/gt4py into c20…
nfarabullini Mar 6, 2024
e6410e6
fixed some pre-commit errors
nfarabullini Mar 6, 2024
625c337
update remaining tests and test utils
DropD Mar 6, 2024
aa8187b
Merge branch 'c20-workflowify' into c20_workflowefy
DropD Mar 6, 2024
1561581
tests: fix xfail conditions in test_icon_like_scan
DropD Mar 6, 2024
413aea3
tests: fix xfail conditions in test_anton_toy
DropD Mar 6, 2024
86765b4
tests: fix xfail conditions in test_hdiff
DropD Mar 6, 2024
0807208
edits and pre-commit
nfarabullini Mar 6, 2024
c748ad7
fixed wrong code merge
nfarabullini Mar 6, 2024
00bf734
small edit
nfarabullini Mar 6, 2024
12b90fc
small edit
nfarabullini Mar 6, 2024
2bd16f5
start factoring _process_args out from Program
DropD Mar 7, 2024
260c323
fix and remove _process_args etc from decorator
DropD Mar 7, 2024
2b1b368
refactor otf.transforms -> ffront
DropD Mar 7, 2024
8f08fdb
remove empty `otf.transforms`
DropD Mar 8, 2024
9e70d69
minor roundtrip workflow refactor
DropD Mar 8, 2024
33c3ebc
remove debug lines, use flatten instead of comprehension
DropD Mar 8, 2024
30cff59
test
nfarabullini Mar 8, 2024
fb7b1ce
Merge branch 'c20_workflowefy' of https://github.com/nfarabullini/gt4…
nfarabullini Mar 8, 2024
6ed1dea
run formatting
DropD Mar 8, 2024
f0659a9
refactor type_info.flatten -> eve.utils.flatten_iter
DropD Mar 8, 2024
c907da0
split PAST -> function into separate branch
DropD Mar 8, 2024
5f4a4d4
remove Program.format_itir
DropD Mar 7, 2024
ef077d6
[wip] refactor column_axis out of decorator
DropD Mar 8, 2024
1b72c84
refactor: past_to_itir_wf -> past_to_itir
DropD Mar 13, 2024
e148c86
rename: ffront.*_wf -> ffront.*
DropD Mar 13, 2024
57cb2ed
fix: undo false positive replacement from refactoring
DropD Mar 13, 2024
2cff020
typing: fix issues in `_column_axis`
DropD Mar 13, 2024
bffb73b
Merge branch 'main' into c20_workflowefy
DropD Mar 14, 2024
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
20 changes: 12 additions & 8 deletions src/gt4py/next/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,34 @@
from __future__ import annotations

import dataclasses
from typing import Any, Generic
from typing import Generic

from gt4py._core import definitions as core_defs
from gt4py.next import allocators as next_allocators
from gt4py.next.iterator import ir as itir
from gt4py.next.ffront import past_process_args, past_to_itir
from gt4py.next.otf import stages, workflow
from gt4py.next.program_processors import processor_interface as ppi


DEFAULT_TRANSFORMS: workflow.Workflow[stages.PastClosure, stages.ProgramCall] = (
past_process_args.past_process_args.chain(past_to_itir.PastToItirFactory())
)


@dataclasses.dataclass(frozen=True)
class Backend(Generic[core_defs.DeviceTypeT]):
executor: ppi.ProgramExecutor
allocator: next_allocators.FieldBufferAllocatorProtocol[core_defs.DeviceTypeT]
transformer: workflow.Workflow[stages.PastClosure, stages.ProgramCall] = DEFAULT_TRANSFORMS

def __call__(self, program: itir.FencilDefinition, *args, **kwargs: Any) -> None:
self.executor.__call__(program, *args, **kwargs)
def __call__(self, program: stages.PastClosure) -> None:
program_call = self.transformer(program)
self.executor(program_call.program, *program_call.args, **program_call.kwargs)

@property
def __name__(self) -> str:
return getattr(self.executor, "__name__", None) or repr(self)

@property
def kind(self) -> type[ppi.ProgramExecutor]:
return self.executor.kind

@property
def __gt_allocator__(
self,
Expand Down
Loading
Loading