okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
98d1c8d4f
main
1import pathlib ,shlex ,subprocess 2import argparse 3p = argparse .ArgumentParser ();p .add_argument ('--source' ,type = pathlib .Path ,required = True );p .add_argument ('--build' ,type = pathlib .Path ,required = True );p .add_argument ('--out' ,type = pathlib .Path ,required = True );a = p .parse_args () 4r = pathlib .Path (__file__ ).resolve ().parent ;build = a .build .resolve ();a .out .mkdir (parents = True ,exist_ok = True ) 5cmds = subprocess .check_output (['ninja' ,'-C' ,str (build ),'-t' ,'commands' ,'strata' ],text = True ).splitlines () 6c = shlex .split (next (x for x in cmds if ' -c ' in x and str (a .source .resolve ()/ 'sycl/src/program/generate.cpp' )in x )) 7oldobj = c [c .index ('-o' )+ 1 ];obj = a .out / 'gemm-stride-check.o' 8c [c .index ('-c' )+ 1 ]= str (r / 'gemm-stride-check.cpp' ) 9for opt ,val in [('-o' ,str (obj )),('-MF' ,str (obj )+ '.d' ),('-MT' ,str (obj ))]:c [c .index (opt )+ 1 ]= val 10subprocess .run (c ,cwd = build ,check = True ) 11l = shlex .split (cmds [- 1 ].removeprefix (': && ' ).removesuffix (' && :' ));l [l .index ('-o' )+ 1 ]= str (a .out / 'gemm-stride-check' );l [l .index (oldobj )]= str (obj ) 12l = [('-Wl,--dependency-file=' + str (a .out / 'gemm-stride-link.d' ))if x .startswith ('-Wl,--dependency-file=' )else x for x in l ] 13subprocess .run (l ,cwd = build ,check = True )