facebookresearch / CompilerGym

Reinforcement learning environments for compiler and program optimization tasks
https://compilergym.ai/
MIT License
885 stars 123 forks source link

[llmv] Remove broken random_benchmark() implementation for POJ104. #757

Closed ChrisCummins closed 1 year ago

ChrisCummins commented 1 year ago

Fix for:

Traceback (most recent call last):
  File "scratch.py", line 70, in <module>
    main()
  File "scratch.py", line 65, in main
    for b in sbs:
  File "scratch.py", line 55, in simple_benchmark_sampler
    yield(datasets[index].random_benchmark(rng))
  File "/Users/hleather/opt/miniconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym/envs/llvm/datasets/poj104.py", line 146, in random_benchmark
    return self._get_benchmark_by_index(random_state.integers(self.size))
AttributeError: 'POJ104Dataset' object has no attribute '_get_benchmark_by_index'

Now produces:

$ python
Python 3.10.4 (main, Mar 31 2022, 08:41:55) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import compiler_gym
>>> env = compiler_gym.make("llvm-v0")
>>> env.reset()
>>> env.datasets["poj104-v0"].random_benchmark()
Installing the benchmark://poj104-v0 dataset. This may take a few moments ...
benchmark://poj104-v0/12837
>>> env.datasets["poj104-v0"].random_benchmark()
benchmark://poj104-v0/20713
codecov-commenter commented 1 year ago

Codecov Report

Merging #757 (60f5e65) into development (4133f5f) will decrease coverage by 0.01%. The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #757      +/-   ##
===============================================
- Coverage        89.16%   89.14%   -0.02%     
===============================================
  Files              130      130              
  Lines             7864     7859       -5     
===============================================
- Hits              7012     7006       -6     
- Misses             852      853       +1     
Impacted Files Coverage Δ
compiler_gym/envs/llvm/datasets/poj104.py 76.81% <ø> (+1.13%) :arrow_up:
...loop_tool/service/loop_tool_compilation_session.py 89.86% <0.00%> (-0.68%) :arrow_down:
...ompiler_gym/service/client_service_compiler_env.py 90.87% <0.00%> (-0.43%) :arrow_down: