Skip to content

Commit

Permalink
August Improvements (#195)
Browse files Browse the repository at this point in the history
Co-authored-by: Tal Ben-Nun <tbennun@users.noreply.github.com>
  • Loading branch information
phschaad and tbennun authored Sep 24, 2022
1 parent 61047c3 commit 23da88a
Show file tree
Hide file tree
Showing 22 changed files with 2,224 additions and 1,209 deletions.
19 changes: 16 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Change Log

## Pre-Release (1.3.1)
## Pre-Release (1.3.2)

- Allow changing the editor layout through the UI
- Improve the behavior of the information side panel
- Allow closing the information side panel
- Zoom to affected nodes when selecting a transformation
- Allow the minimap to be disabled through the UI
- Group transformations by type
- Allow all transformations of a certain type to be applied at once
- Fix a number of bugs related to property editing
- Allow configuring of default custom transformation directories
- Fix and improve Go-To-Source and Go-To-Generated-Code functionality

## 1.2

### 1.2.1

- Allow offline editing of SDFGs (adding / deleting elements etc.)
- Add auto-opening SDFG and instrumentation report preference to the extension
Expand All @@ -10,8 +25,6 @@
- Improved error reporting from the DaCe daemon
- Various bugfixes and improvements

## 1.2

### 1.2.0

- Allow loading of custom transformations
Expand Down
59 changes: 30 additions & 29 deletions backend/dace_vscode/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,42 +128,43 @@ def reapply_history_until(sdfg_json, index):
}


def apply_transformation(sdfg_json, transformation_json):
def apply_transformations(sdfg_json, transformation_json_list):
old_meta = utils.disable_save_metadata()

loaded = utils.load_sdfg_from_json(sdfg_json)
if loaded['error'] is not None:
return loaded['error']
sdfg = loaded['sdfg']

try:
transformation = serialize.from_json(transformation_json)
except Exception as e:
print(traceback.format_exc(), file=sys.stderr)
sys.stderr.flush()
return {
'error': {
'message': 'Failed to parse the applied transformation',
'details': utils.get_exception_message(e),
},
}
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)
else:
transformation.apply_pattern(target_sdfg)
except Exception as e:
print(traceback.format_exc(), file=sys.stderr)
sys.stderr.flush()
return {
'error': {
'message': 'Failed to apply the transformation to the SDFG',
'details': utils.get_exception_message(e),
},
}
for transformation_json in transformation_json_list:
try:
transformation = serialize.from_json(transformation_json)
except Exception as e:
print(traceback.format_exc(), file=sys.stderr)
sys.stderr.flush()
return {
'error': {
'message': 'Failed to parse the applied transformation',
'details': utils.get_exception_message(e),
},
}
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)
else:
transformation.apply_pattern(target_sdfg)
except Exception as e:
print(traceback.format_exc(), file=sys.stderr)
sys.stderr.flush()
return {
'error': {
'message': 'Failed to apply the transformation to the SDFG',
'details': utils.get_exception_message(e),
},
}

new_sdfg = sdfg.to_json()
utils.restore_save_metadata(old_meta)
Expand Down
9 changes: 5 additions & 4 deletions backend/run_dace.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,12 @@ def _add_transformations():
request_json = request.get_json()
return transformations.add_custom_transformations(request_json['paths'])

@daemon.route('/apply_transformation', methods=['POST'])
def _apply_transformation():
@daemon.route('/apply_transformations', methods=['POST'])
def _apply_transformations():
request_json = request.get_json()
return transformations.apply_transformation(
request_json['sdfg'], request_json['transformation'])
return transformations.apply_transformations(
request_json['sdfg'], request_json['transformations']
)

@daemon.route('/expand_library_node', methods=['POST'])
def _expand_library_node():
Expand Down
74 changes: 41 additions & 33 deletions media/components/sdfv/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<script>
// Reference to the VSCode API.
let vscode = undefined;
const SPLIT_DIRECTION = 'vertical';
const MINIMAP_ENABLED = true;
let SPLIT_DIRECTION = 'vertical';
let MINIMAP_ENABLED = true;
</script>

<script src="{{ SCRIPT_SRC }}/pdfkit.standalone.js"></script>
Expand Down Expand Up @@ -152,46 +152,54 @@
</div>
</div>

<div id="split-container" class="split-container-vertical">
<div id="contents">
<div id="processing-overlay">
<div id="processing-overlay-box">
<div id="processing-overlay-spinner-container">
<div id="processing-overlay-spinner">
</div>
</div>
<div id="processing-overlay-msg-container">
<span id="processing-overlay-msg">
</span>
<div id="contents">
<div id="processing-overlay">
<div id="processing-overlay-box">
<div id="processing-overlay-spinner-container">
<div id="processing-overlay-spinner">
</div>
</div>
<div id="processing-overlay-msg-container">
<span id="processing-overlay-msg">
</span>
</div>
</div>
</div>
<div id="info-container">
<div id="info-header">
<div id="info-title-container">
<h5 id="info-title"></h5>
</div>
<div id="goto-source-btn" class="hidden button">
<span>
Go to source
</span>
<div id="expand-info-btn" title="Expand Tray">
<span><i class="material-icons">menu_open</i></span>
</div>
</div>

<div class="offcanvas offcanvas-end"
tabindex="-1" id="info-container"
data-bs-scroll="true"
data-bs-backdrop="false"
aria-labelledby="info-title">
<div class="offcanvas-header" id="info-header">
<div id="info-title-container">
<h5 class="offcanvas-title" id="info-title"></h5>
<div id="title-btns-container">
<div class="hidden button" id="goto-source-btn">
<span>Go to Source</span>
</div>
<div class="hidden button" id="goto-cpp-btn">
<span>Go to Generated Code</span>
</div>
</div>
<div id="goto-cpp-btn" class="hidden button">
<span>
Go to Generated Code
</span>
</div>
<div id="info-header-btn-container">
<div id="layout-toggle-btn" class="vertical"
title="Toggle Layout">
<span><i class="material-icons">splitscreen</i></span>
</div>
<div class="flex-spacer"></div>
<div id="info-clear-btn" class="hidden button">
<span>
Clear Info &times;
</span>
<div id="info-close-btn" title="Close Tray">
<span><i class="material-icons">cancel</i></span>
</div>
<div class="clearfix"></div>
</div>
<div id="info-contents"></div>
</div>
<div class="offcanvas-body" id="info-contents">
</div>
<div class="gutter gutter-vertical" id="info-drag-bar"></div>
</div>

<script src="{{ SCRIPT_SRC }}/sdfv.js"></script>
Expand Down
Loading

0 comments on commit 23da88a

Please sign in to comment.