Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TVMC] add cl support in tvmc runner #6831

Merged
merged 2 commits into from
Nov 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions python/tvm/driver/tvmc/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ 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"],
choices=["cpu", "gpu", "cl"],
default="cpu",
help="target device to run the compiled module. Defaults to 'cpu'",
)
Expand Down Expand Up @@ -361,7 +361,13 @@ 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:
assert device == "cpu"
ctx = session.cpu()
comaniac marked this conversation as resolved.
Show resolved Hide resolved

if profile:
logger.debug("creating runtime with profiling enabled")
Expand Down