Skip to content

Commit

Permalink
Remove inlining_default as it's not used by anything (#344)
Browse files Browse the repository at this point in the history
The compiler side change will follow, but training can continue with this
repository at HEAD because LLVM will patch features it can't find by
allocating appropriate buffers and just never passing them to a model.
  • Loading branch information
mtrofin authored Jun 17, 2024
1 parent 6ff14fd commit 5ce7681
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions compiler_opt/es/blackbox_learner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def setUp(self):
actor_network=actor_network)

# make the policy all zeros to be deterministic
expected_policy_length = 17218
expected_policy_length = 17154
policy_utils.set_vectorized_parameters_for_policy(policy, [0.0] *
expected_policy_length)
init_params = policy_utils.get_vectorized_parameters_from_policy(policy)
Expand Down Expand Up @@ -183,7 +183,7 @@ def test_run_step(self):
ESWorker, count=3, arg='', kwarg='') as pool:
self._learner.run_step(pool) # pylint: disable=protected-access
# expected length calculated from expected shapes of variables
self.assertEqual(len(self._learner.get_model_weights()), 17218)
self.assertEqual(len(self._learner.get_model_weights()), 17154)
# check that first 5 weights are not all zero
# this will indicate general validity of all the values
for value in self._learner.get_model_weights()[:5]:
Expand Down
2 changes: 1 addition & 1 deletion compiler_opt/es/policy_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_regalloc_config(self):

class VectorTest(absltest.TestCase):

expected_variable_shapes = [(71, 64), (64), (64, 64), (64), (64, 64), (64),
expected_variable_shapes = [(70, 64), (64), (64, 64), (64), (64, 64), (64),
(64, 64), (64), (64, 2), (2)]
expected_length_of_a_perturbation = sum(
np.prod(shape) for shape in expected_variable_shapes)
Expand Down
10 changes: 2 additions & 8 deletions compiler_opt/rl/inlining/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ def get_inlining_signature_spec():
'is_multiple_blocks',
'nested_inlines',
'nested_inline_cost_estimate',
'threshold',

# inlining_default is not used as feature in training.
'inlining_default'))
'threshold'))
reward_spec = tf.TensorSpec(dtype=tf.float32, shape=(), name='reward')
time_step_spec = time_step.time_step_spec(observation_spec, reward_spec)
action_spec = tensor_spec.BoundedTensorSpec(
Expand All @@ -86,9 +83,6 @@ def get_observation_processing_layer_creator(quantile_file_dir=None,

def observation_processing_layer(obs_spec):
"""Creates the layer to process observation given obs_spec."""
if obs_spec.name == 'inlining_default':
return tf.keras.layers.Lambda(feature_ops.discard_fn)

quantile = quantile_map[obs_spec.name]
return tf.keras.layers.Lambda(
feature_ops.get_normalize_fn(quantile, with_sqrt,
Expand All @@ -98,4 +92,4 @@ def observation_processing_layer(obs_spec):


def get_nonnormalized_features():
return ['reward', 'inlining_default', 'inlining_decision']
return ['reward', 'inlining_decision']
8 changes: 4 additions & 4 deletions compiler_opt/rl/trainer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _create_test_data(batch_size, sequence_length):
test_trajectory = trajectory.Trajectory(
step_type=tf.fill([batch_size, sequence_length], 1),
observation={
'inlining_default':
'callee_users':
tf.fill([batch_size, sequence_length],
tf.constant(10, dtype=tf.int64))
},
Expand All @@ -54,8 +54,8 @@ class TrainerTest(tf.test.TestCase):

def setUp(self):
observation_spec = {
'inlining_default':
tf.TensorSpec(dtype=tf.int64, shape=(), name='inlining_default')
'callee_users':
tf.TensorSpec(dtype=tf.int64, shape=(), name='callee_users')
}
self._time_step_spec = time_step.time_step_spec(observation_spec)
self._action_spec = tensor_spec.BoundedTensorSpec(
Expand All @@ -69,7 +69,7 @@ def setUp(self):
action_spec=self._action_spec,
lstm_size=(40,),
preprocessing_layers={
'inlining_default': tf.keras.layers.Lambda(lambda x: x)
'callee_users': tf.keras.layers.Lambda(lambda x: x)
})
super().setUp()

Expand Down

0 comments on commit 5ce7681

Please sign in to comment.