Skip to content

MOLEDGL nvmath+cuBLAS backend#1983

Open
maxwelltsai wants to merge 3 commits into
facebookresearch:mainfrom
maxwelltsai:moledgl_nvmath
Open

MOLEDGL nvmath+cuBLAS backend#1983
maxwelltsai wants to merge 3 commits into
facebookresearch:mainfrom
maxwelltsai:moledgl_nvmath

Conversation

@maxwelltsai
Copy link
Copy Markdown

This PR implements a new dgl backend for MOLEDGL. When running fairchem with a runner.candidate_overrides=["moe_layer_type=dgl"] override, the linear ops in MOLEDGL will be dispatched to cuBLAS via the nvmath-python package. This aims to replace the fairchem_cpp branch and make the code compilation-free.

fairchem.core.common.segmentmm is the main driver that encapsulates the cuBLAS GEMM ops as python functions, which makes them directly callable from the model.

This PR also introduces an optional kwarg in MOLEDGL.forward(..., use_grouped_gemm=..., ), which controls whether the batch should be dispatched to cublasGemmEx() or cublasGemmGroupedBatchedEx() (optimal performance of using either one depends on the batch shape).

@meta-cla meta-cla Bot added the cla signed label May 1, 2026
@misko misko self-requested a review May 1, 2026 18:19
@misko misko self-assigned this May 1, 2026
@misko misko added enhancement New feature or request minor Minor version release labels May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed enhancement New feature or request minor Minor version release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants