gridtools / gtc Goto Github PK
View Code? Open in Web Editor NEWA stencil DSL toolchain written in Python.
License: GNU General Public License v3.0
A stencil DSL toolchain written in Python.
License: GNU General Public License v3.0
Change the layout to have one top-level folder per sub-project.
Example:
REPO/
gtc/
src/
gtc/
docs/
tests/
setup.cfg
setup.py
pyproject.toml
...
eve/
src/
eve/
docs/
tests/
setup.cfg
setup.py
pyproject.toml
...
gt_frontend/
src/
docs/
tests/
setup.cfg
setup.py
pyproject.toml
...
cpputil/ # or gridtools-mesh or any other name
cmake/
include/
tests/
CMakeLists.txt
...
Write an absolute minimal frontend to parse GTScript into GTIR
use e.g. the "loop" dialect from MLIR as an example
It is sometimes useful to restrict types of fields of fields of a node.
Objectives
Pydantic supports this out of the box (see pydantic/pydantic#556 and pydantic/pydantic#595).
Open questions:
from typing import Generic, TypeVar, List
# raises: TypeError: Subscripted generics cannot be used with class and instance checks
issubclass(List[int], List[T])
Example 1
T = TypeVar('T')
class Constant(GT4PyAstNode, Generic[T]):
value: T
class ExampleNode:
some_int_constant: Constant[Int]
Example 2
T = TypeVar('T')
class Stencil(GTScriptAstNode, Generic[T]):
iteration_spec: List[Union[IterationOrder, LocationSpecification, Interval]]
body: List[T]
class Computation(GTScriptAstNode):
name: str
arguments: List[Argument]
stencils: List[Union[Stencil[Stencil[Statement]], Stencil[Statement]]]
Add a class toggle to enable or disable the use of node superclasses when looking up for suitable visit_ methods
Since lookup tables are passed by the user, and they cannot be generally generated, it makes little sense to have a concept for the mesh, and we can just take the mesh as parameter, as we do for the fields. We could treat mesh/neighbor tables as "state" of the computation.
If I have
class FieldAccess(Expr):
name: Str
class VarAccess(Expr):
name: Str
the visitor will not distinguish the 2 nodes. It will enter visit_FieldAccess
even for VarAccess
. This can be solved by type annotating the visit method's node
argument.
However, no such workaround exists for the templates in the TemplatedGenerator. Adding an extra field in one of the 2 classes works, e.g.
class VarAccess(Expr):
name: Str
dummy: Optional[str]
In the new_infrastructure
branch there is a change in behavior in the code generator.
For a field like
a_field: Optional[List[SomeNode]]
, if optional is None
, the code generator will now expand to N o n e
instead of skipping over it. In the template I used ''.join(a_field)
Just as a reminder to discuss it at some point...
Dawn has the concept of derived information which is some extra information computed from the IR and re-used by several transformations. (Things that are expensive to recompute.) Would be interesting to discuss if we could implement such a thing with automatic invalidation.
One example could be dependency graphs.
You would give_me_dependency(some_expression) and it will retrieve it from cache or compute it and store in cache.
This would be only a compiler performance optimization which we shouldn't do now.
I create this issue to reference from gt4py comments.
@enum.unique
class MyEnum(eve.IntEnum):
member: 0
reveal(MyEnum.member) # <- int but should be MyEnum
Run this in outside of the eve package (maybe problem also inside?).
@egparedes and I couldn't figure out what's going on, in a short debugging session, but we stopped as it should go away in the next refactoring.
In my unstructured sir -> naive example I can assign sir.LocationType
to a field which requires a naive.LocationType
.
is_connectivity
maybe has_connectivities
(has_iterationspace
)
type for max_neighbors etc
move to mesh.hpp and define LocationType tags (namespace topology
)
Currently there is no way to distinguish Node
s with the same name from a different dialect.
In #49 I disabled mypy again as there was an error I didn't know how to fix.
Currently we only validate a Node on construction, but not if a field is assigned.
For validator
s this can be enabled in pydantic's config by setting
validate_assignment = True
However it seems this doesn't apply to root_validator
s. Bug in pydantic?
Finish lowering from GTIR to cuda code generation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.