[Mesa-dev] [PATCH 00/56] Die copy-and-paste code, die
Rob Clark
robdclark at gmail.com
Fri Jul 22 22:58:37 UTC 2016
On Tue, Jul 19, 2016 at 3:24 PM, Ian Romanick <idr at freedesktop.org> wrote:
> After seeing Dave's series to add support GL_ARB_shader_gpu_int64 and
> thinking about adding support for 8- and 16-bit integers, I decided
> that something had to be done about the cut-and-paste madness that is
> ir_constant_expression.cpp. I decided to take a page from Jason's book
> and generate it from a machine description of the expressions. The
> result is this series.
fwiw, I did go down the path of adding half-precision types in IR for
a spell, but ended up deciding it was a maddening explosion of
builtin-types and builtin-functions..
At some point (ie. might be a month or two or more before I get to
it), I was going to go back to my original idea of just keeping things
as-is in glsl IR (as type+precision-qualifier for <=32b types), and
dealing with it in glsl->nir. Basically just need to add a
precision-visitor (which I think I already pushed on a branch
somewhere) to infer an expression's precision, and wire that up in a
few places (function inlining and various other places where
intermediate vars are created in ir), and mapping type+precision to
nir type in glsl_to_nir.
(Not an argument against autogenerating some of the IR bits.. I think
that would be a really good idea, I'm a much bigger fan of how some of
that is handled in NIR.. maybe there is some room to autogen some of
the builtin-types and builtin-functions, which might make me
reconsider..)
BR,
-R
> You may notice from some of the earlier patches in this series that I
> started this work over a year ago. The previous work was an attempt to
> generate opt_algebraic.cpp which was ultimately abandonded. It may be
> worth picking that up again.
>
> I haven't done *anything* for SCons, so hopefully Jose or someone can
> help out there.
>
> All of this is available at:
>
> https://cgit.freedesktop.org/~idr/mesa/log/?h=generated-glsl-ir
>
> Other possible follow-up work:
>
> - A few expressions don't have constant evaluation support. I don't
> think I've seen a real shader use any of these, so there's a reason
> we haven't "missed" them.
>
> - frexp_sig
> - frexp_exp
> - vote_any
> - vote_all
> - vote_eq
> - imul_high
> - carry
> - borrow
>
> - Generate validation code for expressions. A few times while
> developing this series I had questions about what the IR actually
> supported. In quite a few cases the IR support is different from
> what GLSL supports. I would often look to ir_validate.cpp to answer
> these questions, and I was almost always disappointed. I would
> really like to see missing type information added to
> ir_expression_operation.py and generate a much more complete set of
> validations for ir_expression. Then the assertions remaining in
> ir_expression_operation_constant.h could be removed.
>
> - Generate ir_expression constructors.
>
> - Generate ir_builder. We don't support every possible expression in
> ir_builder, so this may not be worth the effort.
>
> src/compiler/Android.glsl.gen.mk | 2 +-
> src/compiler/Makefile.glsl.am | 24 +-
> src/compiler/Makefile.sources | 8 +-
> src/compiler/glsl/.gitignore | 2 +
> src/compiler/glsl/ir.cpp | 133 +-
> src/compiler/glsl/ir.h | 329 +----
> src/compiler/glsl/ir_constant_expression.cpp | 1332 ++----------------
> src/compiler/glsl/ir_expression_operation.py | 738 ++++++++++
> src/compiler/glsl/ir_print_visitor.cpp | 2 +-
> src/compiler/glsl/ir_validate.cpp | 11 +
> src/compiler/glsl/lower_mat_op_to_vec.cpp | 2 +-
> src/mesa/Makefile.sources | 1 +
> src/mesa/drivers/dri/i965/Makefile.am | 1 +
> 13 files changed, 901 insertions(+), 1684 deletions(-)
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list