[Submodule] Bump FBGEMM to latest (#165544)

Summary:

* FBGEMM submodule updated to main
* CMake updated to reflect necessary changes
* Notably pulls in NVFP4 grouped gemm kernels

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Signed-off-by: Simon Layton <simonlayton@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165544
Approved by: https://github.com/cyyever, https://github.com/jeffdaily
This commit is contained in:
Simon Layton
2025-10-17 23:11:36 +00:00
committed by PyTorch MergeBot
parent e4d6c56ffb
commit 23417ae50f
4 changed files with 38 additions and 3 deletions

View File

@ -201,6 +201,19 @@ for hip_platform_file in hip_platform_files:
sources.write(line)
print(f"{hip_platform_file} updated")
# NOTE: fbgemm sources needing hipify
# fbgemm is its own project with its own build system. pytorch uses fbgemm as
# a submodule to acquire some gpu source files but compiles only those sources
# instead of using fbgemm's own build system. One of the source files refers
# to a header file that is the result of running hipify, but fbgemm uses
# slightly different hipify settings than pytorch. fbgemm normally hipifies
# and renames tuning_cache.cuh to tuning_cache_hip.cuh, but pytorch's settings
# for hipify puts it into its own 'hip' directory. After hipify runs below with
# the added fbgemm file, we move it to its expected location.
fbgemm_dir = "third_party/fbgemm/fbgemm_gpu/experimental/gen_ai/src/quantize/common/include/fbgemm_gpu/quantize"
fbgemm_original = f"{fbgemm_dir}/tuning_cache.cuh"
fbgemm_move_src = f"{fbgemm_dir}/hip/tuning_cache.cuh"
fbgemm_move_dst = f"{fbgemm_dir}/tuning_cache_hip.cuh"
hipify_python.hipify(
project_directory=proj_dir,
@ -212,7 +225,26 @@ hipify_python.hipify(
"torch/_inductor/codegen/cpp_wrapper_cpu.py",
"torch/_inductor/codegen/cpp_wrapper_gpu.py",
"torch/_inductor/codegen/wrapper.py",
fbgemm_original,
],
out_of_place_only=args.out_of_place_only,
hip_clang_launch=is_hip_clang(),
)
# only update the file if it changes or doesn't exist
do_write = True
src_lines = None
with open(fbgemm_move_src) as src:
src_lines = src.readlines()
if os.path.exists(fbgemm_move_dst):
dst_lines = None
with open(fbgemm_move_dst) as dst:
dst_lines = dst.readlines()
if src_lines == dst_lines:
print(f"{fbgemm_move_dst} skipped")
do_write = False
if do_write:
with open(fbgemm_move_dst, "w") as dst:
for line in src_lines:
dst.write(line)
print(f"{fbgemm_move_dst} updated")