From 5d7fdd4762965b2209acb9df4de40d1c3bbe6ff1 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Mon, 15 Jun 2020 17:57:27 +0800 Subject: [PATCH] fix(brain): fix winodws build GitOrigin-RevId: 74eaea594e673e4fb327a4428475e72f332c8bcd --- CMakeLists.txt | 4 ++-- src/opr/impl/utility.cpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 12282d394..7405ee250 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,8 +106,8 @@ if(MSVC OR WIN32) if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang-cl") message(FATAL_ERROR "only support clang-cl for windows build, pls check detail: scripts/cmake-build/BUILD_README.md") endif() - # add flags for sse/avx for X86 - set(WIN_FLAGS "-msse4.2 -mavx -mavx2") + # add flags for enable sse instruction optimize for X86, enable avx header to compile avx code + set(WIN_FLAGS "-msse4.2 -O2 -D_AVX_ -D_AVX2_ -D__AVX__ -D__AVX2__ -D__FMA__") # if u CPU is cascadelake series, u can enable for performance # set(WIN_FLAGS "{WIN_FLAGS} -march=cascadelake -mtune=cascadelake") # set(WIN_FLAGS "{WIN_FLAGS} -mavx512cd -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi -mavx512vnni") diff --git a/src/opr/impl/utility.cpp b/src/opr/impl/utility.cpp index 1c1951894..ca2d174fd 100644 --- a/src/opr/impl/utility.cpp +++ b/src/opr/impl/utility.cpp @@ -476,7 +476,9 @@ void AssertEqual::scn_do_execute_finish(const DeviceTensorND &) { auto err = DTypeScalar::make_from_raw( m_hv.dtype(), m_hv.raw_ptr()).get_cast(); if (m_param.verbose) { - fprintf(stderr, + //! FIXME: stderr will be slow when build windows with VS clang-cl (test in VM), + //! but I can`t find the root case. fix it when you figure out + fprintf(stdout, "AssertEqual: err=%g (name=%s id=%zu)\n", err, cname(), id()); } if (!(err >= 0 && err <= m_param.maxerr)) { -- GitLab