Skip to content

Bump asmjit to 2025-05-24 #4503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 1 addition & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,8 @@ target_link_libraries(fbgemm_generic PUBLIC
$<BUILD_INTERFACE:asmjit>
$<BUILD_INTERFACE:cpuinfo>)

# On Windows:
# 1) Adding definition of ASMJIT_STATIC to avoid generating asmjit function
# calls with _dllimport attribute
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4267 /wd4305 /wd4309")
if(FBGEMM_LIBRARY_TYPE STREQUAL "static")
target_compile_definitions(fbgemm_generic PUBLIC ASMJIT_STATIC)
endif()
target_compile_options(fbgemm_avx2 PRIVATE "/arch:AVX2")
target_compile_options(fbgemm_avx512 PRIVATE "/arch:AVX512")
if(OpenMP_FOUND)
Expand Down Expand Up @@ -271,23 +265,10 @@ if(NOT TARGET asmjit)
else()
set(ASMJIT_STATIC ON)
endif()
set(ASMJIT_NO_INSTALL ON)

add_subdirectory("${ASMJIT_SRC_DIR}" "${FBGEMM_BINARY_DIR}/asmjit")
set_property(TARGET asmjit PROPERTY POSITION_INDEPENDENT_CODE ON)
# Add a flag required for mac build
if(NOT MSVC)
target_compile_options(asmjit PRIVATE "-Wno-sign-conversion")
endif()

target_compile_options_if_supported(asmjit -Wno-deprecated-enum-enum-conversion)
target_compile_options_if_supported(asmjit -Wno-deprecated-anon-enum-enum-conversion)
target_compile_options_if_supported(asmjit -Wno-error=deprecated-enum-enum-conversion)

if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 13.0.0)
# See https://github.com/pytorch/pytorch/issues/74352, https://github.com/pytorch/FBGEMM/issues/1173
target_compile_options_if_supported(asmjit -Wno-deprecated-copy)
target_compile_options_if_supported(asmjit -Wno-unused-but-set-variable)
endif()
endif()

if(NOT TARGET cpuinfo)
Expand All @@ -302,8 +283,6 @@ if(NOT TARGET cpuinfo)
set(CPUINFO_BUILD_MOCK_TESTS OFF CACHE BOOL "Do not build cpuinfo mock tests")
set(CPUINFO_BUILD_BENCHMARKS OFF CACHE BOOL "Do not build cpuinfo benchmarks")
set(CPUINFO_LIBRARY_TYPE static CACHE STRING "Set lib type to static")
#Select static runtime, needed for static build for MSVC
set(CPUINFO_RUNTIME_TYPE static CACHE STRING "Set runtime to static")
add_subdirectory("${CPUINFO_SOURCE_DIR}" "${FBGEMM_BINARY_DIR}/cpuinfo")
set_property(TARGET cpuinfo PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
Expand Down Expand Up @@ -351,16 +330,6 @@ install(
DESTINATION share/cmake/fbgemm
FILE fbgemmLibraryConfig.cmake)

if(MSVC)
if(FBGEMM_LIBRARY_TYPE STREQUAL "shared")
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})
endif()

#Make project importable from the build directory
#export(TARGETS fbgemm asmjit FILE fbgemmLibraryConfig.cmake)

Expand Down
2 changes: 1 addition & 1 deletion external/asmjit
Submodule asmjit updated 162 files
2 changes: 1 addition & 1 deletion include/fbgemm/SimdUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "./Utils.h" // @manual

#include <asmjit/asmjit.h> // @manual
#include <asmjit/x86.h> // @manual

namespace fbgemm {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/CodeGenHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

#pragma once
#include <asmjit/asmjit.h> // @manual
#include <asmjit/x86.h> // @manual
#include "fbgemm/SimdUtils.h"
#include "fbgemm/Utils.h"

Expand Down
2 changes: 1 addition & 1 deletion src/DirectConv.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

#pragma once
#include <asmjit/asmjit.h> // @manual
#include <asmjit/x86.h> // @manual
#include <cpuinfo.h>
#include <cassert>
#include <cstdint>
Expand Down
8 changes: 4 additions & 4 deletions src/EmbeddingSpMDM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <type_traits>
#define FBGEMM_EXPORTS

#include <asmjit/asmjit.h> // @manual
#include <asmjit/x86.h> // @manual
#include <cpuinfo.h>
#include <iostream>
#include <mutex>
Expand Down Expand Up @@ -311,7 +311,7 @@ GenEmbeddingSpMDMLookup<
x86::Gp scratchReg1_ = a->gpz(reg_id); // 12 or 13, also for mask

++reg_id;
x86::Gpd lengths_R_ = a->gpz(reg_id).r32(); // 13 or 14
auto lengths_R_ = a->gpz(reg_id).r32(); // 13 or 14
++reg_id;
x86::Gp scratchReg2_ = a->gpz(reg_id); // 14 or 15

Expand All @@ -330,7 +330,7 @@ GenEmbeddingSpMDMLookup<
const float*, // weights
outType*, // out
const int32_t*, // compressed_indices_table and then mask
const int*>(asmjit::CallConvId::kHost),
const int*>(),
a->environment());
} else {
func.init(
Expand All @@ -344,7 +344,7 @@ GenEmbeddingSpMDMLookup<
const offsetType*, // offsets or lengths
const float*, // weights
outType*, // out and then mask
const int*>(asmjit::CallConvId::kHost),
const int*>(),
a->environment());
}

