Skip to content

Commit

Permalink
October improvements (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
phschaad authored Oct 24, 2022
1 parent 23da88a commit d3b3ea8
Show file tree
Hide file tree
Showing 14 changed files with 1,141 additions and 458 deletions.
45 changes: 38 additions & 7 deletions backend/dace_vscode/transformations.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
# All rights reserved.

from email.errors import UndecodableBytesDefect
from dace import nodes, serialize
from dace.transformation.transformation import SubgraphTransformation
from dace.transformation.transformation import (SubgraphTransformation,
TransformationBase)
from dace.transformation.pass_pipeline import Pass, Pipeline
from matplotlib.pyplot import isinteractive
from dace_vscode import utils
import sys
import traceback
Expand Down Expand Up @@ -149,13 +153,25 @@ def apply_transformations(sdfg_json, transformation_json_list):
},
}
try:
target_sdfg = sdfg.sdfg_list[transformation.sdfg_id]
transformation._sdfg = target_sdfg
if isinstance(transformation, SubgraphTransformation):
sdfg.append_transformation(transformation)
transformation.apply(target_sdfg)
if isinstance(transformation, TransformationBase):
target_sdfg = sdfg.sdfg_list[transformation.sdfg_id]
transformation._sdfg = target_sdfg
if isinstance(transformation, SubgraphTransformation):
sdfg.append_transformation(transformation)
transformation.apply(target_sdfg)
else:
transformation.apply_pattern(target_sdfg)
elif isinstance(transformation, Pipeline):
pipeline_results = dict()
transformation.apply_pass(sdfg, pipeline_results)
elif isinstance(transformation, Pass):
# Convert passes to pipelines to ensure all dependencies are
# run.
pipeline_results = dict()
pipeline = Pipeline([transformation])
pipeline.apply_pass(sdfg, pipeline_results)
else:
transformation.apply_pattern(target_sdfg)
raise Exception('Invalid transformation type')
except Exception as e:
print(traceback.format_exc(), file=sys.stderr)
sys.stderr.flush()
Expand Down Expand Up @@ -199,6 +215,7 @@ def get_transformations(sdfg_json, selected_elements, permissive):
# We lazy import DaCe, not to break cyclic imports, but to avoid any large
# delays when booting in daemon mode.
from dace.transformation.optimizer import SDFGOptimizer
from dace.transformation import passes
from dace.sdfg.graph import SubgraphView

old_meta = utils.disable_save_metadata()
Expand All @@ -222,6 +239,20 @@ def get_transformations(sdfg_json, selected_elements, permissive):
transformations.append(transformation.to_json())
docstrings[type(transformation).__name__] = transformation.__doc__

# Obtain available passes.
try:
all_passes = passes.available_passes(False)
for ps in all_passes:
if ps.CATEGORY == 'Helper' or ps.CATEGORY == 'Analysis':
continue
docstrings[ps.__name__] = ps.__doc__
pass_instance = ps()
transformations.append(pass_instance.to_json())
except (NameError, AttributeError):
# Compatibility with legacy versions where no method for getting
# available passes exists.
pass

selected_states = [
utils.sdfg_find_state_from_element(sdfg, n)
for n in selected_elements
Expand Down
2 changes: 1 addition & 1 deletion media/components/sdfv/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
</div>
</div>
</div>
<div id="expand-info-btn" title="Expand Tray">
<div id="expand-info-btn" title="Expand Tray" class="expand-info-btn-top">
<span><i class="material-icons">menu_open</i></span>
</div>
</div>
Expand Down
550 changes: 283 additions & 267 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sdfv",
"displayName": "DaCe SDFG Editor",
"description": "Transform and optimize data-centric programs with a click of a button",
"version": "1.3.2",
"version": "1.3.3",
"engines": {
"vscode": "^1.68.0"
},
Expand Down Expand Up @@ -643,7 +643,7 @@
},
"dependencies": {
"@popperjs/core": "^2.10.1",
"@spcl/sdfv": "^1.0.29",
"@spcl/sdfv": "^1.0.30",
"@types/dagre": "^0.7.46",
"@types/jquery": "^3.5.6",
"bootstrap": "^5.2.0",
Expand Down
4 changes: 4 additions & 0 deletions src/components/sdfg_viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ export class SdfgViewerProvider
'offcanvas offcanvas-end',
'offcanvas offcanvas-bottom'
);
baseHtml = baseHtml.replace(
'expand-info-btn-top',
'expand-info-btn-bottom'
);
baseHtml = baseHtml.replace(
'id="layout-toggle-btn" class="vertical"',
'id="layout-toggle-btn" class="horizontal"'
Expand Down
Loading

0 comments on commit d3b3ea8

Please sign in to comment.