Skip to content

Commit

Permalink
Merge pull request #91 from xdslproject/refactor_snips
Browse files Browse the repository at this point in the history
misc: More cleanup
  • Loading branch information
georgebisbas authored May 20, 2024
2 parents ee13310 + 00f17ac commit 2045d4b
Show file tree
Hide file tree
Showing 13 changed files with 182 additions and 338 deletions.
113 changes: 0 additions & 113 deletions 2d5pt.py

This file was deleted.

4 changes: 0 additions & 4 deletions devito/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
# Apply monkey-patching while we wait for our patches to be upstreamed and released
from devito.mpatches import * # noqa


# Imports from xdsl
# from devito.xdslpasses import * # noqa

from ._version import get_versions # noqa
__version__ = get_versions()['version']
del get_versions
Expand Down
16 changes: 8 additions & 8 deletions devito/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@
operator_registry.add(Cpu64AdvCOperator, Cpu64, 'advanced', 'C')
operator_registry.add(Cpu64AdvOmpOperator, Cpu64, 'advanced', 'openmp')

operator_registry.add(XdslnoopOperator, Cpu64, 'xdsl-noop', 'C')
# to change
operator_registry.add(XdslAdvOperator, Cpu64, 'xdsl-noop', 'openmp')

operator_registry.add(XdslAdvOperator, Cpu64, 'xdsl', 'C')
operator_registry.add(XdslAdvOperator, Cpu64, 'xdsl', 'openmp')
operator_registry.add(XdslAdvDeviceOperator, Device, 'xdsl', 'openacc')

operator_registry.add(Cpu64FsgCOperator, Cpu64, 'advanced-fsg', 'C')
operator_registry.add(Cpu64FsgOmpOperator, Cpu64, 'advanced-fsg', 'openmp')

Expand Down Expand Up @@ -63,3 +55,11 @@
operator_registry.add(DeviceFsgOmpOperator, Device, 'advanced-fsg', 'C')
operator_registry.add(DeviceFsgOmpOperator, Device, 'advanced-fsg', 'openmp')
operator_registry.add(DeviceFsgAccOperator, Device, 'advanced-fsg', 'openacc')

# Register XDSL Operators
operator_registry.add(XdslnoopOperator, Cpu64, 'xdsl-noop', 'C')
operator_registry.add(XdslAdvOperator, Cpu64, 'xdsl-noop', 'openmp')

operator_registry.add(XdslAdvOperator, Cpu64, 'xdsl', 'C')
operator_registry.add(XdslAdvOperator, Cpu64, 'xdsl', 'openmp')
operator_registry.add(XdslAdvDeviceOperator, Device, 'xdsl', 'openacc')
40 changes: 19 additions & 21 deletions devito/core/cpu.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
from collections import OrderedDict
from contextlib import redirect_stdout
import ctypes
import io
import os
import sys
import subprocess
import ctypes
import sys
import tempfile

from io import StringIO
from collections import OrderedDict

from functools import partial
from typing import Iterable

from devito.core.operator import CoreOperator, CustomOperator, ParTile
from devito.exceptions import InvalidOperator
from devito.passes.equations import collect_derivatives
from devito.passes.clusters import (Lift, blocking, buffering, cire, cse,
factorize, fission, fuse, optimize_pows,
optimize_hyperplanes)
from devito.passes.iet import (CTarget, OmpTarget, avoid_denormals, linearize, mpiize,
hoist_prodders, relax_incr_dimensions)
from devito.mpi import MPI
from devito.tools import timed_pass

from devito.ir.iet import Callable, MetaCall
from devito.logger import info, perf
from devito.mpi import MPI
from devito.operator.profiling import create_profile
from devito.ir.iet import Callable, MetaCall

from devito.tools import flatten, filter_sorted, OrderedSet

from devito.ir.ietxdsl.cluster_to_ssa import (ExtractDevitoStencilConversion,
apply_timers,
finalize_module_with_globals) # noqa

from devito.passes.equations import collect_derivatives
from devito.tools import filter_sorted, flatten, OrderedSet
from devito.types import TimeFunction
from devito.types.dense import DiscreteFunction, Function
from devito.types.mlir_types import ptr_of, f32
from devito.types.mlir_types import f32, ptr_of
from devito.tools import timed_pass

from xdsl.printer import Printer
from xdsl.xdsl_opt_main import xDSLOptMain

from devito.ir.ietxdsl.cluster_to_ssa import (ExtractDevitoStencilConversion,
finalize_module_with_globals) # noqa

from devito.ir.ietxdsl.profiling import apply_timers
from devito.passes.clusters import (Lift, blocking, buffering, cire, cse,
factorize, fission, fuse, optimize_hyperplanes,
optimize_pows)
from devito.passes.iet import (CTarget, OmpTarget, avoid_denormals, hoist_prodders,
linearize, mpiize, relax_incr_dimensions)


__all__ = ['Cpu64NoopCOperator', 'Cpu64NoopOmpOperator', 'Cpu64AdvCOperator',
'Cpu64AdvOmpOperator', 'Cpu64FsgCOperator', 'Cpu64FsgOmpOperator',
Expand Down
2 changes: 0 additions & 2 deletions devito/finite_differences/differentiable.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ def __eq__(self, other):
return False
return all(getattr(self, i, None) == getattr(other, i, None)
for i in self.__rkwargs__)
return super(Differentiable, self).__eq__(other) is True and\
all(getattr(self, i, None) == getattr(other, i, None) for i in self._state)

@property
def name(self):
Expand Down
58 changes: 1 addition & 57 deletions devito/ir/iet/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
'AugmentedExpression', 'Increment', 'Return', 'While',
'ParallelIteration', 'ParallelBlock', 'Dereference', 'Lambda',
'SyncSpot', 'Pragma', 'DummyExpr', 'BlankLine', 'ParallelTree',
'BusyWait', 'CallableBody', 'Transfer', 'XDSLCallable']
'BusyWait', 'CallableBody', 'Transfer']

# First-class IET nodes

Expand Down Expand Up @@ -729,62 +729,6 @@ def defines(self):
return self.all_parameters


class XDSLCallable(Node):

"""
A callable function.
Parameters
----------
name : str
The name of the callable.
body : Node or list of Node
The Callable body.
retval : str
The return type of the Callable.
parameters : list of Basic, optional
The objects in input to the Callable.
prefix : list of str, optional
Qualifiers to prepend to the Callable signature. None by defaults.
templates : list of Basic, optional
The template parameters of the Callable.
"""

is_Callable = True

_traversable = ['body']

def __init__(self, name, parameters=None, prefix=None,
templates=None):
self.name = name
# if not isinstance(body, CallableBody):
# self.body = CallableBody(body)
# else:
# self.body = body
# self.retval = retval
self.prefix = as_tuple(prefix)
self.parameters = as_tuple(parameters)
self.templates = as_tuple(templates)

def __repr__(self):
param_types = [ctypes_to_cstr(i._C_ctype) for i in self.parameters]
return "%s[%s]<%s; %s>" % (self.__class__.__name__, self.name, self.retval,
",".join(param_types))

@property
def all_parameters(self):
return self.parameters + self.templates

@property
def functions(self):
return tuple(i.function for i in self.all_parameters
if isinstance(i.function, AbstractFunction))

@property
def defines(self):
return self.all_parameters


class CallableBody(Node):

"""
Expand Down
5 changes: 3 additions & 2 deletions devito/ir/ietxdsl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from devito.ir.ietxdsl.cluster_to_ssa import (finalize_module_with_globals,
apply_timers)
from devito.ir.ietxdsl.cluster_to_ssa import finalize_module_with_globals

from devito.ir.ietxdsl.profiling import apply_timers

# flake8: noqa
Loading

0 comments on commit 2045d4b

Please sign in to comment.