Skip to content

Commit d7017b3

Browse files
authored
Merge pull request #24 from VectorCamp/feature/llvm_analyzer
llvm_mca analysis
2 parents ebcb2ee + a0665e6 commit d7017b3

6 files changed

Lines changed: 860 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,7 @@ All notable changes to the "code.simd.ai" extension will be documented in this f
6363

6464
## 1.0.16
6565
- Added asm, asm syntax and example in the performance view
66+
67+
## 1.0.17
68+
- Added llvm_analyze (clang and llvm_mca required)
6669
---

package.json

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "code-simd-ai",
33
"displayName": "code.simd",
44
"description": "VScode plugin for porting of code between different cpu architectures",
5-
"version": "1.0.16",
5+
"version": "1.0.17",
66
"publisher": "VectorCamp",
77
"engines": {
88
"vscode": "^1.100.0"
@@ -59,6 +59,11 @@
5959
"default": "",
6060
"description": "Your simd.info API token. Get it from https://simd.info/",
6161
"secret": true
62+
},
63+
"code.simd.info.enableLLVM": {
64+
"type": "boolean",
65+
"default": false,
66+
"description": "Enable LLVM/Clang integration for MCA analysis (requires clang and llvm-mca to be installed)"
6267
}
6368
}
6469
},
@@ -80,8 +85,29 @@
8085
{
8186
"command": "code.simd.ai.cycleHighlightMode",
8287
"title": "Cycle SIMD Syntax Highlighting Mode"
88+
},
89+
{
90+
"command": "code.simd.ai.analyzeMca",
91+
"title": "SIMD: Analyze Selection with LLVM-MCA"
92+
}
93+
],
94+
"keybindings": [
95+
{
96+
"command": "code.simd.ai.analyzeMca",
97+
"key": "ctrl+shift+m",
98+
"mac": "cmd+shift+m",
99+
"when": "editorTextFocus && editorHasSelection && code.simd.info.enableLLVM"
100+
}
101+
],
102+
"menus": {
103+
"editor/context": [
104+
{
105+
"command": "code.simd.ai.analyzeMca",
106+
"when": "editorHasSelection && code.simd.info.enableLLVM",
107+
"group": "simd@1"
83108
}
84-
],
109+
]
110+
},
85111
"activationEvents": [
86112
]
87113
},

src/ChatViewProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class ChatViewProvider implements vscode.WebviewViewProvider {
9090
const reply = await callSimdAiWithHistory(contextMessages);
9191
await saveChatHistory(this.context, sessionId, userText, reply);
9292

93-
// send reply back to the same session, even if user switched
93+
// send reply back to the same session, even if user switched
9494
webview.postMessage({ type: 'response', text: reply, sessionId });
9595
} catch (err: any) {
9696
webview.postMessage({ type: 'responseError', error: String(err), sessionId });

src/extension.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,24 @@ import { highlightIntrinsicsAndDatatypes, initIntrinsicHighlighting, deactivateH
2727
import { activate as activateCompletion } from './completionProvider';
2828

2929
import { registerShowPerformanceGraphCommand } from './showPerformanceGraph';
30+
import { registerLlvmMcaCommand } from './llvmMcaAnalyzer';
31+
3032

3133
export function activate(context: vscode.ExtensionContext) {
3234

3335
console.log('Extension "code.simd.info" is now active!');
3436

37+
const enableLLVM = vscode.workspace.getConfiguration('code.simd.info').get<boolean>('enableLLVM', false);
38+
39+
vscode.commands.executeCommand('setContext', 'code.simd.info.enableLLVM', enableLLVM);
40+
41+
vscode.workspace.onDidChangeConfiguration(e => {
42+
if (e.affectsConfiguration('code.simd.info.enableLLVM')) {
43+
const updated = vscode.workspace.getConfiguration('code.simd.info').get<boolean>('enableLLVM', false);
44+
vscode.commands.executeCommand('setContext', 'code.simd.info.enableLLVM', updated);
45+
}
46+
});
47+
3548
context.subscriptions.push(
3649
vscode.languages.registerCodeLensProvider({ scheme: 'file', language: '*' }, new TranslationCodeLensProvider())
3750
);
@@ -48,6 +61,8 @@ export function activate(context: vscode.ExtensionContext) {
4861
activateCompletion(context);
4962

5063
registerShowPerformanceGraphCommand(context);
64+
65+
registerLlvmMcaCommand(context);
5166
}
5267

5368
export function deactivate() {

0 commit comments

Comments
 (0)