nir: The post-`nir_register` future
Once #9051 (closed) wraps up, no backends will need deprecated NIR functionality. This MR tracks the changes that follow that to usher in the post-nir_register
future. Each of these changes improves NIR's ergonomics. Many improve NIR's performance (shader compile-time is important to us).
-
Remove register arrays (!24253 (merged)) -
Remove abs/neg/sat modifiers (!24432 (merged)) -
Remove nir_alu_dest::write_mask
(!24432 (merged)) -
Remove nir_register_src, nir_register_dest (!24432 (merged)) -
Remove is_ssa bits (!24432 (merged)) -
Rename nir_ssa_def -> nir_def
(everything is SSA now) -
... ssa_undef -> undef
-
... nir_src_rewrite_ssa -> nir_src_rewrite
-
... nir_ssa_scalar -> nir_scalar
-
... nir_gather_ssa_types -> nir_gather_types
-
... nir_src::ssa -> nir_src::def
-
Pass around nir_def
directly instead ofnir_src
where sensible to eliminatenir_src_for_ssa
. Failing that rename tonir_src_for_def
. -
Remove nir_dest
, since it now has just one member. Put thenir_def
directly on the instruction. i.e.&instr->dest.ssa
->instr->def
.nir_dest_num_components(instr->dest)
becomesinstr->def->num_components
, likewise forbit_size
. -
Remove nir_alu_dest
, replace with justnir_def
, i.e.&alu->dest.dest.ssa
->alu->def
-
Pack nir_src
to save 8 bytes from eliminating the booleans now that theis_ssa
flag is gone (!24671 (merged))
Putting it all together, what might be written in 2022 as:
assert(alu->dest.dest.is_ssa);
assert(!alu->dest.saturate);
nir_src_rewrite_ssa(src, &alu->dest.dest.ssa);
will become
nir_src_rewrite(src, alu->def);
Isn't that better?
If any of these are contentious let me know now. Particularly the renames, once agreed to I would like to merge quickly after committing to keep conflicts at bay.
Edited by Yonggang Luo