Skip to content

Commit 7b45c23

Browse files
authored
Replace _compile_fn with compile_fn (#107)
Will be used directly by #96
1 parent 220c0f5 commit 7b45c23

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

compiler_opt/rl/compilation_runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def collect_data(
298298
ValueError if example under default policy and ml policy does not match.
299299
"""
300300
if reward_stat is None:
301-
default_result = self._compile_fn(
301+
default_result = self.compile_fn(
302302
module_spec,
303303
tf_policy_path='',
304304
reward_only=bool(tf_policy_path),
@@ -308,7 +308,7 @@ def collect_data(
308308
}
309309

310310
if tf_policy_path:
311-
policy_result = self._compile_fn(
311+
policy_result = self.compile_fn(
312312
module_spec,
313313
tf_policy_path,
314314
reward_only=False,
@@ -346,7 +346,7 @@ def collect_data(
346346
rewards=rewards,
347347
keys=keys)
348348

349-
def _compile_fn(
349+
def compile_fn(
350350
self, module_spec: corpus.ModuleSpec, tf_policy_path: str,
351351
reward_only: bool,
352352
cancellation_manager: Optional[WorkerCancellationManager]

compiler_opt/rl/compilation_runner_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def assertListProtoEqual(self, a, b):
102102
self.assertProtoEquals(x, y)
103103

104104
@mock.patch(constant.BASE_MODULE_DIR +
105-
'.compilation_runner.CompilationRunner._compile_fn')
105+
'.compilation_runner.CompilationRunner.compile_fn')
106106
def test_policy(self, mock_compile_fn):
107107
mock_compile_fn.side_effect = _mock_compile_fn
108108
runner = compilation_runner.CompilationRunner(
@@ -132,7 +132,7 @@ def test_policy(self, mock_compile_fn):
132132
self.assertAllClose([0.1998002], data.rewards)
133133

134134
@mock.patch(constant.BASE_MODULE_DIR +
135-
'.compilation_runner.CompilationRunner._compile_fn')
135+
'.compilation_runner.CompilationRunner.compile_fn')
136136
def test_default(self, mock_compile_fn):
137137
mock_compile_fn.side_effect = _mock_compile_fn
138138
runner = compilation_runner.CompilationRunner(
@@ -163,7 +163,7 @@ def test_default(self, mock_compile_fn):
163163
self.assertAllClose([0], data.rewards)
164164

165165
@mock.patch(constant.BASE_MODULE_DIR +
166-
'.compilation_runner.CompilationRunner._compile_fn')
166+
'.compilation_runner.CompilationRunner.compile_fn')
167167
def test_given_default_size(self, mock_compile_fn):
168168
mock_compile_fn.side_effect = _mock_compile_fn
169169
runner = compilation_runner.CompilationRunner(
@@ -198,7 +198,7 @@ def test_given_default_size(self, mock_compile_fn):
198198
self.assertAllClose([0.199800], data.rewards)
199199

200200
@mock.patch(constant.BASE_MODULE_DIR +
201-
'.compilation_runner.CompilationRunner._compile_fn')
201+
'.compilation_runner.CompilationRunner.compile_fn')
202202
def test_exception_handling(self, mock_compile_fn):
203203
mock_compile_fn.side_effect = subprocess.CalledProcessError(
204204
returncode=1, cmd='error')

compiler_opt/rl/inlining/inlining_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, llvm_size_path: str, *args, **kwargs):
4545
super().__init__(*args, **kwargs)
4646
self._llvm_size_path = llvm_size_path
4747

48-
def _compile_fn(
48+
def compile_fn(
4949
self, module_spec: corpus.ModuleSpec, tf_policy_path: str,
5050
reward_only: bool, cancellation_manager: Optional[
5151
compilation_runner.WorkerCancellationManager]

compiler_opt/rl/regalloc/regalloc_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class RegAllocRunner(compilation_runner.CompilationRunner):
4343

4444
# TODO: refactor file_paths parameter to ensure correctness during
4545
# construction
46-
def _compile_fn(
46+
def compile_fn(
4747
self, module_spec: corpus.ModuleSpec, tf_policy_path: str,
4848
reward_only: bool, cancellation_manager: Optional[
4949
compilation_runner.WorkerCancellationManager]

0 commit comments

Comments
 (0)