Skip to content

Commit

Permalink
Merge branch 'main' into gtir-better-adr
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-paul-mueller authored Jan 29, 2025
2 parents a66c282 + 9be2d2d commit 4a9a5fe
Show file tree
Hide file tree
Showing 138 changed files with 1,353 additions and 1,208 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
python -m build --sdist --wheel --outdir dist/
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: gt4py-dist
path: ./dist/**
Expand All @@ -42,7 +42,7 @@ jobs:
id-token: write
steps:
- name: Download wheel
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: gt4py-dist
path: dist
Expand All @@ -60,7 +60,7 @@ jobs:
id-token: write
steps:
- name: Download wheel
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: gt4py-dist
path: dist
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-eve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
tox run -e eve-py${pyversion_no_dot}
# mv coverage.json coverage-py${{ matrix.python-version }}-${{ matrix.os }}.json
# - name: Upload coverage.json artifact
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# with:
# name: coverage-py${{ matrix.python-version }}-${{ matrix.os }}
# path: coverage-py${{ matrix.python-version }}-${{ matrix.os }}.json
Expand All @@ -64,7 +64,7 @@ jobs:
# echo ${{ github.event.pull_request.head.sha }} >> info.txt
# echo ${{ github.run_id }} >> info.txt
# - name: Upload info artifact
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# with:
# name: info-py${{ matrix.python-version }}-${{ matrix.os }}
# path: info.txt
4 changes: 2 additions & 2 deletions .github/workflows/test-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
tox run -e next-py${pyversion_no_dot}-${{ matrix.tox-factor }}-cpu
# mv coverage.json coverage-py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env-factor }}-cpu.json
# - name: Upload coverage.json artifact
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# with:
# name: coverage-py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env-factor }}-cpu
# path: coverage-py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env-factor }}-cpu.json
Expand All @@ -74,7 +74,7 @@ jobs:
# echo ${{ github.event.pull_request.head.sha }} >> info.txt
# echo ${{ github.run_id }} >> info.txt
# - name: Upload info artifact
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# with:
# name: info-py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env-factor }}-cpu
# path: info.txt
4 changes: 2 additions & 2 deletions .github/workflows/test-storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
tox run -e storage-py${pyversion_no_dot}-${{ matrix.tox-factor }}-cpu
# mv coverage.json coverage-py${{ matrix.python-version }}-${{ matrix.os }}.json
# - name: Upload coverage.json artifact
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# with:
# name: coverage-py${{ matrix.python-version }}-${{ matrix.os }}
# path: coverage-py${{ matrix.python-version }}-${{ matrix.os }}.json
Expand All @@ -66,7 +66,7 @@ jobs:
# echo ${{ github.event.pull_request.head.sha }} >> info.txt
# echo ${{ github.run_id }} >> info.txt
# - name: Upload info artifact
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# with:
# name: info-py${{ matrix.python-version }}-${{ matrix.os }}
# path: info.txt
22 changes: 11 additions & 11 deletions ci/cscs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@ build_py310_image_aarch64:
SLURM_TIMELIMIT: 15
NUM_PROCESSES: auto
VIRTUALENV_SYSTEM_SITE_PACKAGES: 1
.test_helper_x86_64:
extends: [.container-runner-daint-gpu, .test_helper]
parallel:
matrix:
- SUBPACKAGE: [cartesian, storage]
VARIANT: [-internal, -dace]
SUBVARIANT: [-cuda11x, -cpu]
- SUBPACKAGE: eve
- SUBPACKAGE: next
VARIANT: [-nomesh, -atlas]
SUBVARIANT: [-cuda11x, -cpu]
# .test_helper_x86_64:
# extends: [.container-runner-daint-gpu, .test_helper]
# parallel:
# matrix:
# - SUBPACKAGE: [cartesian, storage]
# VARIANT: [-internal, -dace]
# SUBVARIANT: [-cuda11x, -cpu]
# - SUBPACKAGE: eve
# - SUBPACKAGE: next
# VARIANT: [-nomesh, -atlas]
# SUBVARIANT: [-cuda11x, -cpu]
.test_helper_aarch64:
extends: [.container-runner-daint-gh200, .test_helper]
parallel:
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ allow_incomplete_defs = true
allow_untyped_defs = true
follow_imports = 'silent'
module = 'gt4py.cartesian.*'
warn_unused_ignores = false

[[tool.mypy.overrides]]
ignore_errors = true
Expand Down
2 changes: 1 addition & 1 deletion src/gt4py/cartesian/backend/cuda_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class CudaBackend(BaseGTBackend, CLIBackendMixin):
}
languages = {"computation": "cuda", "bindings": ["python"]}
storage_info = gt_storage.layout.CUDALayout
PYEXT_GENERATOR_CLASS = CudaExtGenerator # type: ignore
PYEXT_GENERATOR_CLASS = CudaExtGenerator
MODULE_GENERATOR_CLASS = CUDAPyExtModuleGenerator
GT_BACKEND_T = "gpu"

Expand Down
2 changes: 1 addition & 1 deletion src/gt4py/cartesian/backend/dace_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ class DaCeCUDAPyExtModuleGenerator(DaCePyExtModuleGenerator, CUDAPyExtModuleGene

class BaseDaceBackend(BaseGTBackend, CLIBackendMixin):
GT_BACKEND_T = "dace"
PYEXT_GENERATOR_CLASS = DaCeExtGenerator # type: ignore
PYEXT_GENERATOR_CLASS = DaCeExtGenerator

def generate(self) -> Type[StencilObject]:
self.check_options(self.builder.options)
Expand Down
2 changes: 1 addition & 1 deletion src/gt4py/cartesian/backend/gtcpp_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def apply(cls, root, *, module_name="stencil", **kwargs) -> str:

class GTBaseBackend(BaseGTBackend, CLIBackendMixin):
options = BaseGTBackend.GT_BACKEND_OPTS
PYEXT_GENERATOR_CLASS = GTExtGenerator # type: ignore
PYEXT_GENERATOR_CLASS = GTExtGenerator

def _generate_extension(self, uses_cuda: bool) -> Tuple[str, str]:
return self.make_extension(stencil_ir=self.builder.gtir, uses_cuda=uses_cuda)
Expand Down
4 changes: 1 addition & 3 deletions src/gt4py/cartesian/backend/module_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def parameter_names(self) -> Set[str]:
def make_args_data_from_gtir(pipeline: GtirPipeline) -> ModuleData:
"""
Compute module data containing information about stencil arguments from gtir.
This is no longer compatible with the legacy backends.
"""
if pipeline.stencil_id in _args_data_cache:
return _args_data_cache[pipeline.stencil_id]
Expand Down Expand Up @@ -142,7 +140,7 @@ def __call__(
"""
Generate source code for a Python module containing a StencilObject.
A possible reaosn for extending is processing additional kwargs,
A possible reason for extending is processing additional kwargs,
using a different template might require completely overriding.
"""
if builder:
Expand Down
2 changes: 1 addition & 1 deletion src/gt4py/cartesian/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def generate_cache_info(self) -> Dict[str, Any]:
"""
Generate the cache info dict.
Backend specific additions can be added via a hook propery on the backend instance.
Backend specific additions can be added via a hook properly on the backend instance.
Override :py:meth:`gt4py.backend.base.Backend.extra_cache_info` to store extra
info.
"""
Expand Down
1 change: 0 additions & 1 deletion src/gt4py/cartesian/frontend/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@
parameters: List[VarDecl],
computations: List[ComputationBlock],
[externals: Dict[str, Any], sources: Dict[str, str]])
"""

from __future__ import annotations
Expand Down
12 changes: 6 additions & 6 deletions src/gt4py/cartesian/gtc/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class GTCPreconditionError(eve.exceptions.EveError, RuntimeError):
message_template = "GTC pass precondition error: [{info}]"

def __init__(self, *, expected: str, **kwargs: Any) -> None:
super().__init__(expected=expected, **kwargs) # type: ignore
super().__init__(expected=expected, **kwargs)


class GTCPostconditionError(eve.exceptions.EveError, RuntimeError):
message_template = "GTC pass postcondition error: [{info}]"

def __init__(self, *, expected: str, **kwargs: Any) -> None:
super().__init__(expected=expected, **kwargs) # type: ignore
super().__init__(expected=expected, **kwargs)


class AssignmentKind(eve.StrEnum):
Expand All @@ -60,7 +60,7 @@ class AssignmentKind(eve.StrEnum):

@enum.unique
class UnaryOperator(eve.StrEnum):
"""Unary operator indentifier."""
"""Unary operator identifier."""

POS = "+"
NEG = "-"
Expand Down Expand Up @@ -267,7 +267,7 @@ def verify_and_get_common_dtype(
) -> Optional[DataType]:
assert len(exprs) > 0
if all(e.dtype is not DataType.AUTO for e in exprs):
dtypes: List[DataType] = [e.dtype for e in exprs] # type: ignore # guaranteed to be not None
dtypes: List[DataType] = [e.dtype for e in exprs] # guaranteed to be not None
dtype = dtypes[0]
if strict:
if all(dt == dtype for dt in dtypes):
Expand Down Expand Up @@ -908,7 +908,7 @@ def op_to_ufunc(
@functools.lru_cache(maxsize=None)
def typestr_to_data_type(typestr: str) -> DataType:
if not isinstance(typestr, str) or len(typestr) < 3 or not typestr[2:].isnumeric():
return DataType.INVALID # type: ignore
return DataType.INVALID
table = {
("b", 1): DataType.BOOL,
("i", 1): DataType.INT8,
Expand All @@ -919,4 +919,4 @@ def typestr_to_data_type(typestr: str) -> DataType:
("f", 8): DataType.FLOAT64,
}
key = (typestr[1], int(typestr[2:]))
return table.get(key, DataType.INVALID) # type: ignore
return table.get(key, DataType.INVALID)
8 changes: 4 additions & 4 deletions src/gt4py/cartesian/gtc/cuir/cuir.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ class Stmt(common.Stmt):
pass


class Literal(common.Literal, Expr): # type: ignore
class Literal(common.Literal, Expr):
pass


class ScalarAccess(common.ScalarAccess, Expr): # type: ignore
class ScalarAccess(common.ScalarAccess, Expr):
pass


class VariableKOffset(common.VariableKOffset[Expr]):
pass


class FieldAccess(common.FieldAccess[Expr, VariableKOffset], Expr): # type: ignore
class FieldAccess(common.FieldAccess[Expr, VariableKOffset], Expr):
pass


Expand Down Expand Up @@ -113,7 +113,7 @@ class TernaryOp(common.TernaryOp[Expr], Expr):
_dtype_propagation = common.ternary_op_dtype_propagation(strict=True)


class Cast(common.Cast[Expr], Expr): # type: ignore
class Cast(common.Cast[Expr], Expr):
pass


Expand Down
2 changes: 1 addition & 1 deletion src/gt4py/cartesian/gtc/cuir/cuir_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def ctype(symbol: str) -> str:
@classmethod
def apply(cls, root: LeafNode, **kwargs: Any) -> str:
if not isinstance(root, cuir.Program):
raise ValueError("apply() requires gtcpp.Progam root node")
raise ValueError("apply() requires gtcpp.Program root node")
generated_code = super().apply(root, **kwargs)
if kwargs.get("format_source", True):
generated_code = codegen.format_source("cpp", generated_code, style="LLVM")
Expand Down
2 changes: 1 addition & 1 deletion src/gt4py/cartesian/gtc/dace/daceir.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ class TernaryOp(common.TernaryOp[Expr], Expr):
_dtype_propagation = common.ternary_op_dtype_propagation(strict=True)


class Cast(common.Cast[Expr], Expr): # type: ignore
class Cast(common.Cast[Expr], Expr):
pass


Expand Down
8 changes: 1 addition & 7 deletions src/gt4py/cartesian/gtc/dace/expansion/daceir_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,10 @@ def visit_HorizontalExecution(
global_ctx: DaCeIRBuilder.GlobalContext,
iteration_ctx: DaCeIRBuilder.IterationContext,
symbol_collector: DaCeIRBuilder.SymbolCollector,
loop_order,
k_interval,
**kwargs: Any,
):
# skip type checking due to https://github.com/python/mypy/issues/5485
extent = global_ctx.library_node.get_extents(node) # type: ignore
extent = global_ctx.library_node.get_extents(node)
decls = [self.visit(decl, **kwargs) for decl in node.declarations]
targets: Set[str] = set()
stmts = [
Expand Down Expand Up @@ -522,7 +520,6 @@ def visit_VerticalLoopSection(
self,
node: oir.VerticalLoopSection,
*,
loop_order,
iteration_ctx: DaCeIRBuilder.IterationContext,
global_ctx: DaCeIRBuilder.GlobalContext,
symbol_collector: DaCeIRBuilder.SymbolCollector,
Expand All @@ -546,7 +543,6 @@ def visit_VerticalLoopSection(
iteration_ctx=iteration_ctx,
global_ctx=global_ctx,
symbol_collector=symbol_collector,
loop_order=loop_order,
k_interval=node.interval,
**kwargs,
)
Expand Down Expand Up @@ -723,7 +719,6 @@ def _process_loop_item(
scope_nodes,
item: Loop,
*,
global_ctx: DaCeIRBuilder.GlobalContext,
iteration_ctx: DaCeIRBuilder.IterationContext,
symbol_collector: DaCeIRBuilder.SymbolCollector,
**kwargs: Any,
Expand Down Expand Up @@ -840,7 +835,6 @@ def visit_VerticalLoop(
sections = flatten_list(
self.generic_visit(
node.sections,
loop_order=node.loop_order,
global_ctx=global_ctx,
iteration_ctx=iteration_ctx,
symbol_collector=symbol_collector,
Expand Down
1 change: 0 additions & 1 deletion src/gt4py/cartesian/gtc/dace/expansion/expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def _fix_context(
* change connector names to match inner array name (before expansion prefixed to satisfy uniqueness)
* change in- and out-edges' subsets so that they have the same shape as the corresponding array inside
* determine the domain size based on edges to StencilComputation
"""
# change connector names
for in_edge in parent_state.in_edges(node):
Expand Down
4 changes: 2 additions & 2 deletions src/gt4py/cartesian/gtc/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __add__(self, other):
return self._apply(self._broadcast(other), operator.add)

def __sub__(self, other):
"""Element-wise substraction."""
"""Element-wise subtraction."""
return self._apply(self._broadcast(other), operator.sub)

def __mul__(self, other):
Expand Down Expand Up @@ -335,7 +335,7 @@ def __add__(self, other):
return self._apply(self._broadcast(other), lambda a, b: a + b)

def __sub__(self, other):
"""Element-wise substraction."""
"""Element-wise subtraction."""
return self._apply(self._broadcast(other), lambda a, b: a - b)

def __and__(self, other):
Expand Down
8 changes: 4 additions & 4 deletions src/gt4py/cartesian/gtc/gtcpp/gtcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ class Offset(common.CartesianOffset):
pass


class Literal(common.Literal, Expr): # type: ignore
class Literal(common.Literal, Expr):
pass


class LocalAccess(common.ScalarAccess, Expr): # type: ignore
class LocalAccess(common.ScalarAccess, Expr):
pass


class VariableKOffset(common.VariableKOffset[Expr]):
pass


class AccessorRef(common.FieldAccess[Expr, VariableKOffset], Expr): # type: ignore
class AccessorRef(common.FieldAccess[Expr, VariableKOffset], Expr):
pass


Expand Down Expand Up @@ -88,7 +88,7 @@ class NativeFuncCall(common.NativeFuncCall[Expr], Expr):
_dtype_propagation = common.native_func_call_dtype_propagation(strict=True)


class Cast(common.Cast[Expr], Expr): # type: ignore
class Cast(common.Cast[Expr], Expr):
pass


Expand Down
Loading

0 comments on commit 4a9a5fe

Please sign in to comment.