Skip to content

Commit

Permalink
July Improvements 1/2 (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
phschaad authored Jul 12, 2022
1 parent 1fdeabb commit 981916f
Show file tree
Hide file tree
Showing 57 changed files with 294 additions and 129 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2020-2021, Scalable Parallel Computing Lab, ETH Zurich, and all contributors listed in AUTHORS
Copyright (c) 2020-2022, Scalable Parallel Computing Lab, ETH Zurich, and all contributors listed in AUTHORS
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand All @@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion backend/dace_vscode/arith_ops.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
# Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
# All rights reserved.

import ast
Expand Down
2 changes: 1 addition & 1 deletion backend/dace_vscode/editing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
# Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
# All rights reserved.

from dace import (
Expand Down
2 changes: 1 addition & 1 deletion backend/dace_vscode/transformations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
# Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
# All rights reserved.

from dace import nodes, serialize
Expand Down
2 changes: 1 addition & 1 deletion backend/dace_vscode/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
# Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
# All rights reserved.

from dace import SDFG, SDFGState, nodes, serialize
Expand Down
36 changes: 35 additions & 1 deletion backend/run_dace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
# Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
# All rights reserved.

#####################################################################
Expand Down Expand Up @@ -281,6 +281,35 @@ def compile_sdfg(path, suppress_instrumentation=False):
}


def specialize_sdfg(path, symbol_map, remove_undef=True):
old_meta = disable_save_metadata()

loaded = load_sdfg_from_file(path)
if loaded['error'] is not None:
return loaded['error']
sdfg: dace.sdfg.SDFG = loaded['sdfg']

sdfg.specialize(symbol_map)

# Remove any constants that are not defined anymore in the symbol map, if
# the remove_undef flag is set.
if remove_undef:
delkeys = set()
for key in sdfg.constants_prop:
if (key not in symbol_map or symbol_map[key] is None or
symbol_map[key] == 0):
delkeys.add(key)
for key in delkeys:
del sdfg.constants_prop[key]

ret_sdfg = sdfg.to_json()

restore_save_metadata(old_meta)
return {
'sdfg': ret_sdfg,
}


def run_daemon(port):
from logging.config import dictConfig
from flask import Flask, request
Expand Down Expand Up @@ -356,6 +385,11 @@ def _compile_sdfg_from_file():
return compile_sdfg(request_json['path'],
request_json['suppress_instrumentation'])

@daemon.route('/specialize_sdfg', methods=['POST'])
def _specialize_sdfg():
request_json = request.get_json()
return specialize_sdfg(request_json['path'], request_json['symbol_map'])

@daemon.route('/insert_sdfg_element', methods=['POST'])
def _insert_sdfg_element():
request_json = request.get_json()
Expand Down
7 changes: 5 additions & 2 deletions media/components/analysis/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors. -->
<!-- Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors. -->
<!-- All rights reserved. -->

<!DOCTYPE html>
Expand Down Expand Up @@ -184,11 +184,14 @@
</div>
<hr class="horizontal-divider">
<div id="symbol-list">
<span>
<span id="symbol-list-title">
Symbol list:
</span>
<table id="symbol-table">
</table>
<div id="specialize-btn" class="btn btn-primary">
Specialize SDFG
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion media/components/breakpoints/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors. -->
<!-- Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors. -->
<!-- All rights reserved. -->

<!DOCTYPE html>
Expand Down
2 changes: 1 addition & 1 deletion media/components/history/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors. -->
<!-- Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors. -->
<!-- All rights reserved. -->

<!DOCTYPE html>
Expand Down
2 changes: 1 addition & 1 deletion media/components/outline/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors. -->
<!-- Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors. -->
<!-- All rights reserved. -->

<!DOCTYPE html>
Expand Down
3 changes: 2 additions & 1 deletion media/components/sdfv/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors. -->
<!-- Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors. -->
<!-- All rights reserved. -->

<!DOCTYPE html>
Expand All @@ -13,6 +13,7 @@
// Reference to the VSCode API.
let vscode = undefined;
const SPLIT_DIRECTION = 'vertical';
const MINIMAP_ENABLED = true;
</script>

<script src="{{ SCRIPT_SRC }}/pdfkit.standalone.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion media/components/transformations/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors. -->
<!-- Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors. -->
<!-- All rights reserved. -->

<!DOCTYPE html>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 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.1.3",
"version": "1.3.0",
"engines": {
"vscode": "^1.68.0"
},
Expand Down Expand Up @@ -38,6 +38,15 @@
"extensionDependencies": [
"benjamin-simmonds.pythoncpp-debug"
],
"capabilities": {
"untrustedWorkspaces": {
"supported": "limited",
"restrictedConfigurations": [
"dace.backend.interpreterPath"
],
"description": "Certain functionality, like executing or transforming SDFGs, might be unavailable in untrusted workspaces to keep you safe."
}
},
"contributes": {
"debuggers": [
{
Expand Down Expand Up @@ -168,6 +177,11 @@
"Split the SDFG Optimizer layout vertically"
]
},
"dace.sdfv.minimap": {
"type": "boolean",
"default": true,
"description": "Show a minimap in the top right corner of the SDFG editor"
},
"dace.backend.interpreterPath": {
"type": "string",
"default": "",
Expand Down Expand Up @@ -492,7 +506,7 @@
{
"command": "sdfg.compile",
"group": "navigation@0",
"when": "resourceLangId == sdfg"
"when": "resourceLangId == sdfg && isWorkspaceTrusted"
}
],
"editor/context": [
Expand Down Expand Up @@ -520,12 +534,12 @@
"view/title": [
{
"command": "transformationList.addCustom",
"when": "view == transformationList",
"when": "view == transformationList && isWorkspaceTrusted",
"group": "navigation"
},
{
"command": "transformationList.addCustomFromDir",
"when": "view == transformationList",
"when": "view == transformationList && isWorkspaceTrusted",
"group": "navigation"
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/analysis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
// Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
// All rights reserved.

import * as path from 'path';
Expand Down
2 changes: 1 addition & 1 deletion src/components/base_component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
// Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
// All rights reserved.

import * as vscode from 'vscode';
Expand Down
2 changes: 1 addition & 1 deletion src/components/messaging/component_message_handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
// Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
// All rights reserved.

import * as vscode from 'vscode';
Expand Down
2 changes: 1 addition & 1 deletion src/components/messaging/message_receiver_interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
// Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
// All rights reserved.

import * as vscode from 'vscode';
Expand Down
2 changes: 1 addition & 1 deletion src/components/optimization_panel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
// Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
// All rights reserved.

import { AnalysisProvider } from './analysis';
Expand Down
2 changes: 1 addition & 1 deletion src/components/outline.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
// Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
// All rights reserved.

import * as path from 'path';
Expand Down
2 changes: 1 addition & 1 deletion src/components/sdfg_breakpoints.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
// Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
// All rights reserved.

import * as path from 'path';
Expand Down
16 changes: 10 additions & 6 deletions src/components/sdfg_viewer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
// Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
// All rights reserved.

import * as path from 'path';
Expand Down Expand Up @@ -505,11 +505,10 @@ export class SdfgViewerProvider
);

// If the settings indicate it, split the webview vertically and put
// the info container to the right instead of at the bottom.
if (vscode.workspace.getConfiguration(
'dace.sdfv'
).layout === 'vertical'
) {
// the info container to the right instead of at the bottom. Also hide
// the minimap if the settings say so.
const sdfvConfig = vscode.workspace.getConfiguration('dace.sdfv');
if (sdfvConfig?.get<string>('layout') === 'vertical') {
baseHtml = baseHtml.replace(
'<div id="split-container" class="split-container-vertical">',
'<div id="split-container" style="display: flex;" class="split-container-horizontal">'
Expand All @@ -519,6 +518,11 @@ export class SdfgViewerProvider
'SPLIT_DIRECTION = \'horizontal\';'
);
}
if (sdfvConfig?.get<boolean>('minimap') === false)
baseHtml = baseHtml.replace(
'MINIMAP_ENABLED = true;',
'MINIMAP_ENABLED = false;'
);

return baseHtml;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/transformation_history.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
// Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
// All rights reserved.

import * as path from 'path';
Expand Down
2 changes: 1 addition & 1 deletion src/components/transformation_list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
// Copyright 2020-2022 ETH Zurich and the DaCe-VSCode authors.
// All rights reserved.

import * as path from 'path';
Expand Down
Loading

0 comments on commit 981916f

Please sign in to comment.