Skip to content

Commit 9308e9e

Browse files
author
pytorchbot
committed
2026-08-29 nightly release (5e56ddb)
1 parent 43c603b commit 9308e9e

21 files changed

Lines changed: 219 additions & 84 deletions

cmake/modules/CppLibrary.cmake

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,35 @@ function(fbgemm_get_warning_flags)
9090
# Accepted and diagnosing on BOTH g++ 11.5 and clang 22 (probed), so it
9191
# goes here rather than behind the clang guard. Subplan 04 called this out
9292
# correctly.
93-
-Waddress-of-packed-member)
93+
-Waddress-of-packed-member
94+
# ---- Phase B2: shadowing ----------------------------------------------
95+
# Portable: probed accepted AND diagnosing on both g++ 11.5 and clang 22
96+
# (the bare flag; -Wshadow-all, -Wshadow-uncaptured-local and
97+
# -Wshadow-field-in-constructor are clang-only and are NOT added here).
98+
#
99+
# This is enabled DEMOTED -- see -Wno-error=shadow in the shared
100+
# suppressions. The B0 census measured 299 first-party diagnostics across
101+
# 22 files, so enabling it at full strength would break the build outright.
102+
# Demoting makes those 299 visible in CI and keeps the census reproducible
103+
# instead of being a one-off local probe, while the fixups land
104+
# incrementally. The escape comes out when the count reaches zero.
105+
#
106+
# -Wshadow is the right first Phase B flag on two measurements: it is the
107+
# most concentrated (79% of diagnostics in 5 files) and it is the only one
108+
# of the three with ZERO third-party exposure, so unlike
109+
# -Wshorten-64-to-32 and -Wzero-as-null-pointer-constant it is not blocked
110+
# on giving PyTorch/ATen/c10 headers -isystem treatment.
111+
-Wshadow
112+
# ---- Phase B3: zero as null pointer -----------------------------------
113+
# Portable: probed accepted AND diagnosing on g++ 11.5 and clang 22.
114+
# Enabled DEMOTED -- see -Wno-error=zero-as-null-pointer-constant.
115+
#
116+
# B0 measured 449 first-party diagnostics across 130 files. That is the
117+
# LARGEST job of the three B flags despite having ~260 fewer diagnostics
118+
# than -Wshorten-64-to-32, because it is diffuse: only 19% sit in the top
119+
# five files, versus 79% for -Wshadow. Rank by file count and
120+
# concentration, not by raw count.
121+
-Wzero-as-null-pointer-constant)
94122

95123
# Clang-only warning flags. These are appended to `_cc` ONLY when the host
96124
# compiler is clang (see the guarded append below), because the OSS CI matrix
@@ -228,7 +256,25 @@ function(fbgemm_get_warning_flags)
228256
-Wno-vla
229257
-Wno-error=unused-parameter
230258
-Wno-error=unknown-pragmas
231-
-Wno-error=attributes)
259+
-Wno-error=attributes
260+
# Phase B2 is landing demoted while its 299 first-party diagnostics are
261+
# fixed; see -Wshadow in _cc_common. Portable escape -- probed demoting to
262+
# a warning on both g++ and clang, unlike the A2.1 escape which g++
263+
# hard-errors on and which therefore had to be clang-guarded.
264+
# TODO(T169200065): delete once the -Wshadow count reaches zero. This is
265+
# the whole point of enabling it demoted rather than silently.
266+
-Wno-error=shadow
267+
# Phase B3, landing demoted while its 449 diagnostics across 130 files
268+
# are fixed; see -Wzero-as-null-pointer-constant in _cc_common. Portable
269+
# escape -- probed demoting to a warning on both g++ and clang.
270+
#
271+
# This escape also covers the 48 diagnostics coming from PyTorch / ATen /
272+
# c10 / folly / thrift headers, which are NOT FBGEMM's to fix. Those need
273+
# -isystem treatment (unowned work that B0 newly identified) before this
274+
# flag can go to hard error, independently of the first-party backlog.
275+
# TODO(T169200065): delete once the count reaches zero AND the external
276+
# headers are -isystem.
277+
-Wno-error=zero-as-null-pointer-constant)
232278

233279
# Clang suppressions, split by the clang version that made them necessary.
234280
# The CXX path applies these conditionally on the HOST clang version (below);
@@ -260,8 +306,7 @@ function(fbgemm_get_warning_flags)
260306

261307
set(_cc_suppressions_clang_gt17
262308
-Wno-vla-cxx-extension
263-
-Wno-error=global-constructors
264-
-Wno-error=shadow)
309+
-Wno-error=global-constructors)
265310

