Skip to content

Support multi-dimensional runtime_meta in RES streaming buffers by lazy init (#5643)#5643

Closed
FriedCosey wants to merge 1 commit intopytorch:mainfrom
FriedCosey:export-D100944325
Closed

Support multi-dimensional runtime_meta in RES streaming buffers by lazy init (#5643)#5643
FriedCosey wants to merge 1 commit intopytorch:mainfrom
FriedCosey:export-D100944325

Conversation

@FriedCosey
Copy link
Copy Markdown

@FriedCosey FriedCosey commented Apr 15, 2026

Summary:

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The res_runtime_meta buffer in SplitTableBatchedEmbeddingBagsCodegen was hardcoded to shape (cache_size, 1). When _hash_zch_runtime_meta has dim > 1 (e.g., feature cache storing 2 cached features via zch_custom_runtime_meta_dim=2), the .copy_() in raw_embedding_stream() crashes with:
RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]

Full output P2274437578

This diff lazy resizes the buffer defaults to (cache_size, 1, torch.long) and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325

@meta-cla meta-cla Bot added the cla signed label Apr 15, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented Apr 15, 2026

@FriedCosey has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100944325.

@meta-codesync meta-codesync Bot changed the title Support multi-dimensional runtime_meta in RES streaming buffers by lazy init Support multi-dimensional runtime_meta in RES streaming buffers by lazy init (#5643) Apr 16, 2026
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 16, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 17, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 17, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 17, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
@FriedCosey FriedCosey force-pushed the export-D100944325 branch 2 times, most recently from 57dc926 to 6f26962 Compare April 17, 2026 02:11
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 17, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 17, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 17, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 17, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 17, 2026
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
@FriedCosey FriedCosey force-pushed the export-D100944325 branch 2 times, most recently from 49b9861 to e091dc0 Compare April 18, 2026 06:20
FriedCosey pushed a commit to FriedCosey/FBGEMM that referenced this pull request Apr 18, 2026
…zy init (pytorch#5643)

Summary:

X-link: facebookresearch/FBGEMM#2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
…zy init (pytorch#5643)

Summary:
Pull Request resolved: pytorch#5643

X-link: https://github.com/facebookresearch/FBGEMM/pull/2591

The `res_runtime_meta` buffer in `SplitTableBatchedEmbeddingBagsCodegen` was hardcoded to shape `(cache_size, 1)`. When `_hash_zch_runtime_meta` has dim > 1 (e.g., feature cache storing 2 cached features via `zch_custom_runtime_meta_dim=2`), the `.copy_()` in `raw_embedding_stream()` crashes with:
`RuntimeError: output with shape [N, 1] doesn't match the broadcast shape [N, 2]`

Full output P2274437578

This diff lazy resizes the buffer defaults to `(cache_size, 1, torch.long)` and auto-corrects on the first iteration when runtime_meta data arrives with a different shape or dtype. This is a one-time operation, after the first resize, dims match and no further reallocation occurs.

Reviewed By: chouxi

Differential Revision: D100944325
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented Apr 20, 2026

This pull request has been merged in ffdfb0e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant