Skip to content

Commit 933202c

Browse files
Add initial gin configs for regalloc_trace in ES
This patch adds a set of gin configs that can be used for regalloc_trace ES training. This are intended mostly to be starting points so that we have a set of options that work upstream as an example and they can be modified within experiments as needed. They need to be modified before use, such as by setting binary and basic block trace paths. Reviewers: mtrofin Reviewed By: mtrofin Pull Request: #435
1 parent 2f27005 commit 933202c

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import compiler_opt.es.blackbox_learner
2+
import compiler_opt.rl.gin_external_configurables
3+
import compiler_opt.es.blackbox_optimizers
4+
import compiler_opt.es.blackbox_evaluator
5+
import compiler_opt.es.es_trainer_lib
6+
import compiler_opt.es.regalloc_trace.regalloc_trace_worker
7+
8+
# Blackbox learner config
9+
BlackboxLearnerConfig.total_steps = 10000
10+
BlackboxLearnerConfig.total_num_perturbations = 100
11+
BlackboxLearnerConfig.blackbox_optimizer = %blackbox_optimizers.Algorithm.MONTE_CARLO
12+
BlackboxLearnerConfig.estimator_type = %blackbox_optimizers.EstimatorType.ANTITHETIC
13+
BlackboxLearnerConfig.fvalues_normalization = True
14+
BlackboxLearnerConfig.hyperparameters_update_method = %blackbox_optimizers.UpdateMethod.NO_METHOD
15+
16+
BlackboxLearnerConfig.num_top_directions = 0
17+
18+
BlackboxLearnerConfig.precision_parameter = 0.5
19+
20+
BlackboxLearnerConfig.step_size = 0.005
21+
22+
blackbox_evaluator.TraceBlackboxEvaluator.bb_trace_path = '<bb trace path>'
23+
blackbox_evaluator.TraceBlackboxEvaluator.function_index_path = '<function index path>'
24+
25+
BlackboxLearnerConfig.evaluator = @blackbox_evaluator.TraceBlackboxEvaluator
26+
27+
compiler_opt.es.es_trainer_lib.train.worker_class = @RegallocTraceWorker
28+
# Some flags that need to be deleted for successful compilation of XFDO
29+
# binaries. This set will need to be modified depending upon your compilation
30+
# setup.
31+
compiler_opt.es.es_trainer_lib.train.delete_compilation_flags = ('-fprofile-sample-use', '-split-dwarf-file', '-split-dwarf-output', '-fdebug-compilation-dir', '--warning-suppression-mappings')
32+
33+
RegallocTraceWorker.clang_path = '<clang path>'
34+
RegallocTraceWorker.basic_block_trace_model_path = '<basic block trace model path>'
35+
RegallocTraceWorker.thread_count = 128
36+
RegallocTraceWorker.corpus_path = '<corpus path>'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import compiler_opt.rl.gin_external_configurables
2+
import compiler_opt.rl.regalloc.config
3+
import compiler_opt.rl.regalloc.regalloc_network
4+
5+
include 'compiler_opt/rl/regalloc/gin_configs/common.gin'
6+
7+
regalloc.config.get_observation_processing_layer_creator.quantile_file_dir='compiler_opt/rl/regalloc/vocab'
8+
regalloc.config.get_observation_processing_layer_creator.with_sqrt = False
9+
regalloc.config.get_observation_processing_layer_creator.with_z_score_normalization = False
10+
11+
RegAllocNetwork.preprocessing_combiner=@tf.keras.layers.Concatenate()
12+
RegAllocNetwork.fc_layer_params=(80, 40)
13+
RegAllocNetwork.dropout_layer_params=None
14+
15+
16+
policy_utils.create_actor_policy.actor_network_ctor = @regalloc_network.RegAllocNetwork
17+
policy_utils.create_actor_policy.greedy = True

0 commit comments

Comments
 (0)