[Mesa-dev] [PATCH 2/4] nir: Silence unused "options" warning in algebraic passes.
Some passes may not refer to options->..., at which point the compiler will warn about an unused variable. Just cast to void unconditionally to shut it up. Signed-off-by: Kenneth Graunke --- src/compiler/nir/nir_algebraic.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index d05564f..53a7907 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -291,6 +291,7 @@ ${pass_name}(nir_shader *shader) bool progress = false; bool condition_flags[${len(condition_list)}]; const nir_shader_compiler_options *options = shader->options; + (void) options; % for index, condition in enumerate(condition_list): condition_flags[${index}] = ${condition}; -- 2.8.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/4] nir: Silence unused "options" warning in algebraic passes.
On 04/08/2016 01:35 AM, Kenneth Graunke wrote: Some passes may not refer to options->..., at which point the compiler will warn about an unused variable. Just cast to void unconditionally to shut it up. Signed-off-by: Kenneth Graunke --- src/compiler/nir/nir_algebraic.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index d05564f..53a7907 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -291,6 +291,7 @@ ${pass_name}(nir_shader *shader) bool progress = false; bool condition_flags[${len(condition_list)}]; const nir_shader_compiler_options *options = shader->options; + (void) options; Hmm, don't like this very much. I suppose since it is generated code, it can not be done per block where options is unused. For respect to other people's right to have clean build logs, patch is: Reviewed-by: Eduardo Lima Mitev % for index, condition in enumerate(condition_list): condition_flags[${index}] = ${condition}; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/4] nir: Silence unused "options" warning in algebraic passes.
Quoting Eduardo Lima Mitev (2016-04-08 08:26:22) > On 04/08/2016 01:35 AM, Kenneth Graunke wrote: > > Some passes may not refer to options->..., at which point the compiler > > will warn about an unused variable. Just cast to void unconditionally > > to shut it up. > > > > Signed-off-by: Kenneth Graunke > > --- > > src/compiler/nir/nir_algebraic.py | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/src/compiler/nir/nir_algebraic.py > > b/src/compiler/nir/nir_algebraic.py > > index d05564f..53a7907 100644 > > --- a/src/compiler/nir/nir_algebraic.py > > +++ b/src/compiler/nir/nir_algebraic.py > > @@ -291,6 +291,7 @@ ${pass_name}(nir_shader *shader) > > bool progress = false; > > bool condition_flags[${len(condition_list)}]; > > const nir_shader_compiler_options *options = shader->options; > > + (void) options; > > > > Hmm, don't like this very much. I suppose since it is generated code, it > can not be done per block where options is unused. > For respect to other people's right to have clean build logs, patch is: > > Reviewed-by: Eduardo Lima Mitev > > > % for index, condition in enumerate(condition_list): > > condition_flags[${index}] = ${condition}; > > > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev I'm not familiar with the code, but looking at it options must be used in the condition_list argument? signature.asc Description: signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/4] nir: Silence unused "options" warning in algebraic passes.
On Friday, April 8, 2016 11:18:46 AM PDT Dylan Baker wrote: > Quoting Eduardo Lima Mitev (2016-04-08 08:26:22) > > On 04/08/2016 01:35 AM, Kenneth Graunke wrote: > > > Some passes may not refer to options->..., at which point the compiler > > > will warn about an unused variable. Just cast to void unconditionally > > > to shut it up. > > > > > > Signed-off-by: Kenneth Graunke > > > --- > > > src/compiler/nir/nir_algebraic.py | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/ nir_algebraic.py > > > index d05564f..53a7907 100644 > > > --- a/src/compiler/nir/nir_algebraic.py > > > +++ b/src/compiler/nir/nir_algebraic.py > > > @@ -291,6 +291,7 @@ ${pass_name}(nir_shader *shader) > > > bool progress = false; > > > bool condition_flags[${len(condition_list)}]; > > > const nir_shader_compiler_options *options = shader->options; > > > + (void) options; > > > > > > > Hmm, don't like this very much. I suppose since it is generated code, it > > can not be done per block where options is unused. > > For respect to other people's right to have clean build logs, patch is: > > > > Reviewed-by: Eduardo Lima Mitev > > > > > % for index, condition in enumerate(condition_list): > > > condition_flags[${index}] = ${condition}; > > > > > > > I'm not familiar with the code, but looking at it options must be used > in the condition_list argument? Right, we create the 'options' temporary so you can write rules like: (('~fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'), where !options->lower_fsat becomes part of the condition_list. However, conditions are optional. If you have an algebraic rule list which doesn't include any conditions referring to options->..., the variable will be unused. (For example, the list in patch 4 meets this criteria.) signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/4] nir: Silence unused "options" warning in algebraic passes.
Quoting Kenneth Graunke (2016-04-08 11:48:01) > On Friday, April 8, 2016 11:18:46 AM PDT Dylan Baker wrote: > > > Quoting Eduardo Lima Mitev (2016-04-08 08:26:22) > > > On 04/08/2016 01:35 AM, Kenneth Graunke wrote: > > > > Some passes may not refer to options->..., at which point the compiler > > > > will warn about an unused variable. Just cast to void unconditionally > > > > to shut it up. > > > > > > > > Signed-off-by: Kenneth Graunke > > > > --- > > > > src/compiler/nir/nir_algebraic.py | 1 + > > > > 1 file changed, 1 insertion(+) > > > > > > > > diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/ > nir_algebraic.py > > > > index d05564f..53a7907 100644 > > > > --- a/src/compiler/nir/nir_algebraic.py > > > > +++ b/src/compiler/nir/nir_algebraic.py > > > > @@ -291,6 +291,7 @@ ${pass_name}(nir_shader *shader) > > > > bool progress = false; > > > > bool condition_flags[${len(condition_list)}]; > > > > const nir_shader_compiler_options *options = shader->options; > > > > + (void) options; > > > > > > > > > > Hmm, don't like this very much. I suppose since it is generated code, it > > > can not be done per block where options is unused. > > > For respect to other people's right to have clean build logs, patch is: > > > > > > Reviewed-by: Eduardo Lima Mitev > > > > > > > % for index, condition in enumerate(condition_list): > > > > condition_flags[${index}] = ${condition}; > > > > > > > > > > > I'm not familiar with the code, but looking at it options must be used > > in the condition_list argument? > > Right, we create the 'options' temporary so you can write rules like: > > (('~fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'), > > where !options->lower_fsat becomes part of the condition_list. However, > conditions are optional. If you have an algebraic rule list which doesn't > include any conditions referring to options->..., the variable will be > unused. (For example, the list in patch 4 meets this criteria.) > So what about wrapping the definitions of options in a conditional? % if 'options' in conditions[-1]: const nir_shader_compiler_options *options = shader->options; % endif This only covers that options is the last argument, which seems to be what nir_opt_algebraic does, although I don't know that is actually a hard requirement, or just a coincidence. Dylan signature.asc Description: signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/4] nir: Silence unused "options" warning in algebraic passes.
Quoting Dylan Baker (2016-04-08 14:54:38) > Quoting Kenneth Graunke (2016-04-08 11:48:01) > > On Friday, April 8, 2016 11:18:46 AM PDT Dylan Baker wrote: > > > > Quoting Eduardo Lima Mitev (2016-04-08 08:26:22) > > > > On 04/08/2016 01:35 AM, Kenneth Graunke wrote: > > > > > Some passes may not refer to options->..., at which point the compiler > > > > > will warn about an unused variable. Just cast to void unconditionally > > > > > to shut it up. > > > > > > > > > > Signed-off-by: Kenneth Graunke > > > > > --- > > > > > src/compiler/nir/nir_algebraic.py | 1 + > > > > > 1 file changed, 1 insertion(+) > > > > > > > > > > diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/ > > nir_algebraic.py > > > > > index d05564f..53a7907 100644 > > > > > --- a/src/compiler/nir/nir_algebraic.py > > > > > +++ b/src/compiler/nir/nir_algebraic.py > > > > > @@ -291,6 +291,7 @@ ${pass_name}(nir_shader *shader) > > > > > bool progress = false; > > > > > bool condition_flags[${len(condition_list)}]; > > > > > const nir_shader_compiler_options *options = shader->options; > > > > > + (void) options; > > > > > > > > > > > > > Hmm, don't like this very much. I suppose since it is generated code, it > > > > can not be done per block where options is unused. > > > > For respect to other people's right to have clean build logs, patch is: > > > > > > > > Reviewed-by: Eduardo Lima Mitev > > > > > > > > > % for index, condition in enumerate(condition_list): > > > > > condition_flags[${index}] = ${condition}; > > > > > > > > > > > > > > > I'm not familiar with the code, but looking at it options must be used > > > in the condition_list argument? > > > > Right, we create the 'options' temporary so you can write rules like: > > > > (('~fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'), > > > > where !options->lower_fsat becomes part of the condition_list. However, > > conditions are optional. If you have an algebraic rule list which doesn't > > include any conditions referring to options->..., the variable will be > > unused. (For example, the list in patch 4 meets this criteria.) > > > > So what about wrapping the definitions of options in a conditional? > % if 'options' in conditions[-1]: > const nir_shader_compiler_options *options = shader->options; > % endif > > This only covers that options is the last argument, which seems to be > what nir_opt_algebraic does, although I don't know that is actually a > hard requirement, or just a coincidence. > > Dylan Never mind. Jason and I talked about this and this might possibly work, by accident. Please ignore. Dylan signature.asc Description: signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev