33"""
44quickTuner preprocessor script to combine .debug output files from tuningRunner.py or tuna-script.sh
55
6- Usage: quickTunerPreprocess .py [-h] --input-dir INPUT_DIR --output OUTPUT [--op {gemm,conv}] [-d] [--file-ext FILE_EXT]
6+ Usage: quickTunerPreproc .py [-h] --input-dir INPUT_DIR --output OUTPUT [--op {gemm,conv}] [-d] [--file-ext FILE_EXT]
77
88Example Usage:
99
10- python3 quickTunerPreprocess .py --input_dir /path/to/debug/files --ouput combined_data
10+ python3 quickTunerPreproc .py --input-dir /path/to/debug/files --no-splitK --output combined_data
1111
1212
1313Note:
@@ -106,7 +106,7 @@ def __get_stats_conv(df, ct):
106106
107107
108108 @staticmethod
109- def process (input_dir , output_name = None , op = 'gemm' , file_ext = "debug" , debug = False , normalize = True ):
109+ def process (input_dir , output_name = None , op = 'gemm' , file_ext = "debug" , debug = False , normalize = True , no_splitK = False ):
110110 """
111111 staticmethod process() function that compiles output files into a single dataframe and saves to tsv file
112112 """
@@ -126,6 +126,11 @@ def process(input_dir, output_name=None, op='gemm', file_ext="debug", debug=Fals
126126 return None
127127 new_df = pd .concat (dfs , ignore_index = True )
128128
129+ # Remove splitK from tuning data
130+ if no_splitK :
131+ df_filtered = new_df [new_df ['PerfConfig' ].str .extract (r'.*,(\d+),\d+,\d+' )[0 ] == '1' ]
132+ new_df = df_filtered
133+
129134 if output_name :
130135 new_df .to_csv (output_name , sep = '\t ' , index = False )
131136 if debug :
@@ -176,11 +181,16 @@ def main(args=None):
176181 default = True ,
177182 action = 'store_true' ,
178183 help = 'Normalize on a per-file basis, necessary for quickTunerGen to work' )
184+
185+ parser .add_argument ('--no-splitK' ,
186+ default = False ,
187+ action = 'store_true' ,
188+ help = 'Removing the spliK factor from the generated list' )
179189
180190 pargs = parser .parse_args ()
181191
182192
183- qtPreprocessor .process (pargs .input_dir , pargs .output , pargs .op , pargs .file_ext , pargs .debug )
193+ qtPreprocessor .process (pargs .input_dir , pargs .output , pargs .op , pargs .file_ext , pargs .debug , pargs . normalize , pargs . no_splitK )
184194
185195if __name__ == '__main__' :
186196 main (sys .argv [1 :])
0 commit comments