Skip to content

Super slow on Mac MPS #16

@ran-weii

Description

@ran-weii

Hi, a follow up on #15: I compared cpu vs mps and compile vs no compile on halfcheetah for 100k steps using SAC. It shows that mps is significantly slower than cpu, and aot_eager backend makes compile slower and much more so for cpu, tho the default inductor backend makes compile quite a bit faster for cpu but doesn't work for mps.

Screenshot 2024-11-12 at 9 19 03 AM

Code change is the following:

if args.compile:
        mode = None  # "reduce-overhead" if not args.cudagraphs else None
        backend = "aot_eager" if device == torch.device("mps") else "inductor"
        update_main = torch.compile(update_main, mode=mode, backend=backend)
        update_pol = torch.compile(update_pol, mode=mode, backend=backend)
        policy = torch.compile(policy, mode=mode, backend=backend)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions