Skip to content

Commit d2a0743

Browse files
authored
Update README.md
1 parent 385d788 commit d2a0743

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

model/POSET-RL/README.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# POSET-RL
22

3-
POSET-RL uses a reinforcement learning approach as the search space of optimization sequences is too big to enumerate. For a compiler with m optimization passes, if the sequence length is fixed as n, then there can be potentially mn combinations, allowing repetitions. The reinforcement learning model is trained and evaluated on programs that are represented using IR2Vec embeddings. The action space contains the subsequences created using the Oz dependence graph (ODG). Sequences are constructed from this graph by finding walks that start and end at critical nodes (with degree greater than a value k).[slides](https://llvm.org/devmtg/2022-04-03/slides/POSET-RL.Phase.ordering.for.Optimizing.Size.and.Execution.Time.using.Reinforcement.Learning.pdf)
3+
# POSET-RL
4+
POSET-RL uses a reinforcement learning approach to find pass sequence (for optimal code size + execution time), as the search space of optimization sequences is too big to enumerate. For a compiler with `m` optimization passes, if the sequence length is fixed as `n`, then there can be potentially `mxn` combinations, allowing repetitions.
5+
6+
This repo contains the source code and relevant information described in the [paper](https://ieeexplore.ieee.org/abstract/document/9804673) ([arXiv](https://arxiv.org/abs/2208.04238), [slides](https://llvm.org/devmtg/2022-04-03/slides/POSET-RL.Phase.ordering.for.Optimizing.Size.and.Execution.Time.using.Reinforcement.Learning.pdf)).
7+
Please see [here](https://compilers.cse.iith.ac.in/projects/posetrl) for more details.
8+
49
> POSET-RL: Phase ordering for Optimizing Size and Execution Time using Reinforcement Learning: Shalini Jain, Yashas Andaluri, S. VenkataKeerthy and Ramakrishna Upadrasta
510
11+
612
## Environment Setup
713

814
- Copy the environment `.yml` files from `/path/to/ml-llvm-project/model/POSET-RL/posetrl_env.yml` to the home directory
@@ -28,25 +34,27 @@ POSET-RL uses a reinforcement learning approach as the search space of optimizat
2834
```bash
2935
cd ml-llvm-project/model/POSET_RL/src
3036
31-
python experiment.py --llvm_dir=<ml-llvm-project/build> --train_dir=<path_to_training_data> --train_iterations=<no.ofiterations in training> --use_grpc
37+
python experiment.py --llvm_dir=<ml-llvm-project/build> --train_dir=<path_to_training_data> --train_iterations=<no.ofiterations in training> --use_grpc
38+
39+
#The --train_dir option must specify a path to a directory of .ll files
3240
```
3341
### Pipes
3442
```bash
3543
cd ml-llvm-project/model/POSET_RL/src
3644
37-
python experiment.py --llvm_dir=<ml-llvm-project/build> --train_dir=<path_to_training_data> --train_iterations=<no.ofiterations in training> --use_pipe --data_format=<json or bytes>
45+
python experiment.py --llvm_dir=<ml-llvm-project/build> --train_dir=<path_to_training_data> --train_iterations=<no.ofiterations in training> --use_pipe --data_format=<json or bytes>
3846
47+
#The --train_dir option must specify a path to a directory of .ll files
3948
#Model will be generated as a pytorch checkpoint in ml-llvm-project/model/checkpoint_dir after every 10 epochs
4049
#The output of the above generates the training logs
4150
```
4251
### ONNX
43-
The -export_onnx option in inference.py is responsible for dumping the onnx model
4452

4553
```bash
4654
cd ml-llvm-project/model/POSET_RL/src
4755
48-
python inference.py --test-dir=<Path to the test directory> --use_grpc --server_address=<loopback_address:port_no> --model=<path_to_the_model_in_config_in_main_project> --export_onnx
56+
python inference.py --test-dir=<Path to the test directory> --use_grpc --server_address=<loopback_address:port_no> --model=<path_to_the_model_in_config_in_main_project>
57+
58+
```
4959

50-
# The model will be dumped inside the onnx-model directory residing inside /path/to/ml-llvm-project/model/POSET-RL/
51-
# Copy the generated onnx model from the above mentioned directory into /path/to/ml-llvm-project/config/posetrl
52-
```
60+
### Model Inference: [Refer to Model Training](../llvm/lib/Transforms/IPO/PosetRL/README.md)

0 commit comments

Comments
 (0)