-
Notifications
You must be signed in to change notification settings - Fork 696
Tune max segment length per cta in triton table batched embeddings, and expose the param via cli #5212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
OmarPavel
wants to merge
1
commit into
pytorch:main
Choose a base branch
from
OmarPavel:export-D88338051
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+24
−10
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b85370c to
44f2f0c
Compare
OmarPavel
added a commit
to OmarPavel/FBGEMM
that referenced
this pull request
Dec 13, 2025
…nd expose the param via cli (pytorch#5212) Summary: X-link: pytorch/pytorch#170113 X-link: facebookresearch/FBGEMM#2209 Tune max segment length per cta in triton table batched embeddings, and expose the param via cli. Improves performance by ~2% on B200 We were using hardcoded 1024, tuned for H100. This change sets the default for B200 to 4096 (after testing smaller and larger values). It also exposes this flag via command line, if used together with --no-deterministic, you can add --max-cta-segment-length 4096 to change this via cmdline (for whatever cuda device you're building for). Tested at 512/1024/2048/4096/8192 values, 4096 outperforms at the two tested batch sizes of 256 and 512 ``` Embedding Dim: 256 ┌─────────────────────┬───────────────────┬──────────────┐ │ CTA Segment Length │ Backward Time (μs)│ vs 1024 │ ├─────────────────────┼───────────────────┼──────────────┤ │ 512 │ 24,651 │ -4.1% slower │ │ 1024 (default) │ 23,680 │ baseline │ │ 4096 │ 23,118 │ +2.4% faster │ │ 8192 │ 28,698 │ -21.2% slower│ └─────────────────────┴───────────────────┴──────────────┘ Embedding Dim: 512 ┌─────────────────────┬───────────────────┬──────────────┐ │ CTA Segment Length │ Backward Time (μs)│ vs 1024 │ ├─────────────────────┼───────────────────┼──────────────┤ │ 1024 (default) │ 42,067 │ baseline │ │ 2048 │ 41,471 │ +1.4% faster │ │ 4096 │ 41,235 │ +2.0% faster │ │ 8192 │ 41,414 │ +1.6% faster │ └─────────────────────┴───────────────────┴──────────────┘ Reviewed By: stashuk-olek Differential Revision: D88338051
44f2f0c to
07b3621
Compare
OmarPavel
added a commit
to OmarPavel/pytorch
that referenced
this pull request
Dec 13, 2025
…nd expose the param via cli (pytorch#170113) Summary: X-link: pytorch/FBGEMM#5212 X-link: facebookresearch/FBGEMM#2209 Tune max segment length per cta in triton table batched embeddings, and expose the param via cli. Improves performance by ~2% on B200 We were using hardcoded 1024, tuned for H100. This change sets the default for B200 to 4096 (after testing smaller and larger values). It also exposes this flag via command line, if used together with --no-deterministic, you can add --max-cta-segment-length 4096 to change this via cmdline (for whatever cuda device you're building for). Tested at 512/1024/2048/4096/8192 values, 4096 outperforms at the two tested batch sizes of 256 and 512 ``` Embedding Dim: 256 ┌─────────────────────┬───────────────────┬──────────────┐ │ CTA Segment Length │ Backward Time (μs)│ vs 1024 │ ├─────────────────────┼───────────────────┼──────────────┤ │ 512 │ 24,651 │ -4.1% slower │ │ 1024 (default) │ 23,680 │ baseline │ │ 4096 │ 23,118 │ +2.4% faster │ │ 8192 │ 28,698 │ -21.2% slower│ └─────────────────────┴───────────────────┴──────────────┘ Embedding Dim: 512 ┌─────────────────────┬───────────────────┬──────────────┐ │ CTA Segment Length │ Backward Time (μs)│ vs 1024 │ ├─────────────────────┼───────────────────┼──────────────┤ │ 1024 (default) │ 42,067 │ baseline │ │ 2048 │ 41,471 │ +1.4% faster │ │ 4096 │ 41,235 │ +2.0% faster │ │ 8192 │ 41,414 │ +1.6% faster │ └─────────────────────┴───────────────────┴──────────────┘ Test Plan: buck run -m ovr_configtriton:beta -c fbcode.enable_gpu_sections=true -c fbcode.platform010_cuda_version=12.8 -c python.package_style=inplace fbcode//deeplearning/fbgemm/fbgemm_gpu/fb/ triton:triton_table_batched_embeddings_bench -- device --alpha=1.15 --batch-size=131072 --embedding-dim=512 --weights-precision=fp32 --iters=5 --no-deterministic --max-cta-segment-length 4096 buck run -m ovr_config//triton:beta -c fbcode.enable_gpu_sections=true -c fbcode.platform010_cuda_version=12.8 -c python.package_style=inplace fbcode//deeplearning/fbgemm/fbgemm_gpu/fb/triton:triton_table_batched_embeddings_bench -- device --alpha=1.15 --batch-size=131072 --embedding-dim=512 --weights-precision=fp32 --iters=5 --no-deterministic --max-cta-segment-length 4096 Reviewed By: stashuk-olek Differential Revision: D88338051
…nd expose the param via cli (pytorch#5212) Summary: X-link: pytorch/pytorch#170113 X-link: facebookresearch/FBGEMM#2209 Tune max segment length per cta in triton table batched embeddings, and expose the param via cli. Improves performance by ~2% on B200 We were using hardcoded 1024, tuned for H100. This change sets the default for B200 to 4096 (after testing smaller and larger values). It also exposes this flag via command line, if used together with --no-deterministic, you can add --max-cta-segment-length 4096 to change this via cmdline (for whatever cuda device you're building for). Tested at 512/1024/2048/4096/8192 values, 4096 outperforms at the two tested batch sizes of 256 and 512 ``` Embedding Dim: 256 ┌─────────────────────┬───────────────────┬──────────────┐ │ CTA Segment Length │ Backward Time (μs)│ vs 1024 │ ├─────────────────────┼───────────────────┼──────────────┤ │ 512 │ 24,651 │ -4.1% slower │ │ 1024 (default) │ 23,680 │ baseline │ │ 4096 │ 23,118 │ +2.4% faster │ │ 8192 │ 28,698 │ -21.2% slower│ └─────────────────────┴───────────────────┴──────────────┘ Embedding Dim: 512 ┌─────────────────────┬───────────────────┬──────────────┐ │ CTA Segment Length │ Backward Time (μs)│ vs 1024 │ ├─────────────────────┼───────────────────┼──────────────┤ │ 1024 (default) │ 42,067 │ baseline │ │ 2048 │ 41,471 │ +1.4% faster │ │ 4096 │ 41,235 │ +2.0% faster │ │ 8192 │ 41,414 │ +1.6% faster │ └─────────────────────┴───────────────────┴──────────────┘ Reviewed By: stashuk-olek Differential Revision: D88338051
07b3621 to
6eb0746
Compare
OmarPavel
added a commit
to OmarPavel/pytorch
that referenced
this pull request
Dec 15, 2025
…nd expose the param via cli (pytorch#170113) Summary: X-link: pytorch/FBGEMM#5212 X-link: facebookresearch/FBGEMM#2209 Tune max segment length per cta in triton table batched embeddings, and expose the param via cli. Improves performance by ~2% on B200 We were using hardcoded 1024, tuned for H100. This change sets the default for B200 to 4096 (after testing smaller and larger values). It also exposes this flag via command line, if used together with --no-deterministic, you can add --max-cta-segment-length 4096 to change this via cmdline (for whatever cuda device you're building for). Tested at 512/1024/2048/4096/8192 values, 4096 outperforms at the two tested batch sizes of 256 and 512 ``` Embedding Dim: 256 ┌─────────────────────┬───────────────────┬──────────────┐ │ CTA Segment Length │ Backward Time (μs)│ vs 1024 │ ├─────────────────────┼───────────────────┼──────────────┤ │ 512 │ 24,651 │ -4.1% slower │ │ 1024 (default) │ 23,680 │ baseline │ │ 4096 │ 23,118 │ +2.4% faster │ │ 8192 │ 28,698 │ -21.2% slower│ └─────────────────────┴───────────────────┴──────────────┘ Embedding Dim: 512 ┌─────────────────────┬───────────────────┬──────────────┐ │ CTA Segment Length │ Backward Time (μs)│ vs 1024 │ ├─────────────────────┼───────────────────┼──────────────┤ │ 1024 (default) │ 42,067 │ baseline │ │ 2048 │ 41,471 │ +1.4% faster │ │ 4096 │ 41,235 │ +2.0% faster │ │ 8192 │ 41,414 │ +1.6% faster │ └─────────────────────┴───────────────────┴──────────────┘ Test Plan: buck run -m ovr_configtriton:beta -c fbcode.enable_gpu_sections=true -c fbcode.platform010_cuda_version=12.8 -c python.package_style=inplace fbcode//deeplearning/fbgemm/fbgemm_gpu/fb/ triton:triton_table_batched_embeddings_bench -- device --alpha=1.15 --batch-size=131072 --embedding-dim=512 --weights-precision=fp32 --iters=5 --no-deterministic --max-cta-segment-length 4096 buck run -m ovr_config//triton:beta -c fbcode.enable_gpu_sections=true -c fbcode.platform010_cuda_version=12.8 -c python.package_style=inplace fbcode//deeplearning/fbgemm/fbgemm_gpu/fb/triton:triton_table_batched_embeddings_bench -- device --alpha=1.15 --batch-size=131072 --embedding-dim=512 --weights-precision=fp32 --iters=5 --no-deterministic --max-cta-segment-length 4096 Reviewed By: stashuk-olek Differential Revision: D88338051
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Tune max segment length per cta in triton table batched embeddings, and expose the param via cli.
Improves performance by ~2% on B200
We were using hardcoded 1024, tuned for H100.
This change sets the default for B200 to 4096 (after testing smaller and larger values).
It also exposes this flag via command line, if used together with --no-deterministic, you can add --max-cta-segment-length 4096 to change this via cmdline (for whatever cuda device you're building for).
Tested at 512/1024/2048/4096/8192 values, 4096 outperforms at the two tested batch sizes of 256 and 512