266311
# Full clang-shaped suppression set, assembled unconditionally so it is
267312
# available even when the HOST compiler is GCC. Used only for the hipcc list.

external/composable_kernel

Submodule composable_kernel updated 6166 files

fbgemm_gpu/bench/batched_unary_embeddings_benchmark.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@
1616
import fbgemm_gpu.batched_unary_embeddings_ops as batched_unary_embeddings_ops
1717
import numpy as np
1818
import torch
19+
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
1920
from torch.profiler import profile
2021

2122
# pyre-fixme[16]: Module `fbgemm_gpu` has no attribute `open_source`.
2223
open_source: bool = getattr(fbgemm_gpu, "open_source", False)
2324

24-
if open_source:
25-
# pyre-ignore[21]
26-
from bench_utils import benchmark_torch_function
27-
else:
28-
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
29-
25+
if not open_source:
3026
torch.ops.load_library("//deeplearning/fbgemm/fbgemm_gpu:sparse_ops")
3127

3228

fbgemm_gpu/bench/histogram_binning_calibration_benchmark.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
import click
4141
import torch
42+
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
4243
from torch import Tensor
4344

4445
_HbcFn: TypeAlias = Callable[[Tensor], tuple[Tensor, Tensor]]
@@ -49,18 +50,9 @@
4950
try:
5051
# pyre-ignore[21]
5152
from fbgemm_gpu import open_source # noqa: F401
52-
53-
open_source_fbgemm: bool = True
5453
except Exception:
55-
open_source_fbgemm: bool = False
5654
torch.ops.load_library("//deeplearning/fbgemm/fbgemm_gpu:sparse_ops")
5755

58-
if open_source_fbgemm:
59-
# pyre-ignore[21]
60-
from bench_utils import benchmark_torch_function
61-
else:
62-
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
63-
6456

6557
# ──────────────────────────────────────────────────────────────────────
6658
# Constants (matching tritonbench port)

fbgemm_gpu/bench/jagged_tensor_benchmark.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import click
2020
import fbgemm_gpu
2121
import torch
22+
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
2223
from torch.profiler import profile, schedule
2324

2425
logger: logging.Logger = logging.getLogger()
@@ -27,12 +28,7 @@
2728
# pyre-fixme[16]: Module `fbgemm_gpu` has no attribute `open_source`.
2829
open_source: bool = getattr(fbgemm_gpu, "open_source", False)
2930

