Browse Source

Auto-update fbgemm to v0.8.0 (#4810)

* Update fbgemm to v0.8.0

* add patch

* fix msvc v142 bug

---------

Co-authored-by: star9029 <[email protected]>
ruki 1 year ago
parent
commit
59044d027e

+ 55 - 0
packages/f/fbgemm/patches/0.8.0/dep-unbundle.patch

@@ -0,0 +1,55 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 35f0a967..bac7b4a2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -246,7 +246,8 @@ message(WARNING "CMAKE_CXX_FLAGS_DEBUG is ${CMAKE_CXX_FLAGS_DEBUG}")
+ message(WARNING "CMAKE_CXX_FLAGS_RELEASE is ${CMAKE_CXX_FLAGS_RELEASE}")
+ message(WARNING "==========")
+ 
+-if(NOT TARGET asmjit)
++find_package(asmjit CONFIG REQUIRED)
++if(0)
+   # Download asmjit from github if ASMJIT_SRC_DIR is not specified.
+   if(NOT DEFINED ASMJIT_SRC_DIR)
+     set(ASMJIT_SRC_DIR "${FBGEMM_SOURCE_DIR}/third_party/asmjit"
+@@ -279,7 +280,8 @@ if(NOT TARGET asmjit)
+   endif()
+ endif()
+ 
+-if(NOT TARGET cpuinfo)
++find_package(cpuinfo CONFIG REQUIRED)
++if(0)
+   #Download cpuinfo from github if CPUINFO_SOURCE_DIR is not specified.
+   if(NOT DEFINED CPUINFO_SOURCE_DIR)
+     set(CPUINFO_SOURCE_DIR "${FBGEMM_SOURCE_DIR}/third_party/cpuinfo"
+@@ -363,12 +365,7 @@ target_include_directories(fbgemm BEFORE
+     PUBLIC $<BUILD_INTERFACE:${FBGEMM_SOURCE_DIR}>
+     PUBLIC $<BUILD_INTERFACE:${FBGEMM_SOURCE_DIR}/include>)
+ 
+-target_link_libraries(fbgemm
+-  $<BUILD_INTERFACE:asmjit>
+-  $<BUILD_INTERFACE:cpuinfo>)
+-add_dependencies(fbgemm
+-  asmjit
+-  cpuinfo)
++target_link_libraries(fbgemm asmjit cpuinfo)
+ 
+ if(OpenMP_FOUND)
+   target_link_libraries(fbgemm OpenMP::OpenMP_CXX)
+@@ -392,12 +389,12 @@ install(
+ 
+ if(MSVC)
+   if(FBGEMM_LIBRARY_TYPE STREQUAL "shared")
+-    install(
+-      FILES $<TARGET_PDB_FILE:fbgemm> $<TARGET_PDB_FILE:asmjit>
+-      DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
++    # install(
++    #   FILES $<TARGET_PDB_FILE:fbgemm> $<TARGET_PDB_FILE:asmjit>
++    #   DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
+   endif()
+   install(TARGETS fbgemm DESTINATION ${CMAKE_INSTALL_LIBDIR})
+-  install(TARGETS asmjit DESTINATION ${CMAKE_INSTALL_LIBDIR})
++  # install(TARGETS asmjit DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ endif()
+ 
+ #Make project importable from the build directory

+ 12 - 0
packages/f/fbgemm/patches/0.8.0/msvc-omp.patch

@@ -0,0 +1,12 @@
+diff --git a/src/Utils.cc b/src/Utils.cc
+index bd970432..a3829247 100644
+--- a/src/Utils.cc
++++ b/src/Utils.cc
+@@ -801,6 +801,7 @@ std::pair<K*, V*> radix_sort_parallel(
+       std::swap(input_keys, output_keys);
+       std::swap(input_values, output_values);
+ #pragma omp barrier
++{}
+     }
+   }
+ #ifdef _MSC_VER

+ 6 - 0
packages/f/fbgemm/xmake.lua

@@ -6,10 +6,16 @@ package("fbgemm")
     add_urls("https://github.com/pytorch/FBGEMM/archive/refs/tags/$(version).tar.gz",
              "https://github.com/pytorch/FBGEMM.git")
 
+    add_versions("v0.8.0", "f754dbc6becf8ece0474872c4e797445b55c21799c1f1d219470c0c5818207dd")
     add_versions("v0.7.0", "c51ac26bc0aa8fef7e80631c4abdd3a7c33d1a097359cef9b008bf9e1203c071")
 
+    add_patches("0.8.0", "patches/0.8.0/dep-unbundle.patch", "505ccda3b12ec519cb0732352b223862b3470c207e03e84889b977cbdc1d9aae")
     add_patches("0.7.0", "patches/0.7.0/dep-unbundle.patch", "f3117ff728989146d5ab0c370fe410c73459091f65cae5f6b304e5637889fb8f")
 
+    if is_plat("windows") then
+        add_patches("0.8.0", "patches/0.8.0/msvc-omp.patch", "d4a7830e40a476ffdeda00d2f7901a7db6e7950392ff672144d5e9f3c37ced2f")
+    end
+
     -- need libtorch
     add_configs("gpu", {description = "Build fbgemm_gpu library", default = false, type = "boolean"})
     add_configs("cpu", {description = "Build FBGEMM_GPU without GPU support", default = false, type = "boolean"})