@@ -986,7 +986,7 @@ function demo() {
986986
987987 model . addReqView ( btnGetKernelView . updateView ) ;
988988
989- $ ( "#btnGetKernel" ) . click ( function ( ) {
989+ var getKernel = function ( ) {
990990 model . setOutput ( "" , "" , "" , "" ) ;
991991
992992 var command = model . input . expression . replace ( / / g, "" ) ;
@@ -1047,6 +1047,13 @@ function demo() {
10471047 command += " -prefix=" + prefix ;
10481048 }
10491049
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+
10501057 var req = $ . ajax ( {
10511058 type : "POST" ,
10521059 url : "http://tensor-compiler-online.csail.mit.edu" ,
@@ -1059,13 +1066,6 @@ function demo() {
10591066 response [ 'full-kernel' ] ,
10601067 response [ 'error' ] ) ;
10611068 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 ) ;
10691069 } ,
10701070 error : function ( XMLHttpRequest , textStatus , errorThrown ) {
10711071 var errorMsg = "Unable to connect to the taco online server" ;
@@ -1074,7 +1074,8 @@ function demo() {
10741074 }
10751075 } ) ;
10761076 model . setReq ( req ) ;
1077- } ) ;
1077+ } ;
1078+ $ ( "#btnGetKernel" ) . click ( getKernel ) ;
10781079
10791080 var examples = {
10801081 spmv : { name : "SpMV" ,
@@ -1198,7 +1199,9 @@ function demo() {
11981199 } ) ( e , examples [ e ] . code , examples [ e ] . formats ) ;
11991200 }
12001201
1201- if ( ! inited ) {
1202+ if ( inited ) {
1203+ getKernel ( ) ;
1204+ } else {
12021205 var urlPrefix = "http://tensor-compiler.org/examples/" + demo ;
12031206 var computeGet = $ . get ( urlPrefix + "_compute.c" ) ;
12041207 var assemblyGet = $ . get ( urlPrefix + "_assembly.c" ) ;
0 commit comments