Alan Liu commited on
Commit
6aa1c8b
1 Parent(s): 5f0df3a

add arithmetic intensity

Browse files
Files changed (2) hide show
  1. app.py +6 -2
  2. render_util.py +1 -1
app.py CHANGED
@@ -57,7 +57,7 @@ subtotal_operations = [
57
 
58
 
59
 
60
- col1, col2, col3, col4, col5 = st.columns([1,1.5,2,2,2])
61
 
62
  inference_config = {}
63
  parameter_count = {}
@@ -144,15 +144,19 @@ with col3: # Prefilling
144
 
145
  operation_items = {key: "{:,}".format(int(prefilling_operation_count[key])) for key in prefilling_operation_count if key not in subtotal_operations}
146
  subtotal_operation_items = {key: "{:,}".format(int(prefilling_operation_count[key])) for key in prefilling_operation_count if key in subtotal_operations}
 
147
  prefilling_activation_memory_count = {key: "{:,}".format(int(value)) for key, value in prefilling_activation_memory_count.items()}
148
 
 
149
  ## Convert dictionaries to pandas dataframes for table display
150
  df_operation_count = pd.DataFrame(list(operation_items.items()), columns=["Operation", "FLOPS"])
151
  df_subtotal_operation_count = pd.DataFrame(list(subtotal_operation_items.items()), columns=["Operation", "FLOPS"])
152
 
153
  df_operation_count["Activation (Byte)"] = df_operation_count["Operation"].map(prefilling_activation_memory_count)
 
154
  df_subtotal_operation_count["Activation (Byte)"] = df_subtotal_operation_count["Operation"].map(prefilling_activation_memory_count)
155
-
 
156
  header4("Inference Ops: Prefilling")
157
  st.markdown(create_table(df_operation_count))
158
 
 
57
 
58
 
59
 
60
+ col1, col2, col3, col4, col5 = st.columns([1,1.5,2.3,2.3,0.1])
61
 
62
  inference_config = {}
63
  parameter_count = {}
 
144
 
145
  operation_items = {key: "{:,}".format(int(prefilling_operation_count[key])) for key in prefilling_operation_count if key not in subtotal_operations}
146
  subtotal_operation_items = {key: "{:,}".format(int(prefilling_operation_count[key])) for key in prefilling_operation_count if key in subtotal_operations}
147
+ prefilling_arithmetic_intensity = {key: "{:.3f}".format(prefilling_operation_count[key]/prefilling_activation_memory_count[key]) for key in prefilling_activation_memory_count}
148
  prefilling_activation_memory_count = {key: "{:,}".format(int(value)) for key, value in prefilling_activation_memory_count.items()}
149
 
150
+
151
  ## Convert dictionaries to pandas dataframes for table display
152
  df_operation_count = pd.DataFrame(list(operation_items.items()), columns=["Operation", "FLOPS"])
153
  df_subtotal_operation_count = pd.DataFrame(list(subtotal_operation_items.items()), columns=["Operation", "FLOPS"])
154
 
155
  df_operation_count["Activation (Byte)"] = df_operation_count["Operation"].map(prefilling_activation_memory_count)
156
+ df_operation_count["Arithmetic Intensity"] = df_operation_count["Operation"].map(prefilling_arithmetic_intensity)
157
  df_subtotal_operation_count["Activation (Byte)"] = df_subtotal_operation_count["Operation"].map(prefilling_activation_memory_count)
158
+ df_subtotal_operation_count["Arithmetic Intensity"] = df_subtotal_operation_count["Operation"].map(prefilling_arithmetic_intensity)
159
+
160
  header4("Inference Ops: Prefilling")
161
  st.markdown(create_table(df_operation_count))
162
 
render_util.py CHANGED
@@ -4,7 +4,7 @@ def create_table(df):
4
  # Table header based on df columns
5
  header = "| " + " | ".join(df.columns) + " |"
6
  # Number of columns in df to set table divider accordingly
7
- divider = "|:---" * len(df.columns[:-1]) + "|-----:|"
8
  rows = [header, divider]
9
 
10
  for _, row in df.iterrows():
 
4
  # Table header based on df columns
5
  header = "| " + " | ".join(df.columns) + " |"
6
  # Number of columns in df to set table divider accordingly
7
+ divider = "|:---|" + "|-----:|" * len(df.columns[:-1])
8
  rows = [header, divider]
9
 
10
  for _, row in df.iterrows():