From 65f9e4affbbe2db7f794d7feeec47eb5a552a5cc Mon Sep 17 00:00:00 2001 From: Jake Stevens Date: Mon, 27 Jul 2026 08:42:04 -0700 Subject: [PATCH] Bump vendored XNNPACK to include qd8_bf16_qb4w subgraph FC Bumps backends/xnnpack/third-party/XNNPACK from 1adaa7c to 92a7ad5 (google/XNNPACK master, PR #10818), adding the qd8_bf16_qb4w fully-connected path to the subgraph layer. Required for bf16 dynamic quant (8da4w) to lower and run via XNNPACK. This XNNPACK revision splits two new source files out of existing translation units, so the ExecuTorch Buck build (which enumerates sources explicitly rather than via CMake) must list them or linking fails with undefined symbols: - src/subgraph/rewrites/cvt_to_fp32.cc (fp16/bf16 -> fp32 fallback rewrite; defines xnn_subgraph_fallback_from_{fp16,bf16}_to_fp32 and xnn_subgraph_alias_fp32_fallback_data) -> added to the 'subgraph' target. - src/xnnpack/init-once.c (defines xnn_init_once_impl / xnn_reset_all_init_guards; in CMake it is part of the xnnpack-hardware-config object lib) -> added to the 'XNNPACK' target next to configs/hardware-config.c. It also adds new AVX512-FP16 micro-kernels (e.g. f16-vapproxgelu) that crash clang-cl 18's codegen on Windows. clang-cl is reported to CMake as Clang (not MSVC), so XNNPACK's own MSVC gate for AVX512FP16 does not apply; disable XNNPACK_ENABLE_AVX512FP16 on Windows in the existing WIN32 block alongside the other options that don't build there. --- backends/xnnpack/cmake/Dependencies.cmake | 4 ++++ backends/xnnpack/third-party/XNNPACK | 2 +- backends/xnnpack/third-party/xnnpack.buck.bzl | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/backends/xnnpack/cmake/Dependencies.cmake b/backends/xnnpack/cmake/Dependencies.cmake index 4fb80d5c18c..d02ac4a7926 100644 --- a/backends/xnnpack/cmake/Dependencies.cmake +++ b/backends/xnnpack/cmake/Dependencies.cmake @@ -66,6 +66,10 @@ if(WIN32) set_overridable_option(XNNPACK_ENABLE_AVX256VNNI OFF) set_overridable_option(XNNPACK_ENABLE_AVX256VNNIGFNI OFF) set_overridable_option(XNNPACK_ENABLE_AVX512BF16 OFF) + # clang-cl (reported by CMake as Clang, not MSVC, so XNNPACK's own MSVC gate + # does not catch it) crashes with an internal codegen error compiling some of + # the AVX512-FP16 micro-kernels, so disable them on Windows. + set_overridable_option(XNNPACK_ENABLE_AVX512FP16 OFF) endif() set(XNNPACK_BUILD_ALL_MICROKERNELS diff --git a/backends/xnnpack/third-party/XNNPACK b/backends/xnnpack/third-party/XNNPACK index 1adaa7c709d..92a7ad501b9 160000 --- a/backends/xnnpack/third-party/XNNPACK +++ b/backends/xnnpack/third-party/XNNPACK @@ -1 +1 @@ -Subproject commit 1adaa7c709d4839d29e1f219cb962b01c9e6a905 +Subproject commit 92a7ad501b9516f9fecae119e0146dd1f58e54c1 diff --git a/backends/xnnpack/third-party/xnnpack.buck.bzl b/backends/xnnpack/third-party/xnnpack.buck.bzl index ac861435af8..3aa82f89cd4 100644 --- a/backends/xnnpack/third-party/xnnpack.buck.bzl +++ b/backends/xnnpack/third-party/xnnpack.buck.bzl @@ -70,7 +70,10 @@ def define_xnnpack(): # @lint-ignore BUCKLINT: native and fb_native are explicitly forbidden in fbcode. native.cxx_library( name = "subgraph", - srcs = SUBGRAPH_SRCS + ["XNNPACK/src/datatype.c"], + srcs = SUBGRAPH_SRCS + [ + "XNNPACK/src/datatype.c", + "XNNPACK/src/subgraph/rewrites/cvt_to_fp32.cc", + ], compiler_flags = [ "-Wno-error=missing-braces", # required since the SGX toolchain does not have this by default ], @@ -1150,6 +1153,7 @@ def define_xnnpack(): "XNNPACK/src/init.c", "XNNPACK/src/params.c", "XNNPACK/src/configs/hardware-config.c", + "XNNPACK/src/xnnpack/init-once.c", "XNNPACK/src/microparams-init.c", "XNNPACK/src/microkernel-utils.c", "XNNPACK/src/reference/binary-elementwise.cc",