|
25 | 25 | def test_compiler_attr(): |
26 | 26 | config = { |
27 | 27 | "accelerator_config": "ethos-u55-32", |
| 28 | + "enable_cascader": True, |
| 29 | + "enable_striping": True, |
| 30 | + "disable_copying_constants": True, |
| 31 | + "dev_force_block_config": "2x4x16", |
| 32 | + "dev_max_open_plans": "256", |
| 33 | + "dev_max_closed_plans": "128", |
| 34 | + "dev_select_proposal_idx": "1", |
| 35 | + "dev_disable_pareto_plans": True, |
| 36 | + "dev_disable_pareto_proposals": True, |
| 37 | + "dev_disable_block_culling": True, |
| 38 | + "dev_cascader_logging": True, |
28 | 39 | } |
29 | 40 | with tvm.transform.PassContext(opt_level=3, config={"relay.ext.ethos-u.options": config}): |
30 | 41 | with tvm.target.Target("c"): |
31 | 42 | compiler_attrs = tvm.get_global_func("relay.ext.ethos-u.get_compiler_attrs")() |
32 | | - accel_config_str = compiler_attrs.accelerator_config |
33 | | - assert accel_config_str == config["accelerator_config"] |
| 43 | + assert compiler_attrs.accelerator_config == config["accelerator_config"] |
| 44 | + assert compiler_attrs.enable_cascader == config["enable_cascader"] |
| 45 | + assert compiler_attrs.enable_striping == config["enable_striping"] |
| 46 | + assert compiler_attrs.disable_copying_constants == config["disable_copying_constants"] |
| 47 | + assert compiler_attrs.dev_force_block_config == config["dev_force_block_config"] |
| 48 | + assert compiler_attrs.dev_max_open_plans == config["dev_max_open_plans"] |
| 49 | + assert compiler_attrs.dev_max_closed_plans == config["dev_max_closed_plans"] |
| 50 | + assert compiler_attrs.dev_select_proposal_idx == config["dev_select_proposal_idx"] |
| 51 | + assert compiler_attrs.dev_disable_pareto_plans == config["dev_disable_pareto_plans"] |
| 52 | + assert ( |
| 53 | + compiler_attrs.dev_disable_pareto_proposals |
| 54 | + == config["dev_disable_pareto_proposals"] |
| 55 | + ) |
| 56 | + assert compiler_attrs.dev_disable_block_culling == config["dev_disable_block_culling"] |
| 57 | + assert compiler_attrs.dev_cascader_logging == config["dev_cascader_logging"] |
34 | 58 |
|
35 | 59 |
|
36 | 60 | def test_compiler_attr_default(): |
37 | 61 | default_config = { |
38 | 62 | "accelerator_config": "ethos-u55-256", |
| 63 | + "enable_cascader": False, |
| 64 | + "enable_striping": False, |
| 65 | + "disable_copying_constants": False, |
| 66 | + "dev_force_block_config": "", |
| 67 | + "dev_max_open_plans": "8", |
| 68 | + "dev_max_closed_plans": "32", |
| 69 | + "dev_select_proposal_idx": "-1", |
| 70 | + "dev_disable_pareto_plans": False, |
| 71 | + "dev_disable_pareto_proposals": False, |
| 72 | + "dev_disable_block_culling": False, |
| 73 | + "dev_cascader_logging": False, |
39 | 74 | } |
40 | 75 | with tvm.transform.PassContext(opt_level=3): |
41 | 76 | with tvm.target.Target("c"): |
42 | 77 | compiler_attrs = tvm.get_global_func("relay.ext.ethos-u.get_compiler_attrs")() |
43 | | - accel_config_str = compiler_attrs.accelerator_config |
44 | | - assert accel_config_str == default_config["accelerator_config"] |
| 78 | + assert compiler_attrs.accelerator_config == default_config["accelerator_config"] |
| 79 | + assert compiler_attrs.enable_cascader == default_config["enable_cascader"] |
| 80 | + assert compiler_attrs.enable_striping == default_config["enable_striping"] |
| 81 | + assert ( |
| 82 | + compiler_attrs.disable_copying_constants |
| 83 | + == default_config["disable_copying_constants"] |
| 84 | + ) |
| 85 | + assert compiler_attrs.dev_force_block_config == default_config["dev_force_block_config"] |
| 86 | + assert compiler_attrs.dev_max_open_plans == default_config["dev_max_open_plans"] |
| 87 | + assert compiler_attrs.dev_max_closed_plans == default_config["dev_max_closed_plans"] |
| 88 | + assert ( |
| 89 | + compiler_attrs.dev_select_proposal_idx == default_config["dev_select_proposal_idx"] |
| 90 | + ) |
| 91 | + assert ( |
| 92 | + compiler_attrs.dev_disable_pareto_plans |
| 93 | + == default_config["dev_disable_pareto_plans"] |
| 94 | + ) |
| 95 | + assert ( |
| 96 | + compiler_attrs.dev_disable_pareto_proposals |
| 97 | + == default_config["dev_disable_pareto_proposals"] |
| 98 | + ) |
| 99 | + assert ( |
| 100 | + compiler_attrs.dev_disable_block_culling |
| 101 | + == default_config["dev_disable_block_culling"] |
| 102 | + ) |
| 103 | + assert compiler_attrs.dev_cascader_logging == default_config["dev_cascader_logging"] |
45 | 104 |
|
46 | 105 |
|
47 | 106 | if __name__ == "__main__": |
|
0 commit comments