30-
if open_source:
31-
# pyre-ignore[21]
32-
from bench_utils import benchmark_torch_function
33-
else:
34-
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
35-
31+
if not open_source:
3632
torch.ops.load_library("//deeplearning/fbgemm/fbgemm_gpu:sparse_ops")
3733
torch.ops.load_library(
3834
"//deeplearning/fbgemm/fbgemm_gpu:permute_pooled_embedding_ops_cpu"

fbgemm_gpu/bench/merge_embeddings_benchmark.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import numpy as np
1818
import tabulate
1919
import torch
20+
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
2021
from fbgemm_gpu.split_embedding_configs import SparseType
2122
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
2223
IntNBitTableBatchedEmbeddingBagsCodegen,
@@ -33,12 +34,7 @@
3334
# pyre-fixme[16]: Module `fbgemm_gpu` has no attribute `open_source`.
3435
open_source: bool = getattr(fbgemm_gpu, "open_source", False)
3536

36-
if open_source:
37-
# pyre-ignore[21]
38-
from bench_utils import benchmark_torch_function
39-
else:
40-
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
41-
37+
if not open_source:
4238
torch.ops.load_library("//deeplearning/fbgemm/fbgemm_gpu:merge_pooled_embeddings")
4339

4440

@@ -251,7 +247,7 @@ def print_p2p_bandwidth(
251247
for j in range(num_gpus):
252248
with torch.cuda.device(i):
253249
t, _ = benchmark_torch_function(
254-
lambda: (
250+
lambda i=i, j=j: (
255251
pooled_ad_embeddings[i].copy_(pooled_ad_embeddings[j])
256252
if i != j
257253
else pooled_ad_embeddings[i].clone()

fbgemm_gpu/bench/quantize_ops_benchmark.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import fbgemm_gpu
1717
import hypothesis.strategies as st
1818
import torch
19+
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
1920
from fbgemm_gpu.quantize_utils import fp32_to_mx4, mx4_to_fp32
2021
from hypothesis import given, settings
2122

@@ -28,12 +29,7 @@
2829
# pyre-fixme[16]: Module `fbgemm_gpu` has no attribute `open_source`.
2930
open_source: bool = getattr(fbgemm_gpu, "open_source", False)
3031

31-
if open_source:
32-
# pyre-ignore[21]
33-
from bench_utils import benchmark_torch_function
34-
else:
35-
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
36-
32+
if not open_source:
3733
torch.ops.load_library("//deeplearning/fbgemm/fbgemm_gpu:sparse_ops")
3834

3935

@@ -497,7 +493,11 @@ def mixdim(
497493
.to(torch.int)
498494
.cuda()
499495
)
500-
input_refs = [torch.randn((batch_size, d)).cuda() for d in table_dims]
496+
# Citrine C3: create benchmark tensors directly on the accelerator.
497+
input_refs = [
498+
torch.randn((batch_size, d), device=torch.accelerator.current_accelerator())
499+
for d in table_dims
500+
]
501501
input_refs_int8 = [
502502
torch.ops.fbgemm.FloatToFused8BitRowwiseQuantized(t) for t in input_refs
503503
]

fbgemm_gpu/bench/repeat_arange_benchmark.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,15 @@
8282
import click
8383
import fbgemm_gpu
8484
import torch
85+
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
8586

8687
logger: logging.Logger = logging.getLogger()
8788
logger.setLevel(logging.INFO)
8889

8990
# pyre-fixme[16]: Module `fbgemm_gpu` has no attribute `open_source`.
9091
open_source: bool = getattr(fbgemm_gpu, "open_source", False)
9192

92-
if open_source:
93-
# pyre-ignore[21]
94-
from bench_utils import benchmark_torch_function
95-
else:
96-
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
97-
93+
if not open_source:
9894
torch.ops.load_library("//deeplearning/fbgemm/fbgemm_gpu:sparse_ops")
9995

10096

fbgemm_gpu/bench/sparse_ops_benchmark.py

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import fbgemm_gpu
2121
import numpy as np
2222
import torch
23+
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
2324
from torch.profiler import profile, schedule
2425

2526
logger: logging.Logger = logging.getLogger()
@@ -28,12 +29,7 @@
2829
# pyre-fixme[16]: Module `fbgemm_gpu` has no attribute `open_source`.
2930
open_source: bool = getattr(fbgemm_gpu, "open_source", False)
3031

31-
if open_source:
32-
# pyre-ignore[21]
33-
from bench_utils import benchmark_torch_function
34-
else:
35-
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
36-
32+
if not open_source:
3733
torch.ops.load_library("//deeplearning/fbgemm/fbgemm_gpu:sparse_ops")
3834
torch.ops.load_library("//deeplearning/fbgemm/fbgemm_gpu:sparse_ops_cpu")
3935
torch.ops.load_library("//deeplearning/fbgemm/fbgemm_gpu/codegen:index_select_ops")
@@ -945,15 +941,13 @@ def reorder_batched_ad_indices_bench(
945941
assert itype == "int" or itype == "long", "Only int and long are supported"
946942
index_type = torch.int64 if itype == "long" else torch.int32
947943

944+
# Citrine C3: create index tensors directly on the selected device.
948945
if broadcast_indices:
949946
cat_ad_indices = (
950947
torch.randint(
951-
low=0,
952-
high=100,
953-
size=(batch_size * table_size * length,),
948+
low=0, high=100, size=(batch_size * table_size * length,), device=device
954949
)
955950
.int()
956-
.to(device)
957951
.to(data_type)
958952
)
959953
cat_ad_lengths = (
@@ -973,9 +967,9 @@ def reorder_batched_ad_indices_bench(
973967
low=0,
974968
high=100,
975969
size=(batch_size * table_size * num_ads * length,),
970+
device=device,
976971
)
977972
.int()
978-
.to(device)
979973
.to(data_type)
980974
)
981975
cat_ad_lengths = (
@@ -990,11 +984,10 @@ def reorder_batched_ad_indices_bench(
990984
.to(device)
991985
)
992986

993-
batch_offsets = (
994-
torch.tensor([num_ads * b for b in range(batch_size + 1)]).int()
995-
).to(
996-
device
997-
) # Fixed: removed unconditional .cuda() call
987+
# Citrine C3: create offsets directly on the selected device.
988+
batch_offsets = torch.tensor(
989+
[num_ads * b for b in range(batch_size + 1)], device=device
990+
).int() # Fixed: removed unconditional .cuda() call
998991
num_ads_in_batch = batch_size * num_ads
999992
reordered_cat_ad_lengths = torch.ops.fbgemm.reorder_batched_ad_lengths(
1000993
cat_ad_lengths, batch_offsets, num_ads_in_batch, broadcast_indices
@@ -1118,9 +1111,10 @@ def reorder_batched_ad_lengths_bench(
11181111

11191112
# Fixed: use .to(device) directly instead of .int().cuda().to(device)
11201113
# which unconditionally moved to CUDA before moving to the target device
1121-
batch_offsets = (
1122-
torch.tensor([num_ads * b for b in range(batch_size + 1)]).int()
1123-
).to(device)
1114+
# Citrine C3: create offsets directly on the selected device.
1115+
batch_offsets = torch.tensor(
1116+
[num_ads * b for b in range(batch_size + 1)], device=device
1117+
).int()
11241118
num_ads_in_batch = batch_size * num_ads
11251119

11261120
def _kineto_trace_handler(p: profile) -> None:
@@ -1200,11 +1194,13 @@ def reorder_batched_sequence_embeddings_bench(
12001194
f"T={table_size}, A={num_items}, L={length}, D={dim})."
12011195
)
12021196

1197+
# Citrine C3: create embeddings directly on the selected device.
12031198
cat_sequence_embeddings = torch.rand(
12041199
batch_size * table_size * num_items * length,
12051200
dim,
12061201
dtype=data_type,
1207-
).to(device)
1202+
device=device,
1203+
)
12081204
cat_sequence_embeddings_lengths = (
12091205
torch.cat(
12101206
[
@@ -1217,10 +1213,11 @@ def reorder_batched_sequence_embeddings_bench(
12171213
.to(device)
12181214
)
12191215

1220-
batch_offsets = (
1221-
torch.tensor([num_items * b for b in range(batch_size + 1)])
1222-
.to(index_type if device == "cpu" else torch.int32)
1223-
.to(device)
1216+
# Citrine C3: create offsets directly on the selected device.
1217+
batch_offsets = torch.tensor(
1218+
[num_items * b for b in range(batch_size + 1)],
1219+
dtype=index_type if device == "cpu" else torch.int32,
1220+
device=device,
12241221
)
12251222
num_items_in_batch = batch_size * num_items
12261223
reordered_cat_sequence_embeddings_lengths = (
@@ -1321,9 +1318,14 @@ def index_select_bench(
13211318

13221319
# Add optimizer to perform zero grad in order to reset gradients
13231320
# before the accumulation phase
1324-
optim_index: torch.optim.Optimizer = torch.optim.SGD(inputs, lr=0.1)
1325-
optim_batch: torch.optim.Optimizer = torch.optim.SGD([concat_inputs], lr=0.1)
1326-
optim_group: torch.optim.Optimizer = torch.optim.SGD(gis_inputs, lr=0.1)
1321+
# Citrine C2: use the multi-tensor optimizer implementation.
1322+
optim_index: torch.optim.Optimizer = torch.optim.SGD(inputs, lr=0.1, foreach=True)
1323+
optim_batch: torch.optim.Optimizer = torch.optim.SGD(
1324+
[concat_inputs], lr=0.1, foreach=True
1325+
)
1326+
optim_group: torch.optim.Optimizer = torch.optim.SGD(
1327+
gis_inputs, lr=0.1, foreach=True
1328+
)
13271329

13281330
def index_select_fwd_ref(
13291331
inputs: list[torch.Tensor], indices: list[torch.Tensor]

fbgemm_gpu/bench/tbe/tbe_utils_benchmark.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import fbgemm_gpu
2020
import numpy as np
2121
import torch
22+
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
2223
from fbgemm_gpu.split_embedding_configs import EmbOptimType as OptimType, SparseType
2324
from fbgemm_gpu.split_table_batched_embeddings_ops_inference import (
2425
IntNBitTableBatchedEmbeddingBagsCodegen,
@@ -43,12 +44,6 @@
4344
# pyre-fixme[16]: Module `fbgemm_gpu` has no attribute `open_source`.
4445
open_source: bool = getattr(fbgemm_gpu, "open_source", False)
4546

46-
if open_source:
47-
# pyre-ignore[21]
48-
from bench_utils import benchmark_torch_function
49-
else:
50-
from fbgemm_gpu.bench.bench_utils import benchmark_torch_function
51-
5247
logging.basicConfig(level=logging.DEBUG)
5348

5449

@@ -376,8 +371,9 @@ def bounds_check_indices( # noqa C901
376371
oob_positions = torch.randperm(num_indices)[:num_oob]
377372
req.indices[oob_positions] = E
378373

379-
warning = torch.tensor([0]).long().to(get_device())
380-
rows_per_table = torch.tensor([E for _ in range(T)]).long().to(get_device())
374+
# Citrine C3: create bounds-check tensors directly on the target device.
375+
warning = torch.tensor([0], device=get_device()).long()
376+
rows_per_table = torch.tensor([E for _ in range(T)], device=get_device()).long()
381377

382378
bc_mode = BoundsCheckMode(bounds_check_mode)
383379
bounds_check_version = 1

0 commit comments

Comments
 (0)