[v2,17/25] libtuning: Only warn if processing returns None
diff mbox series

Message ID 20240628104828.2928109-18-stefan.klug@ideasonboard.com
State Superseded
Headers show
Series
  • Add ccm calibration to libtuning
Related show

Commit Message

Stefan Klug June 28, 2024, 10:47 a.m. UTC
There are valid cases where a module returns None. E.g no images were
provided for lsc calibration. We should however define proper semantics
there. Continue with a warning for now.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 utils/tuning/libtuning/generators/yaml_output.py | 3 +++
 utils/tuning/libtuning/libtuning.py              | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart June 29, 2024, 12:01 a.m. UTC | #1
Hi Stefan,

Thank you for the patch.

On Fri, Jun 28, 2024 at 12:47:10PM +0200, Stefan Klug wrote:
> There are valid cases where a module returns None. E.g no images were
> provided for lsc calibration. We should however define proper semantics
> there. Continue with a warning for now.

We should really differentiate between these cases. It doesn't have to
be done in this patch, but could you add it to your todo list to design
proper semantics ?

> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  utils/tuning/libtuning/generators/yaml_output.py | 3 +++
>  utils/tuning/libtuning/libtuning.py              | 4 ++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/tuning/libtuning/generators/yaml_output.py b/utils/tuning/libtuning/generators/yaml_output.py
> index 31e265df4ea7..c490081d7de7 100644
> --- a/utils/tuning/libtuning/generators/yaml_output.py
> +++ b/utils/tuning/libtuning/generators/yaml_output.py
> @@ -107,6 +107,9 @@ class YamlOutput(Generator):
>          ]
>  
>          for module in output_order:
> +            if module not in output_dict:
> +                continue
> +
>              out_lines.append(f'  - {module.out_name}:')
>  
>              if len(output_dict[module]) == 0:
> diff --git a/utils/tuning/libtuning/libtuning.py b/utils/tuning/libtuning/libtuning.py
> index 5342e5d6daaa..e7c63535fefd 100644
> --- a/utils/tuning/libtuning/libtuning.py
> +++ b/utils/tuning/libtuning/libtuning.py
> @@ -200,8 +200,8 @@ class Tuner(object):
>          for module in self.modules:
>              out = module.process(self.config, images, self.output)
>              if out is None:
> -                logger.error(f'Module {module.hr_name} failed to process...')
> -                break
> +                logger.warning(f'Module {module.hr_name} failed to process...')
> +                continue
>              self.output[module] = out
>  
>          self.generator.write(args.output, self.output, self.output_order)

Patch
diff mbox series

diff --git a/utils/tuning/libtuning/generators/yaml_output.py b/utils/tuning/libtuning/generators/yaml_output.py
index 31e265df4ea7..c490081d7de7 100644
--- a/utils/tuning/libtuning/generators/yaml_output.py
+++ b/utils/tuning/libtuning/generators/yaml_output.py
@@ -107,6 +107,9 @@  class YamlOutput(Generator):
         ]
 
         for module in output_order:
+            if module not in output_dict:
+                continue
+
             out_lines.append(f'  - {module.out_name}:')
 
             if len(output_dict[module]) == 0:
diff --git a/utils/tuning/libtuning/libtuning.py b/utils/tuning/libtuning/libtuning.py
index 5342e5d6daaa..e7c63535fefd 100644
--- a/utils/tuning/libtuning/libtuning.py
+++ b/utils/tuning/libtuning/libtuning.py
@@ -200,8 +200,8 @@  class Tuner(object):
         for module in self.modules:
             out = module.process(self.config, images, self.output)
             if out is None:
-                logger.error(f'Module {module.hr_name} failed to process...')
-                break
+                logger.warning(f'Module {module.hr_name} failed to process...')
+                continue
             self.output[module] = out
 
         self.generator.write(args.output, self.output, self.output_order)