Skip to content
Open
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
16 changes: 16 additions & 0 deletions llama-tornado
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ from enum import Enum
class Backend(Enum):
OPENCL = "opencl"
PTX = "ptx"
METAL = "metal"


class LlamaRunner:
Expand Down Expand Up @@ -168,6 +169,14 @@ class LlamaRunner:
"ALL-SYSTEM,jdk.incubator.vector,tornado.runtime,tornado.annotation,tornado.drivers.common,tornado.drivers.ptx",
]
)
elif args.backend == Backend.METAL:
module_config.extend(
[
f"@{self.tornado_sdk}/etc/exportLists/metal-exports",
"--add-modules",
"ALL-SYSTEM,jdk.incubator.vector,tornado.runtime,tornado.annotation,tornado.drivers.common,tornado.drivers.metal",
]
)

module_config.extend(
[
Expand Down Expand Up @@ -410,6 +419,13 @@ def create_parser() -> argparse.ArgumentParser:
const=Backend.PTX,
help="Use PTX/CUDA backend",
)
hw_group.add_argument(
"--metal",
dest="backend",
action="store_const",
const=Backend.METAL,
help="Use Apple Metal backend (macOS only, requires TornadoVM 4.0+)",
)
hw_group.add_argument("--gpu-memory", default="14GB", help="GPU memory allocation")
hw_group.add_argument("--heap-min", default="20g", help="Minimum JVM heap size")
hw_group.add_argument("--heap-max", default="20g", help="Maximum JVM heap size")
Expand Down
Loading