-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor out Env interface from CompilerEnv #633
Refactor out Env interface from CompilerEnv #633
Conversation
Codecov Report
@@ Coverage Diff @@
## development #633 +/- ##
===============================================
- Coverage 88.48% 87.94% -0.54%
===============================================
Files 115 116 +1
Lines 7066 7372 +306
===============================================
+ Hits 6252 6483 +231
- Misses 814 889 +75
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not 100% sure what the use case is for splitting interface / implementation like this, but I guess there's no harm in it.
However, I think the naming needs rethinking. Env
implies that it isn't specific to compilers, which I believe it is, so I think the two choices are either:
- Pick a name that makes it clear it is describing the compiler env, like
CompilerEnvInterface
orCompilerEnvBase
. - Call it
CompilerEnv
and rename the currentCompilerEnv
to make it clear that it is an implementation of CompilerEnv, likeClientServiceCompilerEnv
or even justCompilerEnvImplementation
.
I think option 2 makes more sense to me. That way, all of the type hints for CompilerEnv
now refer to the abstract interface. This may need updating code that refers to CompilerEnv
and handles implementation details like interacting with env.service
.
What do you think?
Cheers,
Chris
The idea is to follow the dependency inversion principle and open–closed principle. Users that write algorithms against this library would know to use only this interface and it will be stable upon changing the implementation. It may not be planed currently to have a different compiler service, but this leaves the door open. It makes clear to someone else who wants to make an environment what is the required interface to work with the algorithms.
My intention was to not introduce a breaking change and since |
Thanks @sogartar!
Yeah, I don't know if there's demand for this. But, as I said, I don't think it'll hurt, and it does seem like better practice to clearly delineate interface/implementation 🙂
Yes, I think this is worth a breaking change. Make Cheers, |
72e7740
to
4a79017
Compare
@ChrisCummins, I made the renaming. Can you let me know what else should be included or removed in the interface? I don't think I can make the call. I am not sure that the
Ideally, general algorithms should depend only on CompilerEnv. |
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a module docstring saying that this module defines an implementation of CompilerEnv interface using client/server approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
|
||
class ClientServiceCompilerEnv(CompilerEnv): | ||
"""An OpenAI gym environment for compiler optimizations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docstring should be on the CompilerEnv
base class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved a part of it to CompilerEnv
.
|
||
:raises TimeoutError: If the compiler service fails to initialize within | ||
the parameters provided in :code:`connection_settings`. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to invoke gym.Env superclass constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither CompilerEnv
or gym.Env
have __init__(...)
.
Thanks for the update @sogartar. IMO everything that isn't solely relevant to the client/server design should be part of the This would make
I wondered about whether it should be One that could be worth doing now to highlight that Another question is whether @property
@abstractmethod
def episode_walltime(self) -> float:
raise NotImplementedError("abstract method") this seems like it would be straightforward enough bit of housekeeping for Cheers, |
Some of the details are not properly isolated. For example |
Yeah, I think they are candidates for future refactoring, but we unfortunately can't get away from dropping them completely from the Cheers, |
@ChrisCummins, I think this PR is ready for another code-review. I did what you suggested. One thing to note is that moving |
I am not sure why this failure https://github.com/facebookresearch/CompilerGym/runs/5669835818?check_suite_focus=true#step:8:213 started appearing now. It should have triggered before also, since |
Is the problem the UserWarning? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sogartar, this is coming along great! I've come around to like the separation of interface / gRPC implementation and am already thinking of environments I'd like to implement that aren't based on this client / service design 🙂
Last few nitpicky requests left inline.
Also, I think there's a handful of files where the class name has been updated where it doesn't need to be. Please revert them (unless I'm wrong!):
benchmarks/bench_test.py
compiler_gym/bin/service.py
compiler_gym/envs/llvm/llvm_benchmark.py
compiler_gym/random_replay.py
compiler_gym/util/debug_util.py
examples/llvm_autotuning/autotuners/opentuner_.py
examples/llvm_rl/model/inference_result.py
leaderboard/llvm_instcount/random_search/README.md
Cheers,
Chris
|
||
|
||
class CompilerEnv(gym.Env): | ||
class CompilerEnv(gym.Env, ABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are still a few properties missing from this interface: version
, compiler_version
(possibly others)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added them and a few more.
compiler_gym/envs/compiler_env.py
Outdated
def render( | ||
self, | ||
mode="human", | ||
) -> Optional[str]: | ||
"""Render the environment. | ||
|
||
CompilerEnv instances support two render modes: "human", which prints | ||
the current environment state to the terminal and return nothing; and | ||
"ansi", which returns a string representation of the current environment | ||
state. | ||
|
||
:param mode: The render mode to use. | ||
:raises TypeError: If a default observation space is not set, or if the | ||
requested render mode does not exist. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be on CompilerEnv
. Is the reason it isn't because it is also on gym.Env
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason was that it is a part of gym.Env
, but I added it in CompilerEnv
as well. It has a type hint and the additional documentation.
compiler_gym/random_replay.py
Outdated
@@ -8,7 +8,7 @@ | |||
|
|||
from deprecated import deprecated | |||
|
|||
from compiler_gym.envs.compiler_env import CompilerEnv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IRRC, this is actually useful. It means that //compiler_gym:random_replay
need only depend on //compiler_gym/envs:compiler_env
rather than //compiler_gym
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
compiler_gym/service/BUILD
Outdated
# TODO: add this after circular dependencies are resolved | ||
# ":client_service_compiler_env", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the easies thing here would be to merge :service
and :client_service_compiler_env
, so targets need only depend on //compiler_gym/service
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same for cmake)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause circular dependency. I have more elaborate explanation in another comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, in that case could you update the TODO note to reference this?
TODO(github.com/facebookresearch/CompilerGym/pull/633): ...
:ivar action_spaces: A list of supported action space names. | ||
|
||
:vartype action_spaces: List[str] | ||
|
||
:ivar actions: The list of actions that have been performed since the | ||
previous call to :func:`reset`. | ||
|
||
:vartype actions: List[ActionType] | ||
|
||
:ivar reward_range: A tuple indicating the range of reward values. Default | ||
range is (-inf, +inf). | ||
|
||
:vartype reward_range: Tuple[float, float] | ||
|
||
:ivar observation: A view of the available observation spaces that permits | ||
on-demand computation of observations. | ||
|
||
:vartype observation: compiler_gym.views.ObservationView | ||
|
||
:ivar reward: A view of the available reward spaces that permits on-demand | ||
computation of rewards. | ||
|
||
:vartype reward: compiler_gym.views.RewardView | ||
|
||
:ivar episode_reward: If :func:`ClientServiceCompilerEnv.reward_space | ||
<compiler_gym.envs.CompilerGym.reward_space>` is set, this value is the | ||
sum of all rewards for the current episode. | ||
|
||
:vartype episode_reward: float |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think each of these ivar
comments should a docstring on the corresponding abstract property in CompilerEnv
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -83,7 +83,7 @@ def benchmark_from_parsed_uri(self, uri: BenchmarkUri) -> Benchmark: | |||
# the example-v0 environment will be available to gym.make(...). | |||
register( | |||
id="example-cc-v0", | |||
entry_point="compiler_gym.envs:CompilerEnv", | |||
entry_point="compiler_gym.service.client_service_compiler_env:ClientServiceCompilerEnv", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add ClientServiceCompilerEnv
to the __all__
list in compiler_gym/service/__init__.py
, so this entry point would be compiler_gym.service:ClientServiceCopmilerEnv
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and for the others in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would cause circular import. I tried it already. I am not sure how to resolve the issue. The problem is that stuff in dataset
and view
depend on service and by doing this service would depend on dataset
and view
. The correct solution would be to also split dataset
and view
into interface and implementation and have ClientServiceCopmilerEnv depend on the interfaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ClientServiceCopmilerEnv
needs the details, they would be implementations related to the gRPC service, so they would also be able to move to service
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, thanks for the context. Okay, let's keep it the way you have done. Long term, I think it makes to break dataset
and view
dependencies on service
. Maybe through an equivalent refactor between the dataset/view "interface" and gRPC implementation?
@@ -137,7 +137,7 @@ def benchmark_from_parsed_uri(self, uri: BenchmarkUri) -> Benchmark: | |||
|
|||
register( | |||
id="loops-opt-py-v0", | |||
entry_point="compiler_gym.envs:CompilerEnv", | |||
entry_point="compiler_gym.service.client_service_compiler_env:ClientServiceCompilerEnv", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest compiler_gym.service:ClientServiceCompilerEnv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my other comments about circular dependencies.
Oh, and the new |
It seems it is. The test should probably expect the warning. |
I added it there, but technically |
I renamed most of them.
They use stuff like |
The PR is ready of another review. |
1264556
to
64f3ef2
Compare
@ChrisCummins, do you have an idea why the pre-commit checks are failing? |
One thing to mention is that the |
No, sorry. Looks like its a general error, not specific to these changes. Does
Good catch! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. There are a couple of CI failures that need addressing prior to merge.
I think the observation()
to convert_observation()
rename makes sense
Cheers,
Chris
compiler_gym/service/BUILD
Outdated
# TODO: add this after circular dependencies are resolved | ||
# ":client_service_compiler_env", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, in that case could you update the TODO note to reference this?
TODO(github.com/facebookresearch/CompilerGym/pull/633): ...
@@ -83,7 +83,7 @@ def benchmark_from_parsed_uri(self, uri: BenchmarkUri) -> Benchmark: | |||
# the example-v0 environment will be available to gym.make(...). | |||
register( | |||
id="example-cc-v0", | |||
entry_point="compiler_gym.envs:CompilerEnv", | |||
entry_point="compiler_gym.service.client_service_compiler_env:ClientServiceCompilerEnv", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, thanks for the context. Okay, let's keep it the way you have done. Long term, I think it makes to break dataset
and view
dependencies on service
. Maybe through an equivalent refactor between the dataset/view "interface" and gRPC implementation?
tests/wrappers/core_wrappers_test.py
Outdated
@@ -18,9 +19,30 @@ | |||
pytest_plugins = ["tests.pytest_plugins.llvm"] | |||
|
|||
|
|||
class ObservationDummyWrapper(ObservationWrapper): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ObservationDummyWrapper
and not ObservationWrapper
(using an import .. as ..
to avoid shadowing the ObservationWrapper
in gym module)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
tests/wrappers/core_wrappers_test.py
Outdated
|
||
env = ObservationWrapper(env) | ||
with pytest.raises(NotImplementedError): | ||
env.reset() | ||
with pytest.raises(TypeError): | ||
env = ObservationWrapper(env) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, why is it now a TypeError
? Could you add a match="..."
argument to match a bit of the description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the class ObservationWrapper
an abstract base class, so if you miss to implement some abstract method it raises a TypeError
. There is no match because I am not confident that the exception message string that ABC
uses will be stable.
This approach should work. |
c3dc175
to
26af19e
Compare
Done. |
It seems it does 6cf4926. |
26af19e
to
3b9518a
Compare
@ChrisCummins, could you do another review round? |
LGTM, thanks so much @sogartar! |
This release adds a new compiler environment, new APIs, and a suite of backend improvements to improve the flexibility of CompilerGym environments. Many thanks to code contributors: @sogartar, @KyleHerndon, @SoumyajitKarmakar, @uduse, and @anthony0727! Highlights of this release include: - [mlir] Began work on a new environment for matrix multiplication using MLIR ([#652](#652), thanks @KyleHerndon and @sogartar!). Note this environment is not yet included in the pypi package and must be [compiled from source](https://github.com/facebookresearch/CompilerGym/blob/development/INSTALL.md#building-from-source-with-cmake). - [llvm] Added a new `env.benchmark_from_clang_invocation()` method ([#577](#577)) that can be used for constructing LLVM environment automatically from C/C++ compiler invocations. This makes it much easier to integrate CompilerGym with your existing build scripts. - Added three new wrapper classes: `Counter`, that provides op counts for analysis ([#683](#683)); `SynchronousSqliteLogger`, that provides logging of environment interactions to a relational database ([#679](#679)), and `ForkOnStep` that provides an `undo()` operation ([#682](#682)). - Added `reward_space` and `observation_space` parameters to `env.reset()` ([#659](#659), thanks @SoumyajitKarmakar!) This release includes a number of improvements to the backend APIs that make it easier to write new CompilerGym environments: - Refactored the backend to make `CompilerEnv` an abstract interface, and `ClientServiceCompilerEnv` the concrete implementation of this interface. This enables new environments to be implemented without using gRPC ([#633](#633), thanks @sogartar!). - Extended the support for different types of action and observation spaces ([#641](#641), [#643](#643), thanks @sogartar!), including new `Permutation` and `SpaceSequence` spaces ([#645](#645), thanks @sogartar!).. - Added a new `disk/` subdirectory to compiler service's working directories, which is symlinked to an on-disk location for devices which support in-memory working directories. This fixes a bug with leftover temporary directories from LLVM ([#672](#672)). This release also includes numerous bug fixes and improvements, many of which were reported or fixed by the community. For example, fixing a bug in cache file locations ([#656](#656), thanks @uduse!), and a missing flag definition in example code ([#684](#684), thanks @anthony0727!). **Full Changelog**: v0.2.3...v0.2.4 This release brings in deprecating changes to the core `env.step()` routine, and lays the groundwork for enabling new types of compiler optimizations to be exposed through CompilerGym. Many thanks to code contributors: @mostafaelhoushi, @sogartar, @KyleHerndon, @uduse, @parthchadha, and @xtremey! Highlights of this release include: - Added a new `TextSizeInBytes` observation space for LLVM ([#575](#575)). * Added a new PPO leaderboard entry ([#580](#580). Thanks @xtremey! - Fixed a bug in which temporary directories created by the LLVM environment were not cleaned up ([#592](#592)). - **[Backend]** The function `createAndRunCompilerGymService` now returns an int, which is the exit return code ([#592](#592)). - Improvements to the examples documentation ([#548](#548)) and FAQ ([#586](#586)) Deprecations and breaking changes: - `CompilerEnv.step` no longer accepts a list of actions ([#627](#627)). A new method, `CompilerEnv.multistep` provides this functionality. This is to provide compatibility with environments whose action spaces are lists. To update your code, replace any calls to `env.step()` which take a list of actions to use `env.multistep()`. Thanks @sogartar! - The arguments `observations` and `rewards` to `step()` have been renamed `observation_spaces` and `reward_spaces`, respectively ([#627](#627)). - `Reward.id` has been renamed `Reward.name` ([#565](#565), [#612](#612)). Thanks @parthchadha! * The backend protocol buffer schema has been updated to natively support more types of observation and action, and to support nested spaces ([#531](#531)). Thanks @sogartar!
This release adds a new compiler environment, new APIs, and a suite of backend improvements to improve the flexibility of CompilerGym environments. Many thanks to code contributors: @sogartar, @KyleHerndon, @SoumyajitKarmakar, @uduse, and @anthony0727! Highlights of this release include: - [mlir] Began work on a new environment for matrix multiplication using MLIR ([#652](#652), thanks @KyleHerndon and @sogartar!). Note this environment is not yet included in the pypi package and must be [compiled from source](https://github.com/facebookresearch/CompilerGym/blob/development/INSTALL.md#building-from-source-with-cmake). - [llvm] Added a new `env.benchmark_from_clang_invocation()` method ([#577](#577)) that can be used for constructing LLVM environment automatically from C/C++ compiler invocations. This makes it much easier to integrate CompilerGym with your existing build scripts. - Added three new wrapper classes: `Counter`, that provides op counts for analysis ([#683](#683)); `SynchronousSqliteLogger`, that provides logging of environment interactions to a relational database ([#679](#679)), and `ForkOnStep` that provides an `undo()` operation ([#682](#682)). - Added `reward_space` and `observation_space` parameters to `env.reset()` ([#659](#659), thanks @SoumyajitKarmakar!) This release includes a number of improvements to the backend APIs that make it easier to write new CompilerGym environments: - Refactored the backend to make `CompilerEnv` an abstract interface, and `ClientServiceCompilerEnv` the concrete implementation of this interface. This enables new environments to be implemented without using gRPC ([#633](#633), thanks @sogartar!). - Extended the support for different types of action and observation spaces ([#641](#641), [#643](#643), thanks @sogartar!), including new `Permutation` and `SpaceSequence` spaces ([#645](#645), thanks @sogartar!).. - Added a new `disk/` subdirectory to compiler service's working directories, which is symlinked to an on-disk location for devices which support in-memory working directories. This fixes a bug with leftover temporary directories from LLVM ([#672](#672)). This release also includes numerous bug fixes and improvements, many of which were reported or fixed by the community. For example, fixing a bug in cache file locations ([#656](#656), thanks @uduse!), and a missing flag definition in example code ([#684](#684), thanks @anthony0727!). **Full Changelog**: v0.2.3...v0.2.4 This release brings in deprecating changes to the core `env.step()` routine, and lays the groundwork for enabling new types of compiler optimizations to be exposed through CompilerGym. Many thanks to code contributors: @mostafaelhoushi, @sogartar, @KyleHerndon, @uduse, @parthchadha, and @xtremey! Highlights of this release include: - Added a new `TextSizeInBytes` observation space for LLVM ([#575](#575)). * Added a new PPO leaderboard entry ([#580](#580). Thanks @xtremey! - Fixed a bug in which temporary directories created by the LLVM environment were not cleaned up ([#592](#592)). - **[Backend]** The function `createAndRunCompilerGymService` now returns an int, which is the exit return code ([#592](#592)). - Improvements to the examples documentation ([#548](#548)) and FAQ ([#586](#586)) Deprecations and breaking changes: - `CompilerEnv.step` no longer accepts a list of actions ([#627](#627)). A new method, `CompilerEnv.multistep` provides this functionality. This is to provide compatibility with environments whose action spaces are lists. To update your code, replace any calls to `env.step()` which take a list of actions to use `env.multistep()`. Thanks @sogartar! - The arguments `observations` and `rewards` to `step()` have been renamed `observation_spaces` and `reward_spaces`, respectively ([#627](#627)). - `Reward.id` has been renamed `Reward.name` ([#565](#565), [#612](#612)). Thanks @parthchadha! * The backend protocol buffer schema has been updated to natively support more types of observation and action, and to support nested spaces ([#531](#531)). Thanks @sogartar!
This release adds a new compiler environment, new APIs, and a suite of backend improvements to improve the flexibility of CompilerGym environments. Many thanks to code contributors: @sogartar, @KyleHerndon, @SoumyajitKarmakar, @uduse, and @anthony0727! Highlights of this release include: - [mlir] Began work on a new environment for matrix multiplication using MLIR ([#652](#652), thanks @KyleHerndon and @sogartar!). Note this environment is not yet included in the pypi package and must be [compiled from source](https://github.com/facebookresearch/CompilerGym/blob/development/INSTALL.md#building-from-source-with-cmake). - [llvm] Added a new `env.benchmark_from_clang_invocation()` method ([#577](#577)) that can be used for constructing LLVM environment automatically from C/C++ compiler invocations. This makes it much easier to integrate CompilerGym with your existing build scripts. - Added three new wrapper classes: `Counter`, that provides op counts for analysis ([#683](#683)); `SynchronousSqliteLogger`, that provides logging of environment interactions to a relational database ([#679](#679)), and `ForkOnStep` that provides an `undo()` operation ([#682](#682)). - Added `reward_space` and `observation_space` parameters to `env.reset()` ([#659](#659), thanks @SoumyajitKarmakar!) This release includes a number of improvements to the backend APIs that make it easier to write new CompilerGym environments: - Refactored the backend to make `CompilerEnv` an abstract interface, and `ClientServiceCompilerEnv` the concrete implementation of this interface. This enables new environments to be implemented without using gRPC ([#633](#633), thanks @sogartar!). - Extended the support for different types of action and observation spaces ([#641](#641), [#643](#643), thanks @sogartar!), including new `Permutation` and `SpaceSequence` spaces ([#645](#645), thanks @sogartar!).. - Added a new `disk/` subdirectory to compiler service's working directories, which is symlinked to an on-disk location for devices which support in-memory working directories. This fixes a bug with leftover temporary directories from LLVM ([#672](#672)). This release also includes numerous bug fixes and improvements, many of which were reported or fixed by the community. For example, fixing a bug in cache file locations ([#656](#656), thanks @uduse!), and a missing flag definition in example code ([#684](#684), thanks @anthony0727!). **Full Changelog**: v0.2.3...v0.2.4 This release brings in deprecating changes to the core `env.step()` routine, and lays the groundwork for enabling new types of compiler optimizations to be exposed through CompilerGym. Many thanks to code contributors: @mostafaelhoushi, @sogartar, @KyleHerndon, @uduse, @parthchadha, and @xtremey! Highlights of this release include: - Added a new `TextSizeInBytes` observation space for LLVM ([#575](#575)). * Added a new PPO leaderboard entry ([#580](#580). Thanks @xtremey! - Fixed a bug in which temporary directories created by the LLVM environment were not cleaned up ([#592](#592)). - **[Backend]** The function `createAndRunCompilerGymService` now returns an int, which is the exit return code ([#592](#592)). - Improvements to the examples documentation ([#548](#548)) and FAQ ([#586](#586)) Deprecations and breaking changes: - `CompilerEnv.step` no longer accepts a list of actions ([#627](#627)). A new method, `CompilerEnv.multistep` provides this functionality. This is to provide compatibility with environments whose action spaces are lists. To update your code, replace any calls to `env.step()` which take a list of actions to use `env.multistep()`. Thanks @sogartar! - The arguments `observations` and `rewards` to `step()` have been renamed `observation_spaces` and `reward_spaces`, respectively ([#627](#627)). - `Reward.id` has been renamed `Reward.name` ([#565](#565), [#612](#612)). Thanks @parthchadha! * The backend protocol buffer schema has been updated to natively support more types of observation and action, and to support nested spaces ([#531](#531)). Thanks @sogartar!
The goal of this change is to have a clean separation between interface and implementation. It also allows for new environment implementations with approaches different from
CompilerEnv
.