Skip to content

feat: add aten.glu converter - #4475

Open
zupengwang wants to merge 1 commit into
pytorch:mainfrom
zupengwang:feature/aten-glu-converter-2663
Open

feat: add aten.glu converter#4475
zupengwang wants to merge 1 commit into
pytorch:mainfrom
zupengwang:feature/aten-glu-converter-2663

Conversation

@zupengwang

Copy link
Copy Markdown

Description

Adds Dynamo converter support for torch.ops.aten.glu.default. The converter implements GLU as an equal split followed by sigmoid and elementwise multiplication, and conservatively requires the split dimension to be statically known and even while allowing other dimensions to remain dynamic.

This avoids a PyTorch fallback and extra TensorRT engine partitions for models that use GLU, including the Conformer use case described in #2197. No additional dependencies are required.

Validation performed locally:

  • Converter tests cover FP32, FP16, dim=0/1/-1, rank 2/3, and a dynamic batch range.
  • GLU, split, and sigmoid converter tests: 17 passed.
  • Full-compilation torch.export checks on two RTX 3090 GPUs produced a single TensorRT module with no PyTorch fallback for FP32, FP16, and dynamic shapes; outputs matched eager PyTorch exactly in the tested cases.
  • Black, Ruff, isort, mypy, and git diff --check passed for the changed files.

The full repository test suite and GitHub CI have not been run. The dynamic GLU split dimension remains unsupported; invalid odd split dimensions retain PyTorch's existing error behavior.

Fixes #2663

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks (no non-obvious hacks were added)
  • I have made corresponding changes to the documentation (not required; supported-op documentation is generated from the converter registry)
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

@meta-cla meta-cla Bot added the cla signed label Aug 11, 2026
@github-actions github-actions Bot added component: tests Issues re: Tests component: conversion Issues re: Conversion stage component: core Issues re: The core compiler component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Aug 11, 2026
@github-actions
github-actions Bot requested a review from lanluo-nvidia August 11, 2026 04:45
@zupengwang
zupengwang marked this pull request as ready for review August 11, 2026 06:58
@narendasan
narendasan requested review from apbose and removed request for lanluo-nvidia August 11, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: api [Python] Issues re: Python API component: conversion Issues re: Conversion stage component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: tests Issues re: Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

↔ [Converter] Add support for torch.ops.aten.glu.default in Torch-TensorRT

1 participant