mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Update generate-xnnpack-wrappers.py parsing to handle build identifier (#134724)
Fixes an issue after updating XNNPACK where parsing the XNNPACK CMakeLists breaks. I'm just ignored the generated build identifier for now, since it's not used and we would need to update the buck build to generate it at build time. Remove unused ukernels_xop XNNPACK target as it has no sources (after the recent update) and causes buck1 to complain. Pull Request resolved: https://github.com/pytorch/pytorch/pull/134724 Approved by: https://github.com/mcr229
This commit is contained in:
committed by
PyTorch MergeBot
parent
1dfb105239
commit
679b8fe426
11
third_party/generate-xnnpack-wrappers.py
vendored
11
third_party/generate-xnnpack-wrappers.py
vendored
@ -92,6 +92,11 @@ SRC_NAMES = {
|
||||
# add non-prod microkernel sources here:
|
||||
}
|
||||
|
||||
# Source files not needed in buck build.
|
||||
IGNORED_SOURCES = set((
|
||||
"\"${PROJECT_BINARY_DIR}/build_identifier.c\"", # Not currently used and requires build-time codegen.
|
||||
))
|
||||
|
||||
def handle_singleline_parse(line):
|
||||
start_index = line.find("(")
|
||||
end_index = line.find(")")
|
||||
@ -131,12 +136,14 @@ def update_sources(xnnpack_path, cmakefile = "XNNPACK/CMakeLists.txt"):
|
||||
while i < len(lines) and len(lines[i]) > 0 and ')' not in lines[i]:
|
||||
# remove "src/" at the beginning, remove whitespaces and newline
|
||||
value = lines[i].strip(' \t\n\r')
|
||||
sources[name].append(value[4:])
|
||||
if value not in IGNORED_SOURCES:
|
||||
sources[name].append(value[4:])
|
||||
i += 1
|
||||
if i < len(lines) and len(lines[i]) > 4:
|
||||
# remove "src/" at the beginning, possibly ')' at the end
|
||||
value = lines[i].strip(' \t\n\r)')
|
||||
sources[name].append(value[4:])
|
||||
if value not in IGNORED_SOURCES:
|
||||
sources[name].append(value[4:])
|
||||
else:
|
||||
i += 1
|
||||
return sources
|
||||
|
99
third_party/xnnpack.buck.bzl
vendored
99
third_party/xnnpack.buck.bzl
vendored
@ -993,103 +993,6 @@ def define_xnnpack(third_party, labels = [], XNNPACK_WINDOWS_AVX512F_ENABLED = F
|
||||
],
|
||||
)
|
||||
|
||||
fb_xplat_cxx_library(
|
||||
name = "ukernels_xop",
|
||||
srcs = PROD_XOP_MICROKERNEL_SRCS if is_arvr_mode() else [],
|
||||
headers = subdir_glob([
|
||||
("XNNPACK/src", "**/*.h"),
|
||||
("XNNPACK/src", "**/*.c"),
|
||||
]),
|
||||
header_namespace = "",
|
||||
apple_sdks = (IOS, MACOSX, APPLETVOS),
|
||||
compiler_flags = [
|
||||
"-O2",
|
||||
] + select({
|
||||
"DEFAULT": [],
|
||||
"ovr_config//cpu:x86_32": [
|
||||
"-mxop",
|
||||
],
|
||||
"ovr_config//cpu:x86_64": [
|
||||
"-mxop",
|
||||
],
|
||||
}),
|
||||
platform_compiler_flags = [
|
||||
(
|
||||
"x86|x86_64|platform009|platform010",
|
||||
[
|
||||
"-mxop",
|
||||
],
|
||||
),
|
||||
],
|
||||
fbobjc_preprocessor_flags = [
|
||||
"-DXNN_PRIVATE=",
|
||||
"-DXNN_INTERNAL=",
|
||||
],
|
||||
labels = labels,
|
||||
platform_preprocessor_flags = [
|
||||
(
|
||||
"windows-x86_64",
|
||||
[
|
||||
"-Drestrict=",
|
||||
],
|
||||
),
|
||||
],
|
||||
platform_srcs = ([
|
||||
(
|
||||
"x86|x86_64|platform009|platform010",
|
||||
PROD_XOP_MICROKERNEL_SRCS,
|
||||
),
|
||||
] if not is_arvr_mode() else []),
|
||||
preferred_linkage = "static",
|
||||
preprocessor_flags = [
|
||||
"-DXNN_LOG_LEVEL=0",
|
||||
],
|
||||
visibility = ["PUBLIC"],
|
||||
windows_clang_compiler_flags_override = WINDOWS_FLAGS + WINDOWS_CLANG_COMPILER_FLAGS + ["-mxop"],
|
||||
windows_compiler_flags_override = WINDOWS_FLAGS + ["-mxop"],
|
||||
deps = [
|
||||
":interface",
|
||||
],
|
||||
)
|
||||
|
||||
fb_xplat_cxx_library(
|
||||
name = "ukernels_xop_ovr_win32",
|
||||
headers = subdir_glob([
|
||||
("XNNPACK/src", "**/*.h"),
|
||||
("XNNPACK/src", "**/*.c"),
|
||||
]),
|
||||
header_namespace = "",
|
||||
apple_sdks = (IOS, MACOSX, APPLETVOS),
|
||||
compiler_flags = [
|
||||
"-O2",
|
||||
"-mxop",
|
||||
],
|
||||
fbobjc_preprocessor_flags = [
|
||||
"-DXNN_PRIVATE=",
|
||||
"-DXNN_INTERNAL=",
|
||||
],
|
||||
labels = labels,
|
||||
platform_preprocessor_flags = [
|
||||
(
|
||||
"windows-x86_64",
|
||||
[
|
||||
"-Drestrict=",
|
||||
],
|
||||
),
|
||||
],
|
||||
preferred_linkage = "static",
|
||||
preprocessor_flags = [
|
||||
"-DXNN_LOG_LEVEL=0",
|
||||
],
|
||||
visibility = ["PUBLIC"],
|
||||
windows_clang_compiler_flags_override = WINDOWS_FLAGS + WINDOWS_CLANG_COMPILER_FLAGS + ["-mxop"],
|
||||
windows_compiler_flags_override = WINDOWS_FLAGS + ["-mxop"],
|
||||
windows_srcs = PROD_XOP_MICROKERNEL_SRCS,
|
||||
deps = [
|
||||
":interface",
|
||||
],
|
||||
)
|
||||
|
||||
fb_xplat_cxx_library(
|
||||
name = "ukernels_fma3",
|
||||
srcs = PROD_FMA3_MICROKERNEL_SRCS if is_arvr_mode() else [],
|
||||
@ -2527,7 +2430,6 @@ def define_xnnpack(third_party, labels = [], XNNPACK_WINDOWS_AVX512F_ENABLED = F
|
||||
":ukernels_sse2",
|
||||
":ukernels_sse41",
|
||||
":ukernels_ssse3",
|
||||
":ukernels_xop",
|
||||
":ukernels_avx512vbmi",
|
||||
":ukernels_avx512vnni",
|
||||
":ukernels_avx512vnnigfni",
|
||||
@ -2552,7 +2454,6 @@ def define_xnnpack(third_party, labels = [], XNNPACK_WINDOWS_AVX512F_ENABLED = F
|
||||
":ukernels_sse41_ovr_win32",
|
||||
":ukernels_sse_ovr_win32",
|
||||
":ukernels_ssse3_ovr_win32",
|
||||
":ukernels_xop_ovr_win32",
|
||||
":ukernels_avx512vbmi",
|
||||
# ":ukernels_avx512vnni_ovr_win32", # Build crashes on Windows Clang 17.0.3, re-enable when fixed (T199959765)
|
||||
# ":ukernels_avx512vnnigfni_ovr_win32",
|
||||
|
Reference in New Issue
Block a user