(os vesion >= sp2) build with bazel
* bazel build support(define __DEPLOY_ON_XP_SP2__ when deploy on xp sp2):
(dbg)./bazel build //brain/megbrain:load_and_run --cpu='x86_windows_xp'
--compiler='clang_cl' -c dbg --copt "-D__DEPLOY_ON_XP_SP2__=1"
(opt)./bazel build //brain/megbrain:load_and_run --cpu='x86_windows_xp'
--compiler='clang_cl' -c opt --copt "-D__DEPLOY_ON_XP_SP2__=1"
* internal behavior:
will define MGB_HAVE_THREAD=0 when enable __DEPLOY_ON_XP_SP2__
* refer to
https://docs.microsoft.com/en-us/cpp/build/configuring-programs-for-windows-xp?view=msvc-160
xp sp2(x86) do not support vc runtime fully, casused by KERNEL32.dll do not
implement some base apis for c++ std function, for example,
std::mutex/std::thread/std::condition_variable as a workround, we will
disable some MegEngine features on xp sp2 env, for exampe, multi-thread etc!
* about DNN_MUTEX/MGB_MUTEX, if your code will build in inference
code (even CPU backends), please replace std::mutex to DNN_MUTEX/MGB_MUTEX,
* about multi-thread, if you code need multi-thread support, please
enable it when MGB_HAVE_THREAD=1
* about test build env status
1: Visual Studio 2019(MSVC version <= 14.26.28801)---- pass
2: Visual Studio 2019(MSVC version > 14.26.28801) ---- failed
caused by this 'new' version will put VCR depends on win7
KERNEL32.DLL, this may be fixed at Visual Studio 2019 later version
but we do not test at this MR merge point
3: Visual Studio 2017 ---------- pass
4: Visual Studio 2014 ---------- pass
GitOrigin-RevId: 65ac48b95e
as some reason: some version of trt/cudnn need
-Wl,--whole-archive attribute to fix cuda issue,
target A(CMAKE OBJECT,eg megbrain/megdnn): -Wl,--whole-archive depend on trt/cudnn
target B(SHARED LIBS,eg libmegengine.so) --> A with `PUBLIC` depends
target C(SHARED LIBS,eg _impertive.so) --> B with `PUBLIC` depends,
then ld will force link fatbin section into C, which will be undesired
what`s more, attribute PUBLIC/PRIVATE do not take effect
to OBJECT library(megbrain/megdnn)
what`s more, megengine/megengine_export have to PUBLIC for
mgb/imperative target, as SRC/include depends
so we pull cudalib depend from megbrain/megdnn to
megengine/megengine_export on linux os, to finall
target at windows os, for example lar on windows
GitOrigin-RevId: b278a69e1c
- refactor(mge): add support for optimizer.step().clear_grad() idiom
- refactor(mge): rename some methods of GradManager
- refactor(mge): remove tensor_nn and TensorDict
- refactor(mge): remove Buffer
- refactor(mge): remove requires_grad flag
- refactor(mge): add a default grad=None attribute to Tensor
- refactor(mge): deprecation for 1.0
GitOrigin-RevId: 3b723d9387
1: fix cmake cross-ios failed caused by df118a87
build static lib for APPLE define for XCODE third_party framework including require
2: megbrain_test/megdnn_test build when MGE_INFERENCE_ONLY=ON
now u can build megbrain_test/megdnn_test by:
EXTRA_CMAKE_ARGS="-DMGE_WITH_TEST=ON" ./scripts/cmake-build/xxx.sh
example macos-cross-ios build megdnn_test for IOS by
EXTRA_CMAKE_ARGS="-DMGE_WITH_TEST=ON" ./scripts/cmake-build/cross_build_ios_arm_inference.sh
3: reuse host flatc build when cross build mode
GitOrigin-RevId: 132f4bf893567bdb1d54de506449950513a5841f