def lower(sch, args, shape_params=None, name="default_function", binds=None, attrs=None, simple_mode=False, polyhedral=False, tuning=False, target="cce"): """Lowering function.""" tmp_binds = None if binds is not None: tmp_binds = None if not bool(binds) else binds tmp_attrs = None if attrs is not None: tmp_attrs = None if not bool(attrs) else attrs if shape_params is None: shape_params = [] cfg = _api_internal._GetCurrentBuildConfig() ret = _api_internal._Lower(sch, args, shape_params, name, tmp_binds, tmp_attrs, simple_mode, polyhedral, tuning, target, cfg) level = tmp_attrs.get("help_tiling") if tuning or (level is not None and level > help_tiling_level['None']): level = help_tiling_level['Tuning'] if tuning else level global tuning_spaces tuning_spaces = {} tuning_spaces["index"] = ret.index_table.asnumpy().tolist() tuning_spaces["c1_range"] = ret.c1_tile_range_table.asnumpy().tolist() tuning_spaces["c0_range"] = ret.c0_tile_range_table.asnumpy().tolist() tuning_spaces["c1_mod"] = ret.c1_tile_mod_table.asnumpy().tolist() tuning_spaces["c0_mod"] = ret.c0_tile_mod_table.asnumpy().tolist() if level >= help_tiling_level["Candidates"]: tuning_spaces["tuning_space"] = ret.tiling_candidate.asnumpy().tolist() if not tuning: dump_tiling_info(level) return ret
def lower(sch, args, shape_params=None, name="default_function", binds=None, attrs=None, simple_mode=False, polyhedral=False, tuning=False, target="cce"): """Lowering function.""" tmp_binds = None if binds is not None: tmp_binds = None if not bool(binds) else binds tmp_attrs = None if attrs is not None: tmp_attrs = None if not bool(attrs) else attrs if shape_params is None: shape_params = [] cfg = _api_internal._GetCurrentBuildConfig() ret = _api_internal._Lower(sch, args, shape_params, name, tmp_binds, tmp_attrs, simple_mode, polyhedral, tuning, target, cfg) level = tmp_attrs.get("help_tiling") if attrs.get("use_new_space", False): # new space: constraints format print("NEW SPACE: ", ret) space = dict() space['tune_schedule'] = ret.tune_schedule space['tune_constraints'] = ret.tune_constraints return space elif tuning or (level is not None and level > help_tiling_level['None']): level = help_tiling_level['Tuning'] if tuning else level global tuning_spaces tuning_spaces = {} tuning_spaces["index"] = ret.index_table.asnumpy().tolist() tuning_spaces["c1_range"] = ret.c1_tile_range_table.asnumpy().tolist() tuning_spaces["c0_range"] = ret.c0_tile_range_table.asnumpy().tolist() tuning_spaces["c1_mod"] = ret.c1_tile_mod_table.asnumpy().tolist() tuning_spaces["c0_mod"] = ret.c0_tile_mod_table.asnumpy().tolist() tuning_spaces["thread_range"] = ret.gpu_thread_range_table.asnumpy().tolist() tuning_spaces["block_range"] = ret.gpu_block_range_table.asnumpy().tolist() tuning_spaces["thread_mod"] = ret.gpu_thread_mod_table.asnumpy().tolist() tuning_spaces["block_mod"] = ret.gpu_block_mod_table.asnumpy().tolist() if level >= help_tiling_level["Candidates"]: tuning_spaces["tuning_space"] = ret.tiling_candidate.asnumpy().tolist() if not tuning: dump_tiling_info(level) return ret