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',
input : 'nir_opt_algebraic.py',
output : 'nir_opt_algebraic.c',
command : [prog_python, '@INPUT@'],
capture : true,
command : [prog_python, '@INPUT@', '--out', '@OUTPUT@'],
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
# IN THE SOFTWARE.
import argparse
from collections import OrderedDict
import nir_algebraic
from nir_opcodes import type_sizes
@@ -3588,12 +3589,17 @@ before_lower_int64_optimizations = [
(('iadd', ('u2u64', a), ('u2u64', a)), ('ishl', ('u2u64', a), 1)),
]
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render())
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_before_ffma",
before_ffma_optimizations).render())
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_before_lower_int64",
before_lower_int64_optimizations).render())
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_late",
late_optimizations).render())
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_distribute_src_mods",
distribute_src_mods).render())
parser = argparse.ArgumentParser()
parser.add_argument('--out', required=True)
args = parser.parse_args()
with open(args.out, "w", encoding='utf-8') as f:
f.write(nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render())
f.write(nir_algebraic.AlgebraicPass("nir_opt_algebraic_before_ffma",
before_ffma_optimizations).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())