[Mesa-dev] [PATCH v0] nir: mako all the intrinsics
Dylan Baker
dylan at pnwbakers.com
Fri Mar 16 18:58:59 UTC 2018
Quoting Rob Clark (2018-03-16 11:45:56)
> On Fri, Mar 16, 2018 at 2:28 PM, Dylan Baker <dylan at pnwbakers.com> wrote:
> > Quoting Rob Clark (2018-03-15 18:43:28)
> >> I threatened to do this a long time ago.. I probably *should* have done
> >> it a long time ago when there where many fewer intrinsics. But the
> >> system of macro/#include magic for dealing with intrinsics is a bit
> >> annoying, and python has the nice property of optional fxn params,
> >> making it possible to define new intrinsics while ignoring parameters
> >> that are not applicable (and naming optional params). And not having to
> >> specify various array lengths explicitly is nice too.
> >>
> >> I think the end result makes it easier to add new intrinsics.
> >> ---
> >> I still need to update autotools build.. but it's late and my wrist
> >> needs a break so I thought I'd send it out as-is to solicit comments
> >> on the py bits, etc
> >>
> >> src/compiler/nir/meson.build | 22 +-
> >> src/compiler/nir/nir.h | 9 -
> >> src/compiler/nir/nir_builder.h | 27 +-
> >> src/compiler/nir/nir_builder_opcodes_h.py | 24 +-
> >> src/compiler/nir/nir_intrinsics.h | 540 --------------------
> >> src/compiler/nir/nir_intrinsics.py | 547 +++++++++++++++++++++
> >> .../nir/{nir_intrinsics.c => nir_intrinsics_c.py} | 56 +--
> >> src/compiler/nir/nir_intrinsics_h.py | 44 ++
> >> 8 files changed, 659 insertions(+), 610 deletions(-)
> >> delete mode 100644 src/compiler/nir/nir_intrinsics.h
> >> create mode 100644 src/compiler/nir/nir_intrinsics.py
> >> rename src/compiler/nir/{nir_intrinsics.c => nir_intrinsics_c.py} (59%)
> >> create mode 100644 src/compiler/nir/nir_intrinsics_h.py
> >>
> >> diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
> >> index a70c236b958..ca9237e2ba3 100644
> >> --- a/src/compiler/nir/meson.build
> >> +++ b/src/compiler/nir/meson.build
> >> @@ -65,6 +65,24 @@ nir_opt_algebraic_c = custom_target(
> >> depend_files : files('nir_algebraic.py'),
> >> )
> >>
> >> +nir_intrinsics_h = custom_target(
> >> + 'nir_intrinsics.h',
> >> + input : 'nir_intrinsics_h.py',
> >> + output : 'nir_intrinsics.h',
> >> + command : [prog_python2, '@INPUT@'],
> >> + capture : true,
> >
> > Since we're writing a new generator can we not require capture? It has all sorts
> > of problems if you want to write symbols that an end user's terminal
> > cannot properly decode. (think UTF-8 for people who refuse to move on from the C
> > days)
>
> tbh, I have no idea what capture does.. I just copy/pasta from the
> existing examples. It does work more or less exactly the same way
> that the other py generated files work, so I guess if they need
> 'capture', this does to?
'capture' is meson's equivalent of autotools shell redirect, so if you print you
need capture.
src/vulkan/util/gen_enum_to_str.py doesn't use capture, (and I wrote most of it,
so I know it's good :) ), if you want something to look at.
>
> Ofc, give me hints about what needs to change in
> nir_intrinsics_[ch].py to not need this
>
> (and even better, fix the other codegen cases so next idiot like me
> who comes along and clones an existing example dtrt ;-))
It's on my list of things to do, after meson gets settled (which it seems like
it's settling pretty well at this point.) :)
Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180316/afacfb28/attachment.sig>
More information about the mesa-dev
mailing list