diff --git a/LICENSE b/LICENSE
index 50851f29..85e2bf4f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -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
@@ -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.
\ No newline at end of file
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/backend/dace_vscode/arith_ops.py b/backend/dace_vscode/arith_ops.py
index 62388339..faf56c72 100644
--- a/backend/dace_vscode/arith_ops.py
+++ b/backend/dace_vscode/arith_ops.py
@@ -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
diff --git a/backend/dace_vscode/editing.py b/backend/dace_vscode/editing.py
index f34441cd..db41fff4 100644
--- a/backend/dace_vscode/editing.py
+++ b/backend/dace_vscode/editing.py
@@ -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 (
diff --git a/backend/dace_vscode/transformations.py b/backend/dace_vscode/transformations.py
index 1f48d8f4..0c6d90c9 100644
--- a/backend/dace_vscode/transformations.py
+++ b/backend/dace_vscode/transformations.py
@@ -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
diff --git a/backend/dace_vscode/utils.py b/backend/dace_vscode/utils.py
index e337b76b..3b75a8be 100644
--- a/backend/dace_vscode/utils.py
+++ b/backend/dace_vscode/utils.py
@@ -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
diff --git a/backend/run_dace.py b/backend/run_dace.py
index 0c85b142..89adf3b6 100644
--- a/backend/run_dace.py
+++ b/backend/run_dace.py
@@ -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.
#####################################################################
@@ -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
@@ -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()
diff --git a/media/components/analysis/index.html b/media/components/analysis/index.html
index 7471ca0c..e025eb5d 100644
--- a/media/components/analysis/index.html
+++ b/media/components/analysis/index.html
@@ -1,4 +1,4 @@
-
+
@@ -184,11 +184,14 @@
-
+
Symbol list:
+
+ Specialize SDFG
+
diff --git a/media/components/breakpoints/index.html b/media/components/breakpoints/index.html
index 27827bcb..983514a2 100644
--- a/media/components/breakpoints/index.html
+++ b/media/components/breakpoints/index.html
@@ -1,4 +1,4 @@
-
+
diff --git a/media/components/history/index.html b/media/components/history/index.html
index c302ac57..01e4ccbc 100644
--- a/media/components/history/index.html
+++ b/media/components/history/index.html
@@ -1,4 +1,4 @@
-
+
diff --git a/media/components/outline/index.html b/media/components/outline/index.html
index 53c3419e..3d74c09c 100644
--- a/media/components/outline/index.html
+++ b/media/components/outline/index.html
@@ -1,4 +1,4 @@
-
+
diff --git a/media/components/sdfv/index.html b/media/components/sdfv/index.html
index 842aaa2b..bae6fdf8 100644
--- a/media/components/sdfv/index.html
+++ b/media/components/sdfv/index.html
@@ -1,4 +1,4 @@
-
+
@@ -13,6 +13,7 @@
// Reference to the VSCode API.
let vscode = undefined;
const SPLIT_DIRECTION = 'vertical';
+ const MINIMAP_ENABLED = true;
diff --git a/media/components/transformations/index.html b/media/components/transformations/index.html
index 9af5722f..1bddc254 100644
--- a/media/components/transformations/index.html
+++ b/media/components/transformations/index.html
@@ -1,4 +1,4 @@
-
+
diff --git a/package-lock.json b/package-lock.json
index 67621297..679f9d49 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "sdfv",
- "version": "1.1.3",
+ "version": "1.3.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "sdfv",
- "version": "1.1.3",
+ "version": "1.3.0",
"dependencies": {
"@popperjs/core": "^2.10.1",
"@spcl/sdfv": "^1.0.0",
diff --git a/package.json b/package.json
index 741de519..eb87ee1c 100644
--- a/package.json
+++ b/package.json
@@ -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"
},
@@ -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": [
{
@@ -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": "",
@@ -492,7 +506,7 @@
{
"command": "sdfg.compile",
"group": "navigation@0",
- "when": "resourceLangId == sdfg"
+ "when": "resourceLangId == sdfg && isWorkspaceTrusted"
}
],
"editor/context": [
@@ -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"
},
{
diff --git a/src/components/analysis.ts b/src/components/analysis.ts
index 79f1fcc0..9b924df5 100644
--- a/src/components/analysis.ts
+++ b/src/components/analysis.ts
@@ -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';
diff --git a/src/components/base_component.ts b/src/components/base_component.ts
index aa3da4b4..8c4044a5 100644
--- a/src/components/base_component.ts
+++ b/src/components/base_component.ts
@@ -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';
diff --git a/src/components/messaging/component_message_handler.ts b/src/components/messaging/component_message_handler.ts
index 7256e4c3..980eee5a 100644
--- a/src/components/messaging/component_message_handler.ts
+++ b/src/components/messaging/component_message_handler.ts
@@ -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';
diff --git a/src/components/messaging/message_receiver_interface.ts b/src/components/messaging/message_receiver_interface.ts
index e1a65008..9be6f494 100644
--- a/src/components/messaging/message_receiver_interface.ts
+++ b/src/components/messaging/message_receiver_interface.ts
@@ -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';
diff --git a/src/components/optimization_panel.ts b/src/components/optimization_panel.ts
index bb6787eb..abd0279c 100644
--- a/src/components/optimization_panel.ts
+++ b/src/components/optimization_panel.ts
@@ -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';
diff --git a/src/components/outline.ts b/src/components/outline.ts
index f24d0219..8d1909cc 100644
--- a/src/components/outline.ts
+++ b/src/components/outline.ts
@@ -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';
diff --git a/src/components/sdfg_breakpoints.ts b/src/components/sdfg_breakpoints.ts
index 7e77c6d3..02c36c87 100644
--- a/src/components/sdfg_breakpoints.ts
+++ b/src/components/sdfg_breakpoints.ts
@@ -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';
diff --git a/src/components/sdfg_viewer.ts b/src/components/sdfg_viewer.ts
index 22161894..73d9879b 100644
--- a/src/components/sdfg_viewer.ts
+++ b/src/components/sdfg_viewer.ts
@@ -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';
@@ -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('layout') === 'vertical') {
baseHtml = baseHtml.replace(
'',
'
'
@@ -519,6 +518,11 @@ export class SdfgViewerProvider
'SPLIT_DIRECTION = \'horizontal\';'
);
}
+ if (sdfvConfig?.get
('minimap') === false)
+ baseHtml = baseHtml.replace(
+ 'MINIMAP_ENABLED = true;',
+ 'MINIMAP_ENABLED = false;'
+ );
return baseHtml;
}
diff --git a/src/components/transformation_history.ts b/src/components/transformation_history.ts
index 7f0628fa..3096de39 100644
--- a/src/components/transformation_history.ts
+++ b/src/components/transformation_history.ts
@@ -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';
diff --git a/src/components/transformation_list.ts b/src/components/transformation_list.ts
index 6d58a3c1..defaeb81 100644
--- a/src/components/transformation_list.ts
+++ b/src/components/transformation_list.ts
@@ -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';
diff --git a/src/dace_interface.ts b/src/dace_interface.ts
index faf3e96a..aad23eb0 100644
--- a/src/dace_interface.ts
+++ b/src/dace_interface.ts
@@ -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 os from 'os';
@@ -16,7 +16,7 @@ import {
TransformationHistoryProvider,
} from './components/transformation_history';
import { OptimizationPanel } from './components/optimization_panel';
-import { walkDirectory } from './utils/utils';
+import { executeTrusted, showUntrustedWorkspaceWarning, walkDirectory } from './utils/utils';
enum InteractionMode {
PREVIEW,
@@ -81,6 +81,16 @@ export class DaCeInterface
case 'query_sdfg_metadata':
this.querySdfgMetadata();
break;
+ case 'specialize_graph':
+ if (message.symbolMap !== undefined) {
+ const sdfgFile =
+ DaCeVSCode.getInstance().getActiveSdfgFileName();
+ if (sdfgFile) {
+ const uri = vscode.Uri.file(sdfgFile);
+ this.specializeGraph(uri, message.symbolMap);
+ }
+ }
+ break;
default:
break;
}
@@ -509,17 +519,25 @@ export class DaCeInterface
!OptimizationPanel.getInstance().isVisible())
return;
- this.daemonBooting = true;
+ const callBoot = () => {
+ this.daemonBooting = true;
- const callback = () => {
- SdfgViewerProvider.getInstance()?.handleMessage({
- type: 'daemon_connected',
+ this.startDaemonInTerminal(() => {
+ SdfgViewerProvider.getInstance()?.handleMessage({
+ type: 'daemon_connected',
+ });
+ TransformationHistoryProvider.getInstance()?.refresh();
+ TransformationListProvider.getInstance()?.refresh(true);
+ this.querySdfgMetadata();
});
- TransformationHistoryProvider.getInstance()?.refresh();
- TransformationListProvider.getInstance()?.refresh(true);
- this.querySdfgMetadata();
};
- this.startDaemonInTerminal(callback);
+
+ if (vscode.workspace.isTrusted) {
+ callBoot();
+ } else if (!this.daemonBooting) {
+ this.daemonBooting = true;
+ showUntrustedWorkspaceWarning('Running DaCe', callBoot);
+ }
}
public previewSdfg(sdfg: any, history_mode: boolean = false) {
@@ -764,6 +782,23 @@ export class DaCeInterface
);
}
+ public specializeGraph(
+ uri: vscode.Uri, symbolMap: { [symbol: string]: any | undefined }
+ ): void {
+ this.showSpinner('Specializing');
+ this.sendPostRequest(
+ '/specialize_sdfg',
+ {
+ 'path': uri.fsPath,
+ 'symbol_map': symbolMap,
+ },
+ (data: any) => {
+ this.hideSpinner();
+ this.writeToActiveDocument(data.sdfg);
+ }
+ );
+ }
+
public async querySdfgMetadata(): Promise {
async function callback(data: any) {
SdfgViewerProvider.getInstance()?.handleMessage({
diff --git a/src/debugger/breakpoint_handler.ts b/src/debugger/breakpoint_handler.ts
index 23c5953a..a0f8e383 100644
--- a/src/debugger/breakpoint_handler.ts
+++ b/src/debugger/breakpoint_handler.ts
@@ -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';
diff --git a/src/debugger/dace_debugger.ts b/src/debugger/dace_debugger.ts
index 6253730c..49fbbae3 100644
--- a/src/debugger/dace_debugger.ts
+++ b/src/debugger/dace_debugger.ts
@@ -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';
diff --git a/src/debugger/dace_debugging_session.ts b/src/debugger/dace_debugging_session.ts
index 10872dc7..394c4cce 100644
--- a/src/debugger/dace_debugging_session.ts
+++ b/src/debugger/dace_debugging_session.ts
@@ -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 { LoggingDebugSession, TerminatedEvent } from 'vscode-debugadapter';
diff --git a/src/debugger/dace_listener.ts b/src/debugger/dace_listener.ts
index 87f2a7c0..b5a0aa41 100644
--- a/src/debugger/dace_listener.ts
+++ b/src/debugger/dace_listener.ts
@@ -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 {
diff --git a/src/debugger/sdfg_python_debug_session.ts b/src/debugger/sdfg_python_debug_session.ts
index 2063ba74..5798d50c 100644
--- a/src/debugger/sdfg_python_debug_session.ts
+++ b/src/debugger/sdfg_python_debug_session.ts
@@ -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 {
diff --git a/src/debugger/sdfg_python_debugger.ts b/src/debugger/sdfg_python_debugger.ts
index c8cb5f7d..5ae5d97b 100644
--- a/src/debugger/sdfg_python_debugger.ts
+++ b/src/debugger/sdfg_python_debugger.ts
@@ -1,7 +1,8 @@
-// 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';
+import { executeTrusted } from '../utils/utils';
import { SdfgPythonDebugSession } from './sdfg_python_debug_session';
import { FileAccessor } from './sdfg_python_runtime';
@@ -10,32 +11,36 @@ export function activateSdfgPython(context: vscode.ExtensionContext) {
vscode.commands.registerCommand(
'sdfg.debug.run',
(resource: vscode.Uri) => {
- if (resource) {
- vscode.debug.startDebugging(undefined, {
- type: 'sdfg-python',
- name: 'Run current SDFG',
- request: 'launch',
- program: resource.fsPath,
- }, {
- noDebug: true,
- });
- }
+ executeTrusted(() => {
+ if (resource) {
+ vscode.debug.startDebugging(undefined, {
+ type: 'sdfg-python',
+ name: 'Run current SDFG',
+ request: 'launch',
+ program: resource.fsPath,
+ }, {
+ noDebug: true,
+ });
+ }
+ }, false, 'Execution of SDFGs');
}
),
vscode.commands.registerCommand(
'sdfg.debug.profile',
(resource: vscode.Uri) => {
- if (resource) {
- vscode.debug.startDebugging(undefined, {
- type: 'sdfg-python',
- name: 'Profile current SDFG',
- request: 'launch',
- profile: true,
- program: resource.fsPath,
- }, {
- noDebug: true,
- });
- }
+ executeTrusted(() => {
+ if (resource) {
+ vscode.debug.startDebugging(undefined, {
+ type: 'sdfg-python',
+ name: 'Profile current SDFG',
+ request: 'launch',
+ profile: true,
+ program: resource.fsPath,
+ }, {
+ noDebug: true,
+ });
+ }
+ }, false, 'Profiling of SDFGs');
}
)
);
@@ -99,4 +104,4 @@ implements vscode.DebugAdapterDescriptorFactory {
);
}
-}
\ No newline at end of file
+}
diff --git a/src/debugger/sdfg_python_runtime.ts b/src/debugger/sdfg_python_runtime.ts
index 51167f5a..aeb930e7 100644
--- a/src/debugger/sdfg_python_runtime.ts
+++ b/src/debugger/sdfg_python_runtime.ts
@@ -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';
diff --git a/src/extension.ts b/src/extension.ts
index 32d1c1a7..8d597d94 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -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';
@@ -16,6 +16,7 @@ import { TransformationListProvider } from './components/transformation_list';
import { SdfgBreakpointProvider } from './components/sdfg_breakpoints';
import { activateSdfgPython } from './debugger/sdfg_python_debugger';
import { activateDaceDebug } from './debugger/dace_debugger';
+import { executeTrusted } from './utils/utils';
export class DaCeVSCode {
@@ -261,10 +262,14 @@ export class DaCeVSCode {
}
});
this.registerCommand('transformationList.addCustom', () => {
- DaCeInterface.getInstance().addCustomTransformations(false);
+ executeTrusted(() => {
+ DaCeInterface.getInstance().addCustomTransformations(false);
+ }, false , 'Loading custom transformations');
});
this.registerCommand('transformationList.addCustomFromDir', () => {
- DaCeInterface.getInstance().addCustomTransformations(true);
+ executeTrusted(() => {
+ DaCeInterface.getInstance().addCustomTransformations(true);
+ }, false , 'Loading custom transformations');
});
this.registerCommand('transformationList.sync', () => {
DaCeVSCode.getInstance().getActiveEditor()?.postMessage({
@@ -303,20 +308,24 @@ export class DaCeVSCode {
(h) => DaCeInterface.getInstance().previewHistoryPoint(h));
this.registerCommand('sdfg.applyHistoryPoint',
(h) => DaCeInterface.getInstance().applyHistoryPoint(h));
- this.registerCommand('dace.openOptimizerInTerminal',
- () => DaCeInterface.getInstance().startDaemonInTerminal());
this.registerCommand('dace.installDace', () => {
- const term = vscode.window.createTerminal('Install DaCe');
- term.show();
- term.sendText(
- 'pip install dace'
- );
+ executeTrusted(() => {
+ const term = vscode.window.createTerminal('Install DaCe');
+ term.show();
+ term.sendText(
+ 'pip install dace'
+ );
+ }, false, 'Installing DaCe');
});
this.registerCommand('dace.config', () => {
- const uri = vscode.Uri.file(
- join(homedir(), '.dace.conf')
- );
- vscode.commands.executeCommand("vscode.openWith", uri, "default");
+ executeTrusted(() => {
+ const uri = vscode.Uri.file(
+ join(homedir(), '.dace.conf')
+ );
+ vscode.commands.executeCommand(
+ 'vscode.openWith', uri, 'default'
+ );
+ }, false, 'Accessing the user\'s dace.config');
});
const sdfgWatcher = vscode.workspace.createFileSystemWatcher(
diff --git a/src/types.d.ts b/src/types.d.ts
index 1a91cc90..d3ec3659 100644
--- a/src/types.d.ts
+++ b/src/types.d.ts
@@ -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.
export type Range = {
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index 9560751d..68636fd3 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -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';
@@ -20,3 +20,36 @@ export async function* walkDirectory(
}
}
}
+
+export function showUntrustedWorkspaceWarning(
+ customFeatureMsg?: string, callback?: (e: void) => any
+): void {
+ const trustWorkspaceMsg = 'Trust this workspace';
+ vscode.window.showErrorMessage(
+ (customFeatureMsg ? customFeatureMsg : 'This feature') +
+ ' is disabled in untrusted workspaces to keep you safe. ' +
+ 'If you trust the workspace, you can disable restricted mode to use ' +
+ 'this feature.',
+ trustWorkspaceMsg
+ ).then((val) => {
+ if (val === trustWorkspaceMsg)
+ vscode.env.openExternal(vscode.Uri.parse(
+ 'https://code.visualstudio.com/docs/editor/workspace-trust' +
+ '#_trusting-a-workspace'
+ ));
+ });
+
+ if (callback !== undefined)
+ vscode.workspace.onDidGrantWorkspaceTrust(callback);
+}
+
+export function executeTrusted(
+ f: (e: void) => any, runOnTrusted: boolean = false, customMessage?: string
+): void {
+ if (vscode.workspace.isTrusted)
+ f();
+ else
+ showUntrustedWorkspaceWarning(
+ customMessage, runOnTrusted ? f : undefined
+ );
+}
diff --git a/src/webclients/components/analysis/analysis.css b/src/webclients/components/analysis/analysis.css
index 2865abce..90f5981e 100644
--- a/src/webclients/components/analysis/analysis.css
+++ b/src/webclients/components/analysis/analysis.css
@@ -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. */
html {
@@ -64,8 +64,13 @@ body {
margin-right: .3rem;
}
+#symbol-list {
+ padding-bottom: .5rem;
+}
+
#symbol-table {
width: 100%;
+ margin: .5rem 0;
}
#symbol-table .symbol-entry .symbol {
diff --git a/src/webclients/components/analysis/analysis.ts b/src/webclients/components/analysis/analysis.ts
index b7538a0c..895da069 100644
--- a/src/webclients/components/analysis/analysis.ts
+++ b/src/webclients/components/analysis/analysis.ts
@@ -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 $ from 'jquery';
@@ -143,6 +143,13 @@ class SymbolResolution {
});
}
+ public specializeGraph(): void {
+ vscode.postMessage({
+ type: 'dace.specialize_graph',
+ symbolMap: this.symbols,
+ });
+ }
+
}
function clearRuntimeReport() {
@@ -370,7 +377,7 @@ $(() => {
fr.readAsText(that.files[0]);
});
- $('#runtime-time-criterium-select').change(() => {
+ $('#runtime-time-criterium-select').on('change', () => {
if (vscode)
vscode.postMessage({
type: 'sdfv.instrumentation_report_change_criterium',
@@ -386,6 +393,10 @@ $(() => {
$('#runtime-report-file-input').trigger('click');
});
+ $('#specialize-btn').on('click', () => {
+ symbolResolution?.specializeGraph();
+ });
+
if (vscode)
vscode.postMessage({
type: 'sdfv.refresh_analysis_pane',
diff --git a/src/webclients/components/breakpoints/breakpoints.css b/src/webclients/components/breakpoints/breakpoints.css
index e4a8d38f..d620d3b6 100644
--- a/src/webclients/components/breakpoints/breakpoints.css
+++ b/src/webclients/components/breakpoints/breakpoints.css
@@ -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. */
html {
diff --git a/src/webclients/components/breakpoints/breakpoints.ts b/src/webclients/components/breakpoints/breakpoints.ts
index 4ab0b57b..5797c971 100644
--- a/src/webclients/components/breakpoints/breakpoints.ts
+++ b/src/webclients/components/breakpoints/breakpoints.ts
@@ -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 $ from 'jquery';
diff --git a/src/webclients/components/history/transformation_history.css b/src/webclients/components/history/transformation_history.css
index 2b53c982..f594cb8a 100644
--- a/src/webclients/components/history/transformation_history.css
+++ b/src/webclients/components/history/transformation_history.css
@@ -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. */
html {
diff --git a/src/webclients/components/history/transformation_history.ts b/src/webclients/components/history/transformation_history.ts
index 1280183a..1a35653c 100644
--- a/src/webclients/components/history/transformation_history.ts
+++ b/src/webclients/components/history/transformation_history.ts
@@ -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 $ from 'jquery';
diff --git a/src/webclients/components/outline/outline.css b/src/webclients/components/outline/outline.css
index 671e5b39..a4cf8855 100644
--- a/src/webclients/components/outline/outline.css
+++ b/src/webclients/components/outline/outline.css
@@ -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. */
html {
diff --git a/src/webclients/components/outline/outline.ts b/src/webclients/components/outline/outline.ts
index 5959afea..a3d0a09c 100644
--- a/src/webclients/components/outline/outline.ts
+++ b/src/webclients/components/outline/outline.ts
@@ -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 'bootstrap';
diff --git a/src/webclients/components/sdfv/analysis/analysis.ts b/src/webclients/components/sdfv/analysis/analysis.ts
index f6078cde..42d7711b 100644
--- a/src/webclients/components/sdfv/analysis/analysis.ts
+++ b/src/webclients/components/sdfv/analysis/analysis.ts
@@ -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 {
diff --git a/src/webclients/components/sdfv/breakpoints/breakpoints.ts b/src/webclients/components/sdfv/breakpoints/breakpoints.ts
index 0183a961..2ad4c889 100644
--- a/src/webclients/components/sdfv/breakpoints/breakpoints.ts
+++ b/src/webclients/components/sdfv/breakpoints/breakpoints.ts
@@ -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 {
diff --git a/src/webclients/components/sdfv/messaging/message_handler.ts b/src/webclients/components/sdfv/messaging/message_handler.ts
index aed7f1ab..3d5b8cd6 100644
--- a/src/webclients/components/sdfv/messaging/message_handler.ts
+++ b/src/webclients/components/sdfv/messaging/message_handler.ts
@@ -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 {
diff --git a/src/webclients/components/sdfv/properties/properties.ts b/src/webclients/components/sdfv/properties/properties.ts
index 75bedf6f..a4f8638a 100644
--- a/src/webclients/components/sdfv/properties/properties.ts
+++ b/src/webclients/components/sdfv/properties/properties.ts
@@ -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 { string_to_sdfg_typeclass } from '@spcl/sdfv/out';
@@ -287,7 +287,7 @@ export class TypeclassProperty extends ComboboxProperty {
backgroundInput
);
- if (typeof target[key] === 'object') {
+ if (target[key] && typeof target[key] === 'object') {
editCompoundButton.show();
this.compoundValueType = target[key]['type'];
this.compoundValues = target[key];
diff --git a/src/webclients/components/sdfv/renderer/vscode_renderer.ts b/src/webclients/components/sdfv/renderer/vscode_renderer.ts
index 82282235..ece041ed 100644
--- a/src/webclients/components/sdfv/renderer/vscode_renderer.ts
+++ b/src/webclients/components/sdfv/renderer/vscode_renderer.ts
@@ -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 {
diff --git a/src/webclients/components/sdfv/transformation/transformation.ts b/src/webclients/components/sdfv/transformation/transformation.ts
index 1d244e31..c2661b48 100644
--- a/src/webclients/components/sdfv/transformation/transformation.ts
+++ b/src/webclients/components/sdfv/transformation/transformation.ts
@@ -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 { JsonTransformation } from '../../transformations/transformations';
diff --git a/src/webclients/components/sdfv/utils/attributes_table.ts b/src/webclients/components/sdfv/utils/attributes_table.ts
index 4b8c68f3..a6657d62 100644
--- a/src/webclients/components/sdfv/utils/attributes_table.ts
+++ b/src/webclients/components/sdfv/utils/attributes_table.ts
@@ -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 {
@@ -121,20 +121,21 @@ export function attrTablePutCode(
const editor = monaco_editor.create(
input.get(0)!, {
- 'value': val,
- 'language': lang === undefined ? 'python' : lang.toLowerCase(),
- 'theme': getMonacoThemeName(),
- 'glyphMargin': false,
- 'lineDecorationsWidth': 0,
- 'lineNumbers': 'off',
- 'lineNumbersMinChars': 0,
- 'minimap': {
- 'enabled': false,
+ value: val,
+ language: lang === undefined ? 'python' : lang.toLowerCase(),
+ theme: getMonacoThemeName(),
+ glyphMargin: false,
+ lineDecorationsWidth: 0,
+ lineNumbers: 'off',
+ lineNumbersMinChars: 0,
+ minimap: {
+ enabled: false,
},
- 'padding': {
- 'top': 0,
- 'bottom': 0,
+ padding: {
+ top: 0,
+ bottom: 0,
},
+ automaticLayout: true,
}
);
@@ -330,7 +331,7 @@ export function attrTablePutTypeclass(
}).appendTo(cell);
const choices = baseTypes.concat(Object.keys(compoundTypes));
- const typeval = typeof val === 'object' ? val['type'] : val;
+ const typeval = val ? (typeof val === 'object' ? val['type'] : val) : null;
let found = false;
if (choices) {
choices.forEach(array => {
@@ -346,7 +347,7 @@ export function attrTablePutTypeclass(
});
}
- if (!found)
+ if (!found && typeval)
input.append(new Option(typeval, typeval, true, true));
input.editableSelect({
@@ -923,7 +924,15 @@ export function attributeTablePutEntry(
'class': 'col-9 attr-table-cell',
}).appendTo(row);
- if (dtype === undefined) {
+ if (key === 'constants_prop') {
+ const constContainer = $('').appendTo(valueCell);
+ for (const k in val) {
+ const v = val[k];
+ constContainer.append($('
', {
+ text: k + ': ' + v[1].toString(),
+ }));
+ }
+ } else if (dtype === undefined) {
// Implementations that are set to null should still be visible. Other
// null properties should be shown as an empty field.
if (key === 'implementation' && val === null)
diff --git a/src/webclients/components/sdfv/utils/helpers.ts b/src/webclients/components/sdfv/utils/helpers.ts
index d4fab74f..b76c5dca 100644
--- a/src/webclients/components/sdfv/utils/helpers.ts
+++ b/src/webclients/components/sdfv/utils/helpers.ts
@@ -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 {
diff --git a/src/webclients/components/sdfv/vscode_sdfv.css b/src/webclients/components/sdfv/vscode_sdfv.css
index b6be7d2d..bfe40c1c 100644
--- a/src/webclients/components/sdfv/vscode_sdfv.css
+++ b/src/webclients/components/sdfv/vscode_sdfv.css
@@ -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. */
body {
@@ -501,6 +501,7 @@ pre.code {
flex-direction: row;
align-items: center;
justify-content: left;
+ flex-basis: auto;
width: 100%;
}
@@ -508,6 +509,7 @@ pre.code {
flex-grow: 1;
height: 6rem;
margin-right: .8rem;
+ min-width: 0;
border: 1px solid;
border-bottom: 1px solid;
border-color: var(--vscode-input-border);
diff --git a/src/webclients/components/sdfv/vscode_sdfv.ts b/src/webclients/components/sdfv/vscode_sdfv.ts
index 8f1f757c..1b6a24af 100644
--- a/src/webclients/components/sdfv/vscode_sdfv.ts
+++ b/src/webclients/components/sdfv/vscode_sdfv.ts
@@ -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 $ from 'jquery';
diff --git a/src/webclients/components/transformations/transformations.css b/src/webclients/components/transformations/transformations.css
index 1b360bf6..114b97cb 100644
--- a/src/webclients/components/transformations/transformations.css
+++ b/src/webclients/components/transformations/transformations.css
@@ -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. */
html {
diff --git a/src/webclients/components/transformations/transformations.ts b/src/webclients/components/transformations/transformations.ts
index b87a6489..e1ab2549 100644
--- a/src/webclients/components/transformations/transformations.ts
+++ b/src/webclients/components/transformations/transformations.ts
@@ -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 $ from 'jquery';
diff --git a/src/webclients/elements/treeview/treeview.css b/src/webclients/elements/treeview/treeview.css
index c5a73d8e..74e07f42 100644
--- a/src/webclients/elements/treeview/treeview.css
+++ b/src/webclients/elements/treeview/treeview.css
@@ -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. */
.tree-view-list {
diff --git a/src/webclients/elements/treeview/treeview.ts b/src/webclients/elements/treeview/treeview.ts
index 4ae75241..496bdfbf 100644
--- a/src/webclients/elements/treeview/treeview.ts
+++ b/src/webclients/elements/treeview/treeview.ts
@@ -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.
export class CustomTreeViewItem {