[Mesa-dev] [PATCH 00/21] Towards NIR support for etnaviv

Lucas Stach l.stach at pengutronix.de
Wed Sep 5 13:09:09 UTC 2018


Hi Christian,

Am Dienstag, den 05.06.2018, 17:43 +0200 schrieb Christian Gmeiner:
> Am Di., 5. Juni 2018 um 16:40 Uhr schrieb Philipp Zabel
> > <p.zabel at pengutronix.de>:
> > 
> > Hi!
> > 
> > we have been interested in NIR support for etnaviv for a while, for the
> > obvious reasons: gaining access to common optimizations, better support
> > for non-trivial code transformations, better register allocation, and
> > the promise of OpenCL and SPIR-V support in the future.
> > 
> > Michael and I have used our annual exploratory "tech week" last year
> > and last week to get acquainted with NIR and the Vivante GPUs a bit and
> > to get started compiling NIR shaders from the GLSL compiler to Vivante
> > machine code.
> > 
> > The following patches are still very much work in progress. Until now,
> > this has only been tested with kmscube, weston, and glmark2 (and some
> > benchmarks are not working yet, missing instruction implementations).
> > We haven't even dared to run piglit yet. At this point we'd very much
> > like some feedback on where we are on the right path, and where things
> > could be done in a better way.
> > The NIR compiler is placed next to the current TGSI translation layer,
> > and still uses the same backend for code emission. NIR support is
> > disabled by default, and can be enabled using the etnaviv environment
> > option: ETNA_MESA_DEBUG="nir", so this could be merged without side
> > effects, once it is deemed acceptable, to support further development
> > in-tree.
> > 
> > Due to the shared global register file, reducing the amount of temporary
> > registers used by a shader is important for parallelism. We have added
> > added a layer of virtual registers with less than four components over
> > each vec4 base register using the register allocator utility, and use
> > source swizzles and destination write masks to reuse the free components
> > of partially occupied registers if possible.
> > We use the NIR global registers, indexed to represent the registers in
> > the global temporary register file, which allows us to do register
> > assignment in NIR and then reuse the current code emitter without
> > introducing another intermediate representation.
> > 
> > There are already a few Vivante specific lowering passes, but we
> > notably are still missing support for loops, and for lowering sin,
> > cos and log functions to the Vivante specific hardware instructions
> > that need prescaling and post-multiplication of the results' x and
> > y components (or to replace them with approximations where the
> > instructions are not supported).
> > 
> 
> Thanks for this nice patch series. I have been working for too long on
> the nir topic
> for etnaviv and never pushed any patches (which is quite sad). I have taken
> another route to tackle it. I have started with a low level library to
> generate valid
> Vivante binaries and to be able to disassemble them. On top of this, I
> have an eir
> library which is a simple block based ir which makes use of the low-level lib.
> And the last thing is the actual compiler which is nir based. All life outside
> of the gallium driver and have some gtest based unit tests. My main goal was to
> start from a green field without looking at the current tgsi based compiler.
> 
> I will have a deeper look at your patches and review them. I am quite
> unsure what I
> will do with my current code. I think the best would be to clean it up
> and push it.

Did you get a chance to look at this? Will you be able to provide some
review comments? This code is already starting to bitrot and it would
be a shame if the work that has gone into this is going down the drain
due to being stuck on the mailinglist.

Regards,
Lucas


More information about the mesa-dev mailing list