[Mesa-dev] [PATCH 00/12] nir: Functions!

Jason Ekstrand jason at jlekstrand.net
Sat Dec 26 11:09:23 PST 2015


This little series adds the basics of what we need to actually do functions
in NIR.  We've had NIR function support in theory for some time, but it's
never been used beyond the single-function "void main()" casae.  This
series gives us what we need to do it for real.

The first patch, I would like to merge ASAP as it touches the universe.
Fortunately, 90% of the patch is simply s/function/overload/g on all of
glsl/nir/nir*.c.  The rest is still fairly trivial.

The next 9 patches are either minor fixes or prep work for the last two.
These can wait a bit if they have to, but I wouldn't mind landing them now.

The last 2 I'm calling RFC's.  As far as I can tell, they *mostly* work,
but they're only about 90% complete.  I wanted to send them out for comment
anyway.

How did I test these patches?  I used my SPIR-V branch.  I'm hoping to
try to start upstreaming the SPIR-V stuff before too much longer and this
is a very small portion of the prep-work.

Jason Ekstrand (12):
  nir: Get rid of function overloads
  nir: Create the params array in function_impl_create
  nir: Add a helper for creating a "bare" nir_function_impl
  nir/clone: Add support for cloning a single function_impl
  nir/print: Factor variable name lookup into a helper
  nir/cf: Handle relinking top-level blocks
  nir: Add a function for comparing cursors
  nir/cf: Make extracting or re-inserting nothing a no-op
  nir/types: Expose the bool type
  nir/builder: Add helpers for easily inserting copy_var intrinsics
  nir: Add return lowering pass
  nir: Add a pass to inline functions

 src/gallium/auxiliary/nir/tgsi_to_nir.c            |   3 +-
 .../drivers/freedreno/ir3/ir3_compiler_nir.c       |   8 +-
 .../drivers/freedreno/ir3/ir3_nir_lower_if_else.c  |   6 +-
 src/gallium/drivers/vc4/vc4_nir_lower_blend.c      |   8 +-
 src/gallium/drivers/vc4/vc4_nir_lower_io.c         |   6 +-
 src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c     |   6 +-
 src/gallium/drivers/vc4/vc4_program.c              |  14 +-
 src/glsl/Makefile.sources                          |   2 +
 src/glsl/nir/glsl_to_nir.cpp                       |  52 ++---
 src/glsl/nir/nir.c                                 | 124 ++++++++---
 src/glsl/nir/nir.h                                 |  59 +++--
 src/glsl/nir/nir_algebraic.py                      |   6 +-
 src/glsl/nir/nir_builder.h                         |  25 ++-
 src/glsl/nir/nir_clone.c                           | 143 +++++++-----
 src/glsl/nir/nir_control_flow.c                    |  16 +-
 src/glsl/nir/nir_dominance.c                       |  28 +--
 src/glsl/nir/nir_from_ssa.c                        |   6 +-
 src/glsl/nir/nir_gs_count_vertices.c               |   6 +-
 src/glsl/nir/nir_inline_functions.c                | 138 ++++++++++++
 src/glsl/nir/nir_lower_alu_to_scalar.c             |   6 +-
 src/glsl/nir/nir_lower_atomics.c                   |   8 +-
 src/glsl/nir/nir_lower_clip.c                      |  18 +-
 src/glsl/nir/nir_lower_global_vars_to_local.c      |   8 +-
 src/glsl/nir/nir_lower_gs_intrinsics.c             |  12 +-
 src/glsl/nir/nir_lower_idiv.c                      |   6 +-
 src/glsl/nir/nir_lower_io.c                        |   6 +-
 src/glsl/nir/nir_lower_load_const_to_scalar.c      |   6 +-
 src/glsl/nir/nir_lower_locals_to_regs.c            |   8 +-
 src/glsl/nir/nir_lower_outputs_to_temporaries.c    |  12 +-
 src/glsl/nir/nir_lower_phis_to_scalar.c            |   6 +-
 src/glsl/nir/nir_lower_returns.c                   | 243 +++++++++++++++++++++
 src/glsl/nir/nir_lower_samplers.c                  |   6 +-
 src/glsl/nir/nir_lower_system_values.c             |   6 +-
 src/glsl/nir/nir_lower_tex.c                       |   6 +-
 src/glsl/nir/nir_lower_to_source_mods.c            |   6 +-
 src/glsl/nir/nir_lower_two_sided_color.c           |   6 +-
 src/glsl/nir/nir_lower_var_copies.c                |   6 +-
 src/glsl/nir/nir_lower_vars_to_ssa.c               |   8 +-
 src/glsl/nir/nir_lower_vec_to_movs.c               |   8 +-
 src/glsl/nir/nir_metadata.c                        |  12 +-
 src/glsl/nir/nir_move_vec_src_uses_to_dest.c       |   6 +-
 src/glsl/nir/nir_normalize_cubemap_coords.c        |   6 +-
 src/glsl/nir/nir_opt_constant_folding.c            |   6 +-
 src/glsl/nir/nir_opt_copy_propagate.c              |   4 +-
 src/glsl/nir/nir_opt_cse.c                         |   6 +-
 src/glsl/nir/nir_opt_dce.c                         |   4 +-
 src/glsl/nir/nir_opt_dead_cf.c                     |   6 +-
 src/glsl/nir/nir_opt_gcm.c                         |   6 +-
 src/glsl/nir/nir_opt_peephole_select.c             |   6 +-
 src/glsl/nir/nir_opt_remove_phis.c                 |   6 +-
 src/glsl/nir/nir_opt_undef.c                       |   8 +-
 src/glsl/nir/nir_print.c                           |  94 ++++----
 src/glsl/nir/nir_remove_dead_variables.c           |  14 +-
 src/glsl/nir/nir_split_var_copies.c                |   6 +-
 src/glsl/nir/nir_sweep.c                           |   9 +-
 src/glsl/nir/nir_to_ssa.c                          |   6 +-
 src/glsl/nir/nir_types.cpp                         |   6 +
 src/glsl/nir/nir_types.h                           |   1 +
 src/glsl/nir/nir_validate.c                        |  25 +--
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp           |  16 +-
 src/mesa/drivers/dri/i965/brw_nir.c                |  50 ++---
 .../dri/i965/brw_nir_analyze_boolean_resolves.c    |   7 +-
 .../drivers/dri/i965/brw_nir_opt_peephole_ffma.c   |   6 +-
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp         |  16 +-
 src/mesa/program/prog_to_nir.c                     |   3 +-
 65 files changed, 933 insertions(+), 449 deletions(-)
 create mode 100644 src/glsl/nir/nir_inline_functions.c
 create mode 100644 src/glsl/nir/nir_lower_returns.c

-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list