@@ -3,9 +3,12 @@ function demo() {
33 input : {
44 expression : "" ,
55 tensorOrders : { } ,
6+ error : ""
7+ } ,
8+ schedule : {
9+ scheduleMsg : "Cannot implement schedule: " ,
610 indices : [ ] ,
711 resultAccesses : [ ] ,
8- error : ""
912 } ,
1013 output : {
1114 computeLoops : "" ,
@@ -58,8 +61,8 @@ function demo() {
5861 } else {
5962 try {
6063 model . input . tensorOrders = parser . parse ( expression ) ;
61- model . input . indices = [ ...new Set ( parser_indices . parse ( expression ) ) ] ;
62- model . input . resultAccesses = [ ...new Set ( parser_accesses . parse ( expression ) ) ] ;
64+ model . schedule . indices = [ ...new Set ( parser_indices . parse ( expression ) ) ] ;
65+ model . schedule . resultAccesses = [ ...new Set ( parser_accesses . parse ( expression ) ) ] ;
6366 model . input . error = "" ;
6467 for ( t in model . input . tensorOrders ) {
6568 if ( model . input . tensorOrders [ t ] < 0 ) {
@@ -96,6 +99,9 @@ function demo() {
9699 } ,
97100 getError : function ( ) {
98101 return ( model . output . error !== "" ) ? model . output . error : model . input . error ;
102+ } ,
103+ hasInputOutputError : function ( ) {
104+ return model . getError ( ) && ! model . getError ( ) . includes ( model . schedule . scheduleMsg ) ;
99105 }
100106 } ;
101107
@@ -106,11 +112,21 @@ function demo() {
106112 clearTimeout ( txtExprView . timerEvent ) ;
107113 if ( model . getError ( ) !== "" ) {
108114 var markError = function ( ) {
109- $ ( "#lblError" ) . html ( model . getError ( ) ) ;
110- $ ( "#txtExpr" ) . parent ( ) . addClass ( 'is-invalid' ) ;
115+ var scheduleMsg = "Cannot implement schedule: " ;
116+ var error = model . getError ( ) ;
117+ if ( error . includes ( model . schedule . scheduleMsg ) ) {
118+ error = error . substring ( error . indexOf ( model . schedule . scheduleMsg )
119+ + model . schedule . scheduleMsg . length ) ;
120+ $ ( "#scheduleError" ) . html ( error ) ;
121+ $ ( "#scheduleError" ) . parent ( ) . addClass ( 'is-invalid' ) ;
122+ } else {
123+ $ ( "#lblError" ) . html ( error ) ;
124+ $ ( "#txtExpr" ) . parent ( ) . addClass ( 'is-invalid' ) ;
125+ }
111126 } ;
112127 txtExprView . timerEvent = setTimeout ( markError , timeout ) ;
113128 } else {
129+ $ ( "#scheduleError" ) . parent ( ) . removeClass ( 'is-invalid' ) ;
114130 $ ( "#txtExpr" ) . parent ( ) . removeClass ( 'is-invalid' ) ;
115131 }
116132 }
@@ -225,9 +241,13 @@ function demo() {
225241 } ,
226242 updateView : function ( timeout ) {
227243 clearTimeout ( tblFormatsView . timerEvent ) ;
228- if ( model . getError ( ) !== "" ) {
229- var hideTable = function ( ) { $ ( "#tblFormats" ) . hide ( ) ; } ;
230- tblFormatsView . timerEvent = setTimeout ( hideTable , timeout ) ;
244+ if ( model . hasInputOutputError ( ) ) {
245+ var hideTables = function ( ) {
246+ $ ( "#tblFormats" ) . hide ( ) ;
247+ $ ( "#tblSchedule" ) . hide ( ) ;
248+ tblScheduleView . clear ( ) ;
249+ } ;
250+ tblFormatsView . timerEvent = setTimeout ( hideTables , timeout ) ;
231251 } else {
232252 var listTensorsBody = "" ;
233253 for ( t in model . input . tensorOrders ) {
@@ -479,17 +499,24 @@ function demo() {
479499 1 : [ "index dropdown" ] ,
480500 2 : [ "default" , "f" ]
481501 } ,
482- unroll : {
483- parameters : [ "Unrolled IndexVar" , "Unroll Factor" ] ,
484- 0 : [ "index dropdown" ] ,
485- 1 : [ "number" ]
486- } ,
487502 parallelize : {
488503 parameters : [ "Parallel IndexVar" , "Hardware" , "Race Strategy" ] ,
489504 0 : [ "index dropdown" ] ,
490505 1 : [ "predefined dropdown" , "Not Parallel" , "Default Unit" , "CPU Thread" , "CPU Vector" ] ,
491506 2 : [ "predefined dropdown" , "Ignore Races" , "No Races" , "Atomics" , "Temporary" , "Parallel Reduction" ]
492- }
507+ } ,
508+ bound : {
509+ parameters : [ "Original IndexVar" , "Bounded IndexVar" , "Bound" , "Bound Type" ] ,
510+ 0 : [ "index dropdown" ] ,
511+ 1 : [ "inferred" , 0 , "bound" ] ,
512+ 2 : [ "number" ] ,
513+ 3 : [ "predefined dropdown" , "Min Exact" , "Min Constraint" , "Max Exact" , "Max Constraint" ]
514+ } ,
515+ unroll : {
516+ parameters : [ "Unrolled IndexVar" , "Unroll Factor" ] ,
517+ 0 : [ "index dropdown" ] ,
518+ 1 : [ "number" ]
519+ } ,
493520 } ,
494521 commandsCache : { } ,
495522 inputsCache : { } ,
@@ -555,7 +582,7 @@ function demo() {
555582 parameter += "<div class=\"schedule-input mdl-textfield mdl-js-textfield " ;
556583 parameter += "mdl-textfield--floating-label getmdl-select\">" ;
557584 parameter += "<input class=\"space-font mdl-textfield__input\" "
558- parameter += "type=\"text\" value = \"" ;
585+ parameter += "type=\"text\" autocomplete=\"off\" value = \"" ;
559586 parameter += input ;
560587 parameter += "\" id=\"" ;
561588 parameter += inputId ;
@@ -598,7 +625,7 @@ function demo() {
598625 // a dropdown where user can choose from input index variables
599626 function indexDropdown ( parameterName , inputId , input ) {
600627 var parameter = dropdown ( parameterName , inputId , input ) ;
601- for ( var index of model . input . indices ) {
628+ for ( var index of model . schedule . indices ) {
602629 parameter += "<li><a>" ;
603630 parameter += index ;
604631 parameter += "</a></li>" ;
@@ -617,7 +644,7 @@ function demo() {
617644 // a dropdown where user can choose from argument tensors
618645 function accessDropdown ( parameterName , inputId , input ) {
619646 var parameter = dropdown ( parameterName , inputId , input ) ;
620- for ( var access of model . input . resultAccesses ) {
647+ for ( var access of model . schedule . resultAccesses ) {
621648 parameter += "<li><a>" ;
622649 parameter += access ;
623650 parameter += "</a></li>" ;
@@ -731,11 +758,13 @@ function demo() {
731758
732759 scheduleBody += row ;
733760 }
734- scheduleBody += ""
735761
736- $ ( "#tblSchedule" ) . html ( scheduleBody ) ;
737762 if ( scheduleBody !== "" ) {
763+ $ ( "#tblSchedule" ) . html ( scheduleBody ) ;
738764 getmdlSelect . init ( ".getmdl-select" ) ;
765+ $ ( "#tblSchedule" ) . show ( ) ;
766+ } else {
767+ $ ( "#tblSchedule" ) . hide ( ) ;
739768 }
740769
741770 $ ( "tbody" ) . sortable ( {
@@ -745,6 +774,9 @@ function demo() {
745774 update : function ( ev , ui ) {
746775 tblScheduleView . swapRows ( ui . item . startPos , ui . item . index ( ) ) ;
747776 tblScheduleView . updateView ( 0 ) ;
777+
778+ model . cancelReq ( ) ;
779+ model . setOutput ( "" , "" , "" , "" ) ;
748780 }
749781 } ) ;
750782
@@ -765,6 +797,9 @@ function demo() {
765797
766798 tblScheduleView . insertInputsCacheEntry ( row , param , $ ( this ) . val ( ) ) ;
767799 tblScheduleView . updateView ( 0 ) ;
800+
801+ model . cancelReq ( ) ;
802+ model . setOutput ( "" , "" , "" , "" ) ;
768803 } ) ;
769804
770805 $ ( ".options a" ) . on ( "click" , function ( e ) {
@@ -775,13 +810,19 @@ function demo() {
775810
776811 tblScheduleView . insertInputsCacheEntry ( row , param , option ) ;
777812 tblScheduleView . updateView ( 0 ) ;
813+
814+ model . cancelReq ( ) ;
815+ model . setOutput ( "" , "" , "" , "" ) ;
778816 } ) ;
779817
780818 $ ( ".remove-row" ) . each ( function ( ) {
781819 $ ( this ) . click ( function ( ) {
782820 var row = $ ( this ) . attr ( "id" ) [ 8 ] ;
783821 tblScheduleView . deleteRow ( row ) ;
784822 tblScheduleView . updateView ( 0 ) ;
823+
824+ model . cancelReq ( ) ;
825+ model . setOutput ( "" , "" , "" , "" ) ;
785826 } ) ;
786827 } ) ;
787828 }
@@ -798,11 +839,6 @@ function demo() {
798839 model . addInputView ( tblFormatsView . updateView ) ;
799840 model . addInputView ( btnGetKernelView . updateView ) ;
800841
801- model . addInputView ( function ( timeout ) {
802- tblScheduleView . clear ( ) ;
803- } ) ;
804- model . addInputView ( tblScheduleView . updateView ) ;
805-
806842 $ ( "#txtExpr" ) . keyup ( function ( ) {
807843 model . setInput ( $ ( "#txtExpr" ) . val ( ) ) ;
808844 } ) ;
@@ -885,7 +921,7 @@ function demo() {
885921 var valid = true ;
886922
887923 for ( var j in tblScheduleView . commands [ c ] [ "parameters" ] ) {
888- var param = $ ( "#param" + i + "-" + j ) . val ( ) ;
924+ var param = $ ( "#param" + i + "-" + j ) . val ( ) . replace ( " " , "" ) ;
889925 if ( ! param ) {
890926 valid = false ;
891927 break ;
@@ -896,6 +932,7 @@ function demo() {
896932 if ( valid ) {
897933 // only add if user inputted all parameters
898934 command += tempCommand ;
935+ console . log ( tempCommand ) ;
899936 }
900937 }
901938 command += "q" ;
0 commit comments