Skip to content

Commit 3f31d68

Browse files
alexmalyshevmeta-codesync[bot]
authored andcommitted
Remove duration tracking for precompile_all
Summary: This was used by IG but it can be easily implemented directly in Python. Don't build it into CinderX, it's more global/module state that we really just don't need. Reviewed By: DinoV Differential Revision: D91350799 fbshipit-source-id: 77ca57ac924646b485b5b86e31e2a2f56bac5b63
1 parent 01692ef commit 3f31d68

1 file changed

Lines changed: 7 additions & 20 deletions

File tree

cinderx/Jit/pyjit.cpp

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ class DisableGilCheck {
8181
int old_check_enabled_;
8282
};
8383

84-
// Amount of time taken to batch compile everything when disable_jit is called
85-
std::chrono::milliseconds g_batch_compilation_time;
86-
8784
CompilerContext<Compiler>* jitCtx() {
8885
auto state = cinderx::getModuleState();
8986
if (state != nullptr) {
@@ -1054,7 +1051,6 @@ void multithread_compile_units_preloaded(
10541051
// yet.
10551052
bool compile_all(size_t workers = 0) {
10561053
JIT_CHECK(jitCtx(), "JIT not initialized");
1057-
std::chrono::time_point start = std::chrono::steady_clock::now();
10581054

10591055
if (workers == 0) {
10601056
workers = std::max<size_t>(getConfig().batch_compile_workers, 1);
@@ -1117,10 +1113,6 @@ bool compile_all(size_t workers = 0) {
11171113

11181114
hir::preloaderManager().clear();
11191115

1120-
std::chrono::time_point end = std::chrono::steady_clock::now();
1121-
g_batch_compilation_time =
1122-
std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
1123-
11241116
auto& jit_code_outer_funcs = cinderx::getModuleState()->codeOuterFunctions();
11251117
jit_code_outer_funcs.clear();
11261118

@@ -1219,12 +1211,18 @@ PyObject* multithreaded_compile_test(PyObject*, PyObject*) {
12191211
auto& jit_reg_units = cinderx::getModuleState()->registeredCompilationUnits();
12201212
JIT_LOG("(Re)compiling {} units", jit_reg_units.size());
12211213
jitCtx()->clearCache();
1214+
1215+
std::chrono::time_point start = std::chrono::steady_clock::now();
12221216
if (!compile_all()) {
12231217
return nullptr;
12241218
}
1219+
std::chrono::time_point end = std::chrono::steady_clock::now();
1220+
auto batch_compilation_time =
1221+
std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
1222+
12251223
JIT_LOG(
12261224
"Took {} ms, compiles attempted: {}, compiles retried: {}",
1227-
g_batch_compilation_time.count(),
1225+
batch_compilation_time.count(),
12281226
g_compile_workers_attempted,
12291227
g_compile_workers_retries);
12301228
Py_RETURN_NONE;
@@ -1509,10 +1507,6 @@ PyObject* auto_jit(PyObject* /* self */, PyObject* /* arg */) {
15091507
Py_RETURN_NONE;
15101508
}
15111509

1512-
PyObject* get_batch_compilation_time_ms(PyObject*, PyObject*) {
1513-
return PyLong_FromLong(g_batch_compilation_time.count());
1514-
}
1515-
15161510
BorrowedRef<PyFunctionObject> get_func_arg(
15171511
const char* method_name,
15181512
BorrowedRef<> arg) {
@@ -1561,7 +1555,6 @@ precompile_all(PyObject* /* self */, PyObject* args, PyObject* kwargs) {
15611555
return nullptr;
15621556
}
15631557

1564-
JIT_DLOG("precompile_all completed in {}", g_batch_compilation_time);
15651558
Py_RETURN_TRUE;
15661559
}
15671560

@@ -2863,12 +2856,6 @@ PyMethodDef jit_methods[] = {
28632856
is_multithreaded_compile_test_enabled,
28642857
METH_NOARGS,
28652858
PyDoc_STR("Return True if multithreaded_compile_test mode is enabled.")},
2866-
{"get_batch_compilation_time_ms",
2867-
get_batch_compilation_time_ms,
2868-
METH_NOARGS,
2869-
PyDoc_STR(
2870-
"Return the number of milliseconds spent in batch compilation "
2871-
"the last time precompile_all() was called.")},
28722859
{"get_allocator_stats",
28732860
get_allocator_stats,
28742861
METH_NOARGS,

0 commit comments

Comments
 (0)