@@ -986,7 +986,7 @@ function demo() {
986
986
987
987
model . addReqView ( btnGetKernelView . updateView ) ;
988
988
989
- $ ( "#btnGetKernel" ) . click ( function ( ) {
989
+ var getKernel = function ( ) {
990
990
model . setOutput ( "" , "" , "" , "" ) ;
991
991
992
992
var command = model . input . expression . replace ( / / g, "" ) ;
@@ -1047,6 +1047,13 @@ function demo() {
1047
1047
command += " -prefix=" + prefix ;
1048
1048
}
1049
1049
1050
+ var url = window . location . pathname + "?expr="
1051
+ + model . input . expression + "&format=" + formats ;
1052
+ if ( schedule !== "" ) {
1053
+ url += "&sched=" + schedule ;
1054
+ }
1055
+ history . replaceState ( null , "" , url ) ;
1056
+
1050
1057
var req = $ . ajax ( {
1051
1058
type : "POST" ,
1052
1059
url : "http://tensor-compiler-online.csail.mit.edu" ,
@@ -1059,13 +1066,6 @@ function demo() {
1059
1066
response [ 'full-kernel' ] ,
1060
1067
response [ 'error' ] ) ;
1061
1068
model . setReq ( null ) ;
1062
-
1063
- var url = window . location . pathname + "?expr="
1064
- + model . input . expression + "&format=" + formats ;
1065
- if ( schedule !== "" ) {
1066
- url += "&sched=" + schedule ;
1067
- }
1068
- history . replaceState ( null , "" , url ) ;
1069
1069
} ,
1070
1070
error : function ( XMLHttpRequest , textStatus , errorThrown ) {
1071
1071
var errorMsg = "Unable to connect to the taco online server" ;
@@ -1074,7 +1074,8 @@ function demo() {
1074
1074
}
1075
1075
} ) ;
1076
1076
model . setReq ( req ) ;
1077
- } ) ;
1077
+ } ;
1078
+ $ ( "#btnGetKernel" ) . click ( getKernel ) ;
1078
1079
1079
1080
var examples = {
1080
1081
spmv : { name : "SpMV" ,
@@ -1198,7 +1199,9 @@ function demo() {
1198
1199
} ) ( e , examples [ e ] . code , examples [ e ] . formats ) ;
1199
1200
}
1200
1201
1201
- if ( ! inited ) {
1202
+ if ( inited ) {
1203
+ getKernel ( ) ;
1204
+ } else {
1202
1205
var urlPrefix = "http://tensor-compiler.org/examples/" + demo ;
1203
1206
var computeGet = $ . get ( urlPrefix + "_compute.c" ) ;
1204
1207
var assemblyGet = $ . get ( urlPrefix + "_assembly.c" ) ;
0 commit comments