Skip to content

Commit

Permalink
Fix windows x86 build (#1697)
Browse files Browse the repository at this point in the history
* [FIX] remove nanodet for windows

* remove ninga compile for some bug

* fix x86 mat type register macro name

* fix x86 matmul with 2 inputs

Co-authored-by: darrenyao87 <62542779+darrenyao87@users.noreply.github.com>
  • Loading branch information
Maosquerade and darrenyao87 committed Jun 29, 2022
1 parent e833088 commit a247660
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions examples/base/tnn_sdk_sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define TNN_EXAMPLES_BASE_TNN_SDK_SAMPLE_H_
#ifdef _WIN32
#define NOMINMAX
#include <iomanip>
#endif
#include <cmath>
#include <fstream>
Expand Down
4 changes: 3 additions & 1 deletion examples/windows/x86/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ file(GLOB_RECURSE UTIL_SRC
"${CMAKE_SOURCE_DIR}/../../utils/*.cc")

file(GLOB_RECURSE WEBCAM_SRC "${CMAKE_SOURCE_DIR}/../../base/ocr*.cc")
list(REMOVE_ITEM BASE_SRC ${WEBCAM_SRC})
file(GLOB_RECURSE NANODET_SRC "${CMAKE_SOURCE_DIR}/../../base/*nanodet.cc")

list(REMOVE_ITEM BASE_SRC ${WEBCAM_SRC} ${NANODET_SRC})

if (TNN_DEMO_WITH_OPENCV)
add_definitions(-D_OPENCV_)
Expand Down
2 changes: 1 addition & 1 deletion examples/windows/x86/build_msvc_native.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cd %ROOT_DIR%\..\..\..\examples\windows\x86\
mkdir build_msvc_native
cd build_msvc_native

cmake .. -G "Ninja" ^
cmake .. ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_SYSTEM_NAME=Windows ^
-DCMAKE_SYSTEM_PROCESSOR=AMD64 ^
Expand Down
1 change: 1 addition & 0 deletions scripts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ cuda_linux_release
build_cuda_msvc
cuda_msvc_release
build_linux_native
build_win
8 changes: 7 additions & 1 deletion source/tnn/device/x86/acc/x86_mat_mul_layer_acc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ X86MatMulLayerAcc::~X86MatMulLayerAcc() {}

Status X86MatMulLayerAcc::Init(Context *context, LayerParam *param, LayerResource *resource,
const std::vector<Blob *> &inputs, const std::vector<Blob *> &outputs) {
Status ret;
if (inputs.size() == 2) {
ret = X86LayerAcc::Init(context, param, resource, inputs, outputs);
RETURN_ON_NEQ(ret, TNN_OK);
return TNN_OK;
}

auto res = dynamic_cast<MatMulLayerResource *>(resource);
CHECK_PARAM_NULL(res);

Status ret;
if (res->weight.GetDataType() == DATA_TYPE_HALF) {
LayerResource *fp32_res = nullptr;
RETURN_ON_NEQ(ConvertHalfResource(LAYER_MATMUL, res, &fp32_res), TNN_OK);
Expand Down
2 changes: 1 addition & 1 deletion source/tnn/device/x86/x86_blob_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class X86BlobConvertFuncRegister {
};

#define REGISTER_X86_BLOB_CONVERT_FUNC(mat_type, data_type, cvt_dir, cvt_func) \
X86BlobConvertFuncRegister g_arm_##mat_type##_##data_type##_##cvt_dir##_register(mat_type, data_type, \
X86BlobConvertFuncRegister g_x86_##mat_type##_##data_type##_##cvt_dir##_register(mat_type, data_type, \
cvt_dir, cvt_func);

} // namespace TNN_NS
Expand Down

0 comments on commit a247660

Please sign in to comment.