From dd6cb13938ab968827497172e40ea905e02185ee Mon Sep 17 00:00:00 2001 From: EunTaik Lee Date: Tue, 3 Nov 2020 17:42:20 +0900 Subject: [PATCH 1/2] [TVMC] add cl support in tvmc runner --- python/tvm/driver/tvmc/runner.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/tvm/driver/tvmc/runner.py b/python/tvm/driver/tvmc/runner.py index a4abe8c31f56..75e20a5d64b7 100644 --- a/python/tvm/driver/tvmc/runner.py +++ b/python/tvm/driver/tvmc/runner.py @@ -50,7 +50,7 @@ def add_run_parser(subparsers): # like 'cl', 'webgpu', etc (@leandron) parser.add_argument( "--device", - choices=["cpu", "gpu"], + choices=["cpu", "gpu", "cl"], default="cpu", help="target device to run the compiled module. Defaults to 'cpu'", ) @@ -361,7 +361,12 @@ def run_module( # TODO expand to other supported devices, as listed in tvm.rpc.client (@leandron) logger.debug("device is %s", device) - ctx = session.cpu() if device == "cpu" else session.gpu() + if device == "gpu": + ctx = session.gpu() + elif device == "cl": + ctx = session.cl() + else: + ctx = session.cpu() if profile: logger.debug("creating runtime with profiling enabled") From 12ea63ebe144b5ebbc5f0b53001f877827069520 Mon Sep 17 00:00:00 2001 From: EunTaik Lee Date: Thu, 5 Nov 2020 19:42:30 +0900 Subject: [PATCH 2/2] Cleanup comment and asssert device type in else case --- python/tvm/driver/tvmc/runner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/tvm/driver/tvmc/runner.py b/python/tvm/driver/tvmc/runner.py index 75e20a5d64b7..dec0e9842a37 100644 --- a/python/tvm/driver/tvmc/runner.py +++ b/python/tvm/driver/tvmc/runner.py @@ -47,7 +47,7 @@ def add_run_parser(subparsers): parser.set_defaults(func=drive_run) # TODO --device needs to be extended and tested to support other targets, - # like 'cl', 'webgpu', etc (@leandron) + # like 'webgpu', etc (@leandron) parser.add_argument( "--device", choices=["cpu", "gpu", "cl"], @@ -366,6 +366,7 @@ def run_module( elif device == "cl": ctx = session.cl() else: + assert device == "cpu" ctx = session.cpu() if profile: