Skip to content

Bug of pso technique. ValueError: min() arg is an empty sequence #145

@gloaming2dawn

Description

@gloaming2dawn

I am using PSO_GA_Bandit to find a good pass sequence for perlin.c in llvm-test-suite (test-suite/SingleSource/Benchmarks/Misc/perlin.c). I am using llvm 10.0.1.

To get a statistical results, I run the tuner for one hundred of times (I set --test-limit=1000), the error occurred:
Traceback (most recent call last):
File "/nobackup/scjzh/codesize/Tuner_Codesize.py", line 194, in
FlagsTuner.main(args,Oz_compile_time,Oz_codesize,O0_codesize)
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/measurement/interface.py", line 301, in main
return TuningRunMain(cls(args, *pargs, **kwargs), args).main()
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/tuningrunmain.py", line 201, in main
self.search_driver.main()
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/search/driver.py", line 272, in main
if self.run_generation_techniques() > 0:
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/search/driver.py", line 172, in run_generation_techniques
dr = self.root_technique.desired_result()
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/search/metatechniques.py", line 43, in desired_result
dr = technique.desired_result()
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/search/technique.py", line 93, in desired_result
cfg = self.desired_configuration()
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/search/technique.py", line 201, in desired_configuration
return next(self.gen)
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/search/technique.py", line 255, in call_main_generator
p = next(subgen)
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/search/pso.py", line 45, in main_generator
if objective.lt(config(particle.position), config(particle.best)):
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/search/objective.py", line 75, in lt
return self.compare(a, b) < 0
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/search/objective.py", line 62, in compare
return self.config_compare(a, b)
File "/home/home02/scjzh/.local/lib/python3.9/site-packages/opentuner/search/objective.py", line 176, in config_compare
return cmp(min(list(map(_.time, self.driver.results_query(config=config1)))),
ValueError: min() arg is an empty sequence

This error is accidental. If you run the tuner only once, everything is ok. But if you run many times, error may occur.
I have attached perlin.bc (unoptimized IR of perlin.c), sequence_Oz_llvm10.txt (passes I used) and the tuner.

tuner.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions