jansel / opentuner

An extensible framework for program autotuning
http://opentuner.org/
MIT License
382 stars 112 forks source link

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

Open gloaming2dawn opened 3 years ago

gloaming2dawn commented 3 years ago

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 configcompare 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