Skip to content

Metal-native replacement for flex_gemm bottleneck? #1

Description

@codetiger

Hey — really appreciate this port. It’s great to have TRELLIS.2 on Apple Silicon.
The README calls out the pure-PyTorch sparse conv in conv_none.py as the main bottleneck (~10x slower than CUDA flex_gemm). Before I start hacking, wanted to check: are you already working on a Metal-native replacement, or is anyone else?

If the path is open, I’d like to take a crack at it. Rough plan: one fused Metal kernel doing neighbor-lookup → gather → tile-GEMM → atomic scatter-add in a single dispatch, called from PyTorch via torch.mps.compile_shader (keeps it a drop-in for conv_none.py, no framework switch). fp16 throughout to match what flex_gemm does. Based on similar gather-matmul kernels, 3-5x on this layer seems realistic.

Happy to open a proper issue or draft PR to discuss the design before writing code. Just didn’t want to duplicate work if you already have something in progress.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions