コード例 #1
0
    def _specialize_clusters(cls, clusters, **kwargs):
        options = kwargs['options']
        platform = kwargs['platform']
        sregistry = kwargs['sregistry']

        # Toposort+Fusion (the former to expose more fusion opportunities)
        clusters = fuse(clusters, toposort=True)

        # Hoist and optimize Dimension-invariant sub-expressions
        clusters = cire(clusters, 'invariants', sregistry, options, platform)
        clusters = Lift().process(clusters)

        # Reduce flops (potential arithmetic alterations)
        clusters = extract_increments(clusters, sregistry)
        clusters = cire(clusters, 'sops', sregistry, options, platform)
        clusters = factorize(clusters)
        clusters = optimize_pows(clusters)

        # The previous passes may have created fusion opportunities, which in
        # turn may enable further optimizations
        clusters = fuse(clusters)
        clusters = eliminate_arrays(clusters)

        # Reduce flops (no arithmetic alterations)
        clusters = cse(clusters, sregistry)

        # Blocking to improve data locality
        clusters = Blocking(options).process(clusters)

        return clusters
コード例 #2
0
ファイル: cpu.py プロジェクト: italoaug/devito
    def _make_clusters_passes_mapper(cls, **kwargs):
        options = kwargs['options']
        platform = kwargs['platform']
        sregistry = kwargs['sregistry']

        return {
            'blocking':
            Blocking(options).process,
            'factorize':
            factorize,
            'fuse':
            fuse,
            'lift':
            lambda i: Lift().process(
                cire(i, 'invariants', sregistry, options, platform)),
            'cire-sops':
            lambda i: cire(i, 'sops', sregistry, options, platform),
            'cire-divs':
            lambda i: cire(i, 'divs', sregistry, options, platform),
            'cse':
            lambda i: cse(i, sregistry),
            'opt-pows':
            optimize_pows,
            'topofuse':
            lambda i: fuse(i, toposort=True)
        }
コード例 #3
0
    def _make_clusters_passes_mapper(cls, **kwargs):
        options = kwargs['options']
        platform = kwargs['platform']
        sregistry = kwargs['sregistry']

        runs_on_host, reads_if_on_host = make_callbacks(options)

        return {
            'blocking':
            Blocking(options).process,
            'tasking':
            Tasker(runs_on_host).process,
            'streaming':
            Streaming(reads_if_on_host).process,
            'factorize':
            factorize,
            'fuse':
            fuse,
            'lift':
            lambda i: Lift().process(
                cire(i, 'invariants', sregistry, options, platform)),
            'cire-sops':
            lambda i: cire(i, 'sops', sregistry, options, platform),
            'cse':
            lambda i: cse(i, sregistry),
            'opt-pows':
            optimize_pows,
            'topofuse':
            lambda i: fuse(i, toposort=True)
        }
コード例 #4
0
    def _make_clusters_passes_mapper(cls, **kwargs):
        options = kwargs['options']

        return {
            'blocking': Blocking(options).process,
            'fuse': fuse,
            'topofuse': lambda i: fuse(i, toposort=True)
        }
コード例 #5
0
ファイル: cpu.py プロジェクト: millennial-geoscience/devito
    def _make_clusters_passes_mapper(cls, **kwargs):
        options = kwargs['options']

        return {
            'toposort': Toposort().process,
            'fuse': fuse,
            'blocking': Blocking(options).process,
            # Pre-baked composite passes
            'topofuse': lambda i: fuse(Toposort().process(i))
        }
コード例 #6
0
ファイル: cpu.py プロジェクト: rhodrin/devito
    def _specialize_clusters(cls, clusters, **kwargs):
        """
        Optimize Clusters for better runtime performance.
        """
        options = kwargs['options']
        platform = kwargs['platform']

        # To create temporaries
        counter = generator()
        template = lambda: "r%d" % counter()

        # Toposort+Fusion (the former to expose more fusion opportunities)
        clusters = Toposort().process(clusters)
        clusters = fuse(clusters)

        # Hoist and optimize Dimension-invariant sub-expressions
        clusters = cire(clusters, template, 'invariants', options, platform)
        clusters = Lift().process(clusters)

        # Blocking to improve data locality
        clusters = Blocking(options).process(clusters)

        # Reduce flops (potential arithmetic alterations)
        clusters = extract_increments(clusters, template)
        clusters = cire(clusters, template, 'sops', options, platform)
        clusters = factorize(clusters)
        clusters = optimize_pows(clusters)
        clusters = freeze(clusters)

        # Reduce flops (no arithmetic alterations)
        clusters = cse(clusters, template)

        # The previous passes may have created fusion opportunities, which in
        # turn may enable further optimizations
        clusters = fuse(clusters)
        clusters = eliminate_arrays(clusters, template)
        clusters = scalarize(clusters, template)

        return clusters