Skip to content

Commit 441b5f8

Browse files
Merge pull request #14 from jwshi21/prefix
Added prefix field
2 parents 35aa14d + dca5304 commit 441b5f8

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

codegen.html

+7
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ <h6 style="margin-bottom: 0px; margin-top: 18px">Input a tensor algebra expressi
7373
<ul id="listExamples" class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="btnExamples"></ul>
7474
</div>
7575
</td>
76+
<td style="width:150px; padding-right:15px">
77+
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"
78+
style="width:100%">
79+
<input id="prefix" class="mdl-textfield__input" style="font-family: monospace" spellcheck="false" autocomplete="off" autocorrect="false" autocapitalize="false">
80+
<label class="mdl-textfield__label">(Optional) Prefix</label>
81+
</div>
82+
</td>
7683
<td style="width: 200px">
7784
<button id="btnGetKernel" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect demo-btn">Generate Kernel</button>
7885
</td>

javascripts/demo.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ function demo() {
44
expression: "",
55
tensorOrders: {},
66
error: "",
7-
indices: []
7+
indices: [],
8+
prefix: ""
89
},
910
schedule: [],
1011
output: {
@@ -30,7 +31,6 @@ function demo() {
3031
}
3132
},
3233
updateScheduleView: function() {
33-
console.log(model.schedule);
3434
model.removeInvalidIndices();
3535
model.removeInvalidAccesses();
3636
model.scheduleView(0);
@@ -81,6 +81,11 @@ function demo() {
8181
}
8282
model.updateInputViews();
8383
},
84+
setPrefix: function(prefix) {
85+
model.cancelReq();
86+
model.setOutput("", "", "", "");
87+
model.input.prefix = prefix;
88+
},
8489
setOutput: function(computeLoops, assemblyLoops, fullCode, error) {
8590
model.output = { computeLoops: computeLoops,
8691
assemblyLoops: assemblyLoops,
@@ -1008,6 +1013,11 @@ function demo() {
10081013
command += ")";
10091014
}
10101015

1016+
var prefix = model.input.prefix.replaceAll(" ", "");
1017+
if (prefix) {
1018+
command += " -prefix=" + prefix;
1019+
}
1020+
10111021
var req = $.ajax({
10121022
type: "POST",
10131023
url: "http://tensor-compiler-online.csail.mit.edu",
@@ -1138,4 +1148,8 @@ function demo() {
11381148
$("#btnGPU").click(function() {
11391149
model.setSchedule(default_GPU_schedules[$(this).attr('data-val')]);
11401150
});
1151+
1152+
$("#prefix").keyup(function() {
1153+
model.setPrefix($("#prefix").val());
1154+
});
11411155
}

0 commit comments

Comments
 (0)