Expand Down
5 changes: 2 additions & 3 deletions src/EmbeddingSpMDMNBit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include "fbgemm/FbgemmEmbedding.h"

#include <asmjit/asmjit.h> // @manual
#include <cpuinfo.h>
#include <cassert>
#include <iostream>
Expand Down Expand Up @@ -301,7 +300,7 @@ GenEmbeddingSpMDMNBitLookup<
const float*, // weights
float*, // out
const int32_t* /* compressed_indices_table */,
const int* /* mask */>(asmjit::CallConvId::kHost),
const int* /* mask */>(),
a->environment());
} else {
func.init(
Expand All @@ -315,7 +314,7 @@ GenEmbeddingSpMDMNBitLookup<
const offsetType*, // offsets or lengths
const float*, // weights
float*, // out
const int* /* mask */>(asmjit::CallConvId::kHost),
const int* /* mask */>(),
a->environment());
}

Expand Down
3 changes: 1 addition & 2 deletions src/FbgemmI64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ CodeGenBase<int64_t, int64_t, int64_t, int64_t>::getOrCreate(
asmjit::FuncDetail func;
func.init(
asmjit::FuncSignature::
build<void, int64_t*, int64_t*, int64_t*, int64_t*, int, int>(
asmjit::CallConvId::kHost),
build<void, int64_t*, int64_t*, int64_t*, int64_t*, int, int>(),
a->environment());

asmjit::FuncFrame frame;
Expand Down
3 changes: 1 addition & 2 deletions src/GenerateI8Depthwise.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "./GenerateI8Depthwise.h" // @manual

#include <asmjit/asmjit.h> // @manual
#include <cassert>
#include <iostream>
#include <numeric>
Expand Down Expand Up @@ -273,7 +272,7 @@ GenI8Depthwise::jit_kernel_signature GenI8Depthwise::getOrCreate(
int,
const int*,
int,
const std::int32_t*>(asmjit::CallConvId::kHost),
const std::int32_t*>(),
e->environment());

asmjit::FuncFrame frame;
Expand Down
2 changes: 0 additions & 2 deletions src/GenerateKernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
*/

#pragma once
#include <asmjit/asmjit.h> // @manual
#include <cpuinfo.h>
#include <map>
#include <mutex>
#include <sstream>
#include <string>
Expand Down
6 changes: 2 additions & 4 deletions src/GenerateKernelDirectConvU8S8S32ACC32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>::getOrCreateDirectConv(
asmjit::FuncDetail func;
func.init(
asmjit::FuncSignature::
build<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(
asmjit::CallConvId::kHost),
build<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(),
a->environment());

asmjit::FuncFrame frame;
Expand Down Expand Up @@ -646,8 +645,7 @@ DirectConvCodeGenBase<uint8_t, int8_t, int32_t, int32_t>::
asmjit::FuncDetail func;
func.init(
asmjit::FuncSignature::
build<void, uint8_t*, int8_t*, int32_t*, int, int, int, int>(
asmjit::CallConvId::kHost),
build<void, uint8_t*, int8_t*, int32_t*, int, int, int, int>(),
a->environment());

asmjit::FuncFrame frame;
Expand Down
3 changes: 1 addition & 2 deletions src/GenerateKernelU8S8S32ACC16.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ CodeGenBase<uint8_t, int8_t, int32_t, int16_t>::getOrCreate<inst_set_t::avx2>(
asmjit::FuncDetail func;
func.init(
asmjit::FuncSignature::
build<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(
asmjit::CallConvId::kHost),
build<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(),
a->environment());

asmjit::FuncFrame frame;
Expand Down
3 changes: 1 addition & 2 deletions src/GenerateKernelU8S8S32ACC16Avx512.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ CodeGenBase<uint8_t, int8_t, int32_t, int16_t>::getOrCreate(
asmjit::FuncDetail func;
func.init(
asmjit::FuncSignature::
build<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(
asmjit::CallConvId::kHost),
build<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(),
a->environment());

asmjit::FuncFrame frame;
Expand Down
3 changes: 1 addition & 2 deletions src/GenerateKernelU8S8S32ACC32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ CodeGenBase<uint8_t, int8_t, int32_t, int32_t>::getOrCreate(
asmjit::FuncDetail func;
func.init(
asmjit::FuncSignature::
build<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(
asmjit::CallConvId::kHost),
build<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(),
a->environment());

asmjit::FuncFrame frame;
Expand Down
3 changes: 1 addition & 2 deletions src/GenerateKernelU8S8S32ACC32Avx512VNNI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ CodeGenBase<uint8_t, int8_t, int32_t, int32_t>::getOrCreate(
asmjit::FuncDetail func;
func.init(
asmjit::FuncSignature::
build<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(
asmjit::CallConvId::kHost),
build<void, uint8_t*, int8_t*, int8_t*, int32_t*, int, int>(),
a->environment());

asmjit::FuncFrame frame;
Expand Down
3 changes: 1 addition & 2 deletions src/GroupwiseConv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#define FBGEMM_EXPORTS
#include "./GroupwiseConv.h" // @manual
#include <asmjit/asmjit.h> // @manual
#include <cpuinfo.h>
#include <array>
#include <iostream>
Expand Down Expand Up @@ -226,7 +225,7 @@ jit_conv_kernel_fp GenConvKernel<SPATIAL_DIM, INST_SET>::getOrCreate() {
int32_t,
int32_t,
int32_t,
int32_t*>(asmjit::CallConvId::kHost),
int32_t*>(),
a->environment());

frame_.init(func_);
Expand Down
2 changes: 1 addition & 1 deletion src/GroupwiseConv.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

#pragma once
#include <asmjit/asmjit.h> // @manual
#include <asmjit/x86.h> // @manual
#include <cpuinfo.h>
#include <cassert>
#include <cstdint>
Expand Down
1 change: 0 additions & 1 deletion src/GroupwiseConvAcc32Avx2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

#define FBGEMM_EXPORTS
#include <asmjit/asmjit.h> // @manual
#include "./CodeGenHelpers.h" // @manual
#include "./GroupwiseConv.h" // @manual
#include "fbgemm/Fbgemm.h"
Expand Down
1 change: 0 additions & 1 deletion src/GroupwiseConvAcc32Avx512.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

#define FBGEMM_EXPORTS
#include <asmjit/asmjit.h> // @manual
#include "./CodeGenHelpers.h" // @manual
#include "./GroupwiseConv.h" // @manual

Expand Down
3 changes: 1 addition & 2 deletions src/RowWiseSparseAdagradFused.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define FBGEMM_EXPORTS
#include "fbgemm/FbgemmEmbedding.h"

#include <asmjit/asmjit.h> // @manual
#include <cpuinfo.h>
#include <cassert>
#include <iostream>
Expand Down Expand Up @@ -180,7 +179,7 @@ typename ReturnFunctionSignature<indxType, offsetType, dataType>::
const int*, // lengths
float, // epsilon
float, // lr then rand_buffer
uint32_t*>(asmjit::CallConvId::kHost),
uint32_t*>(),
a->environment());

asmjit::FuncFrame frame;
Expand Down
3 changes: 1 addition & 2 deletions src/SparseAdagrad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define FBGEMM_EXPORTS
#include "fbgemm/FbgemmEmbedding.h"

#include <asmjit/asmjit.h> // @manual
#include <cpuinfo.h>
#include <cmath>
#include <iostream>
Expand Down Expand Up @@ -513,7 +512,7 @@ GenSparseAdagrad<indxType, instSet>::getOrCreate(
const int*, // mask_avx2
float, // weight_decay
const double*, // counter then counter_halflife
std::int64_t>(asmjit::CallConvId::kHost),
std::int64_t>(),
a->environment());

asmjit::FuncFrame frame;
Expand Down
4 changes: 4 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ if(FBGEMM_BUILD_TESTS AND NOT TARGET gtest)
endif()

#build Googletest framework
set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
add_subdirectory("${GOOGLETEST_SOURCE_DIR}" "${FBGEMM_BINARY_DIR}/googletest")
# Recover the build shared libs option.
set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS})
# add flags required for mac build
if(NOT MSVC)
target_compile_options(gtest PRIVATE "-Wno-deprecated-copy")
Expand Down
Loading