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

Add metal to list of backends for TVMC #8282

Merged
merged 1 commit into from
Jun 19, 2021
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
9 changes: 5 additions & 4 deletions python/tvm/driver/tvmc/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""
import json
import logging
from typing import Optional, Dict, List, Union
from typing import Dict, List, Optional, Union

import numpy as np
import tvm
Expand All @@ -30,12 +30,11 @@
from tvm.relay.param_dict import load_param_dict

from . import common
from .model import TVMCPackage, TVMCResult
from .common import TVMCException
from .main import register_parser
from .model import TVMCPackage, TVMCResult
from .result_utils import get_top_results


# pylint: disable=invalid-name
logger = logging.getLogger("TVMC")

Expand All @@ -51,7 +50,7 @@ def add_run_parser(subparsers):
# like 'webgpu', etc (@leandron)
parser.add_argument(
"--device",
choices=["cpu", "cuda", "cl"],
choices=["cpu", "cuda", "cl", "metal"],
default="cpu",
help="target device to run the compiled module. Defaults to 'cpu'",
)
Expand Down Expand Up @@ -391,6 +390,8 @@ def run_module(
dev = session.cuda()
elif device == "cl":
dev = session.cl()
elif device == "metal":
dev = session.metal()
else:
assert device == "cpu"
dev = session.cpu()
Expand Down