File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
python/tvm/auto_scheduler Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -245,7 +245,9 @@ def deserialize_workload_registry_entry(data):
245
245
name , value = data
246
246
if name not in WORKLOAD_FUNC_REGISTRY :
247
247
# pylint: disable=assignment-from-no-return
248
- WORKLOAD_FUNC_REGISTRY [name ] = LoadJSON (value )
248
+ if not callable (value ):
249
+ value = LoadJSON (value )
250
+ WORKLOAD_FUNC_REGISTRY [name ] = value
249
251
250
252
251
253
def save_workload_func_registry (filename ):
Original file line number Diff line number Diff line change @@ -293,6 +293,15 @@ def test_dag_measure_local_builder_runner():
293
293
assert mress [0 ].error_no == 0
294
294
295
295
296
+ def test_workload_serialization ():
297
+ key = tvm .auto_scheduler .utils .get_func_name (matmul_auto_scheduler_test )
298
+ transfer_data = workload_registry .serialize_workload_registry_entry (key )
299
+ f_data = pickle .dumps (transfer_data )
300
+ f_new = pickle .loads (f_data )
301
+ del workload_registry .WORKLOAD_FUNC_REGISTRY [key ]
302
+ workload_registry .deserialize_workload_registry_entry (f_new )
303
+
304
+
296
305
def test_measure_local_builder_rpc_runner ():
297
306
if not tvm .testing .device_enabled ("llvm" ):
298
307
return
@@ -423,6 +432,7 @@ def foo():
423
432
test_workload_dis_factor ()
424
433
test_measure_local_builder_runner ()
425
434
test_dag_measure_local_builder_runner ()
435
+ test_workload_serialization ()
426
436
test_measure_local_builder_rpc_runner ()
427
437
test_measure_target_host ()
428
438
test_measure_special_inputs_map_by_name_local_runner ()
You can’t perform that action at this time.
0 commit comments