15
15
limitations under the License.
16
16
-->
17
17
18
+ < link rel ="import " href ="../paper-slider/paper-slider.html ">
19
+ < link rel ="import " href ="../paper-toggle-button/paper-toggle-button.html ">
18
20
< link rel ="import " href ="tf-op-table.html ">
19
21
< link rel ="import " href ="tf-op-details.html ">
20
22
< link rel ="import " href ="utils.html ">
33
35
dis play: block;
34
36
margin- right: 1.5em;
35
37
}
38
+ # control {
39
+ display : flex;
40
+ flex-flow : row nowrap;
41
+ justify-content : space-between;
42
+ overflow : auto;
43
+ text-transform : uppercase;
44
+ padding : 0.5em ;
45
+ vertical-align : bottom;
46
+ text-align : bottom;
47
+ }
48
+ .controlRowLeft {
49
+ display : flex;
50
+ flex-flow : row nowrap;
51
+ align-items : center;
52
+ line-height : 50px ;
53
+ text-align : bottom;
54
+ justify-content : flex-start;
55
+ }
56
+ .controlRowRight {
57
+ display : flex;
58
+ flex-flow : row nowrap;
59
+ align-items : center;
60
+ line-height : 50px ;
61
+ text-align : bottom;
62
+ justify-content : flex-end;
63
+ }
64
+ paper-slider {
65
+ --paper-slider-input : {width : 100px }
66
+ --paper-slider-height : 3px ;
67
+ }
36
68
# description {
37
69
margin-bottom : 2em ;
38
70
width : 600px ;
@@ -45,9 +77,32 @@ <h4>Overall TPU FLOPS utilization is
45
77
</ h4 >
46
78
< div id ="description ">
47
79
< p > Modifying your model's architecture, data dimensions, and improving
48
- the efficiency of CPU operations may help reach the TPU's FLOPS potential.
49
- </ p > </ div >
50
- < tf-op-table root-node ="[[_root]] " active ={{active}} > </ tf-op-table >
80
+ the efficiency of CPU operations may help reach the TPU's FLOPS
81
+ potential.
82
+ </ p >
83
+ < p > "Idle" represents the portion of the total execution time on device
84
+ that is idle.</ p >
85
+ </ div >
86
+ < div id ="control ">
87
+ < span class ="controlRowLeft " hidden ="[[!_hasTwoProfiles]] "> By Program
88
+ < paper-toggle-button checked ={{isByCategory}} >
89
+ </ paper-toggle-button > By Category</ span >
90
+ <!--
91
+ paper-slider sets how many child nodes to show for each category.
92
+ If paper-toggle-button is checked, then only children in top 90th
93
+ percentile of time spent are listed.
94
+ -->
95
+ < span class ="controlRowLeft "> Show top
96
+ < paper-slider min ="10 " max ="100 " snaps step ="10 "
97
+ value ="{{childrenCount}} " editable >
98
+ </ paper-slider > ops</ span >
99
+ < span class ="controlRowRight "> off
100
+ < paper-toggle-button checked ={{showP90}} >
101
+ </ paper-toggle-button > Top 90%</ span >
102
+ </ div >
103
+ < tf-op-table root-node ="[[_root]] " active ={{active}}
104
+ show-p90 ="{{showP90}} " children-count ="{{childrenCount}} ">
105
+ </ tf-op-table >
51
106
</ div >
52
107
</ template >
53
108
@@ -61,19 +116,58 @@ <h4>Overall TPU FLOPS utilization is
61
116
} ,
62
117
_root : {
63
118
type : Object ,
64
- computed : '_getRoot(_data, "byCategory")' ,
65
119
notify : true ,
66
120
} ,
67
121
active : {
68
122
type : Object ,
69
123
notify : true ,
70
124
value : null ,
71
125
} ,
126
+ _hasTwoProfiles : {
127
+ type : Boolean ,
128
+ computed : '_checkProfiles(_data)' ,
129
+ notify : true ,
130
+ } ,
131
+ isByCategory : {
132
+ type : Boolean ,
133
+ value : false ,
134
+ notify : true ,
135
+ } ,
136
+ showP90 : {
137
+ type : Boolean ,
138
+ value : false ,
139
+ notify : true ,
140
+ } ,
141
+ childrenCount : {
142
+ type : Number ,
143
+ value : 10 ,
144
+ notify : true ,
145
+ } ,
146
+ } ,
147
+ observers : [
148
+ '_getRoot(_data, isByCategory)' ,
149
+ ] ,
150
+ _load : function ( run ) {
151
+ this . _data = run ;
152
+ } ,
153
+ _getRoot : function ( data , isByCategory ) {
154
+ if ( ! this . _hasTwoProfiles ) {
155
+ this . _root = data [ 'byCategory' ] || data [ 'byProgram' ] ;
156
+ } else if ( isByCategory ) {
157
+ this . _root = data [ 'byCategory' ] ;
158
+ } else {
159
+ this . _root = data [ 'byProgram' ] ;
160
+ }
161
+ } ,
162
+ // Returns true if we have both byProgram and byCategory.
163
+ _checkProfiles : function ( data ) {
164
+ return data [ 'byProgram' ] != null && data [ 'byCategory' ] != null ;
72
165
} ,
73
- _getRoot : function ( data , breakdown ) { return data [ breakdown ] ; } ,
74
- _utilizationPercent : function ( node ) { return tf_op_profile . percent ( tf_op_profile . utilization ( node ) ) ; } ,
166
+ _utilizationPercent : function ( node ) {
167
+ return tf_op_profile . percent ( tf_op_profile . utilization ( node ) ) ; } ,
75
168
_hasFlops : function ( node ) { return node . metrics . flops > 0 ; } ,
76
- _textColor : function ( node ) { return tf_op_profile . flameColor ( tf_op_profile . utilization ( node ) , 0.7 ) ; } ,
169
+ _textColor : function ( node ) {
170
+ return tf_op_profile . flameColor ( tf_op_profile . utilization ( node ) , 0.7 ) ; } ,
77
171
} ) ;
78
172
</ script >
79
173
</ dom-module >
0 commit comments