nir: Stop using "capture : true" for nir_opt_algebraic

"calture : true" is suboptimal and and prevents the script from writing
multiple files in one go.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30041>
This commit is contained in:
Konstantin Seurer
2024-07-04 15:25:43 +02:00
committed by Marge Bot
parent b018489245
commit d9e41e8a8c
2 changed files with 16 additions and 11 deletions

View File

@@ -45,8 +45,7 @@ nir_opt_algebraic_c = custom_target(
'nir_opt_algebraic.c', 'nir_opt_algebraic.c',
input : 'nir_opt_algebraic.py', input : 'nir_opt_algebraic.py',
output : 'nir_opt_algebraic.c', output : 'nir_opt_algebraic.c',
command : [prog_python, '@INPUT@'], command : [prog_python, '@INPUT@', '--out', '@OUTPUT@'],
capture : true,
depend_files : nir_algebraic_depends, depend_files : nir_algebraic_depends,
) )

View File

@@ -21,6 +21,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE. # IN THE SOFTWARE.
import argparse
from collections import OrderedDict from collections import OrderedDict
import nir_algebraic import nir_algebraic
from nir_opcodes import type_sizes from nir_opcodes import type_sizes
@@ -3588,12 +3589,17 @@ before_lower_int64_optimizations = [
(('iadd', ('u2u64', a), ('u2u64', a)), ('ishl', ('u2u64', a), 1)), (('iadd', ('u2u64', a), ('u2u64', a)), ('ishl', ('u2u64', a), 1)),
] ]
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render()) parser = argparse.ArgumentParser()
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_before_ffma", parser.add_argument('--out', required=True)
before_ffma_optimizations).render()) args = parser.parse_args()
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_before_lower_int64",
before_lower_int64_optimizations).render()) with open(args.out, "w", encoding='utf-8') as f:
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_late", f.write(nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render())
late_optimizations).render()) f.write(nir_algebraic.AlgebraicPass("nir_opt_algebraic_before_ffma",
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_distribute_src_mods", before_ffma_optimizations).render())
distribute_src_mods).render()) f.write(nir_algebraic.AlgebraicPass("nir_opt_algebraic_before_lower_int64",
before_lower_int64_optimizations).render())
f.write(nir_algebraic.AlgebraicPass("nir_opt_algebraic_late",
late_optimizations).render())
f.write(nir_algebraic.AlgebraicPass("nir_opt_algebraic_distribute_src_mods",
distribute_src_mods).render())