From abeed7b396959e3ee176834d170dcf939046aa06 Mon Sep 17 00:00:00 2001 From: windclarion Date: Fri, 10 Jul 2020 04:12:42 +0800 Subject: [PATCH] [TARGET] each option of target str should only contain one '=' (#5988) src/target/target_id.cc ParseAttrsFromRawString L222: if ((pos = FindUniqueSubstr(s, "=")) != -1) require option contains only one '=' Signed-off-by: windclarion --- python/tvm/target/target.py | 20 ++++++++++---------- tests/python/unittest/test_target_target.py | 9 +++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/python/tvm/target/target.py b/python/tvm/target/target.py index ef7d76421fd0..9be7f83817be 100644 --- a/python/tvm/target/target.py +++ b/python/tvm/target/target.py @@ -180,16 +180,16 @@ def arm_cpu(model='unknown', options=None): Additional options """ trans_table = { - "pixel2": ["-model=snapdragon835", "-mtriple=arm64-linux-android -mattr=+neon"], - "mate10": ["-model=kirin970", "-mtriple=arm64-linux-android -mattr=+neon"], - "mate10pro": ["-model=kirin970", "-mtriple=arm64-linux-android -mattr=+neon"], - "p20": ["-model=kirin970", "-mtriple=arm64-linux-android -mattr=+neon"], - "p20pro": ["-model=kirin970", "-mtriple=arm64-linux-android -mattr=+neon"], - "rasp3b": ["-model=bcm2837", "-mtriple=armv7l-linux-gnueabihf -mattr=+neon"], - "rasp4b": ["-model=bcm2711", "-mtriple=arm-linux-gnueabihf -mattr=+neon"], - "rk3399": ["-model=rk3399", "-mtriple=aarch64-linux-gnu -mattr=+neon"], - "pynq": ["-model=pynq", "-mtriple=armv7a-linux-eabi -mattr=+neon"], - "ultra96": ["-model=ultra96", "-mtriple=aarch64-linux-gnu -mattr=+neon"], + "pixel2": ["-model=snapdragon835", "-mtriple=arm64-linux-android", "-mattr=+neon"], + "mate10": ["-model=kirin970", "-mtriple=arm64-linux-android", "-mattr=+neon"], + "mate10pro": ["-model=kirin970", "-mtriple=arm64-linux-android", "-mattr=+neon"], + "p20": ["-model=kirin970", "-mtriple=arm64-linux-android", "-mattr=+neon"], + "p20pro": ["-model=kirin970", "-mtriple=arm64-linux-android", "-mattr=+neon"], + "rasp3b": ["-model=bcm2837", "-mtriple=armv7l-linux-gnueabihf", "-mattr=+neon"], + "rasp4b": ["-model=bcm2711", "-mtriple=arm-linux-gnueabihf", "-mattr=+neon"], + "rk3399": ["-model=rk3399", "-mtriple=aarch64-linux-gnu", "-mattr=+neon"], + "pynq": ["-model=pynq", "-mtriple=armv7a-linux-eabi", "-mattr=+neon"], + "ultra96": ["-model=ultra96", "-mtriple=aarch64-linux-gnu", "-mattr=+neon"], } pre_defined_opt = trans_table.get(model, ["-model=%s" % model]) diff --git a/tests/python/unittest/test_target_target.py b/tests/python/unittest/test_target_target.py index 0fd2506bd3ba..fb365c8f9d78 100644 --- a/tests/python/unittest/test_target_target.py +++ b/tests/python/unittest/test_target_target.py @@ -16,6 +16,7 @@ # under the License. import tvm from tvm import te +from tvm.target import cuda, rocm, mali, intel_graphics, arm_cpu, vta, bifrost, hexagon @tvm.target.generic_func def mygeneric(data): @@ -67,6 +68,14 @@ def test_target_string_parse(): assert tvm.target.mali().device_name == "mali" assert tvm.target.arm_cpu().device_name == "arm_cpu" + +def test_target_create(): + targets = [cuda(), rocm(), mali(), intel_graphics(), arm_cpu('rk3399'), vta(), bifrost()] + for tgt in targets: + assert tgt is not None + + if __name__ == "__main__": test_target_dispatch() test_target_string_parse() + test_target_create() \ No newline at end of file