[Mesa-dev] [PATCH 22/26] nir: Add a helper for getting the unique function in a shader
Jason Ekstrand
jason at jlekstrand.net
Sat Mar 26 21:44:48 UTC 2016
On Sat, Mar 26, 2016 at 8:12 AM, Rob Clark <robdclark at gmail.com> wrote:
> On Fri, Mar 25, 2016 at 7:12 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> >
>
> btw, will there be some point where we actually don't want to inline
> everything for vulkan and/or gl? Adreno does have call/return
> instructions (which I haven't really played with too much but I've
> seen blob use them in some cases).. and seems like at some threshold
> it would be better to have a smaller shader w/ call/ret rather than
> inline a large fxn that is called many times. (Above some size
> threshold, the shader needs to execute from external memory using
> internal memory as cache, rather than executing completely out of
> internal memory.)
>
We have them too and have since gen4, I think. We've never used them to my
knowledge. Sure, we may do so in the future, but it's probably still a
ways off.
> otoh I still have enough assumptions in the ir3 code that there is
> just a single "main" fxn. Not sure if I should try to move away from
> those assumptions.. anyways, just random question this patch reminded
> me of.
>
Same here. :-)
>
>
> Reviewed-by: Rob Clark <robdclark at gmail.com>
>
>
> > ---
> > src/compiler/nir/nir.h | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> > index d46858e..d39c5fd 100644
> > --- a/src/compiler/nir/nir.h
> > +++ b/src/compiler/nir/nir.h
> > @@ -1816,6 +1816,17 @@ typedef struct nir_shader {
> > gl_shader_stage stage;
> > } nir_shader;
> >
> > +static inline nir_function *
> > +nir_shader_get_entrypoint(nir_shader *shader)
> > +{
> > + assert(exec_list_length(&shader->functions) == 1);
> > + struct exec_node *func_node = exec_list_get_head(&shader->functions);
> > + nir_function *func = exec_node_data(nir_function, func_node, node);
> > + assert(func->return_type == glsl_void_type());
> > + assert(func->num_params == 0);
> > + return func;
> > +}
> > +
> > #define nir_foreach_function(shader, func) \
> > foreach_list_typed(nir_function, func, node, &(shader)->functions)
> >
> > --
> > 2.5.0.400.gff86faf
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160326/afaf122e/attachment.html>
More information about the mesa-dev
mailing list