replace SUPPORT_MSVC by _MSC_VER

This commit is contained in:
taipingchangan 2022-08-08 16:29:43 +08:00
parent 96afb115bb
commit bdee27af3e
12 changed files with 12 additions and 28 deletions

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#ifdef ENABLE_SSE
#ifdef SUPPORT_MSVC
#ifdef _MSC_VER
#include <immintrin.h>
#else
#include <x86intrin.h>

View File

@ -23,7 +23,7 @@
#include "nnacl/fp32/pack_fp32.h"
#include "nnacl/intrinsics/ms_simd_instructions.h"
#ifdef SUPPORT_MSVC
#ifdef _MSC_VER
void AddMatrix(const float *v1, float *v2, float beta, int row, int col, int stride) {
#else
void AddMatrix(const float *restrict v1, float *restrict v2, float beta, int row, int col, int stride) {

View File

@ -132,8 +132,8 @@ class RegisterHostDependsHelper {
};
// Processes such as InferShape need to obtain some inputs value on the host
#define REGISTER_HOST_DEPENDS(name, depends...) \
static auto helper_host_depends_##name = abstract::RegisterHostDependsHelper(name, ##depends);
#define REGISTER_HOST_DEPENDS(name, ...) \
static auto helper_host_depends_##name = abstract::RegisterHostDependsHelper(name, __VA_ARGS__);
} // namespace abstract
} // namespace mindspore
#endif // MINDSPORE_CORE_ABSTRACT_PRIMITIVE_INFER_MAP_H_

View File

@ -444,20 +444,7 @@ void reset_id_with_offset() {
} // namespace id_generator
auto constexpr kTargetUnDefined = "kTargetUnDefined";
auto constexpr kPrimitiveTarget = "primitive_target";
auto constexpr kNotSupportOpForDevice = "not_support_op_for_device";
namespace {
__attribute__((unused)) void SetCNodeNotSupported(const CNodePtr &node, const std::string &device_name) {
MS_EXCEPTION_IF_NULL(node);
auto primitive = GetCNodePrimitive(node);
if (primitive != nullptr) {
auto value = MakeValue(device_name);
primitive->set_attr(kNotSupportOpForDevice, value);
} else {
MS_LOG(ERROR) << "Get cnode " << node->fullname_with_scope() << "'s primitive failed in device " << device_name;
}
MS_LOG(INFO) << "Cnode " << node->fullname_with_scope() << " is not supported for device " << device_name;
}
PrimitivePtr GetPrimitiveFromValueNode(const AnfNodePtr &node) {
auto value_node = dyn_cast_ptr<ValueNode>(node);
if (value_node == nullptr) {

View File

@ -1191,8 +1191,6 @@ MS_CORE_API void reset_id_with_offset();
using TaggedNodeMap = mindspore::HashMap<AnfNodePtr, size_t>;
using TaggedGraph = std::pair<FuncGraphPtr, TaggedNodeMap>;
MS_CORE_API std::string GetCNodeTarget(const AnfNodePtr &node);
// mark Cnode as not support for specify device
MS_CORE_API void SetCNodeNotSupported(const CNodePtr &node, std::string device_name);
std::string GetOriginNodeTarget(const AnfNodePtr &node);
MS_CORE_API bool ContainMultiTarget(const std::vector<AnfNodePtr> &nodes);
struct GraphSegment {

View File

@ -27,7 +27,7 @@ void ActorWorker::CreateThread() { thread_ = std::thread(&ActorWorker::RunWithSp
void ActorWorker::RunWithSpin() {
SetAffinity();
#if !defined(__APPLE__) && !defined(SUPPORT_MSVC)
#if !defined(__APPLE__) && !defined(_MSC_VER)
static std::atomic_int index = {0};
(void)pthread_setname_np(pthread_self(), ("ActorThread_" + std::to_string(index++)).c_str());
#endif

View File

@ -27,7 +27,7 @@ void ParallelWorker::CreateThread() { thread_ = std::thread(&ParallelWorker::Run
void ParallelWorker::Run() {
SetAffinity();
#if !defined(__APPLE__) && !defined(SUPPORT_MSVC)
#if !defined(__APPLE__) && !defined(_MSC_VER)
(void)pthread_setname_np(pthread_self(), ("ParallelThread_" + std::to_string(worker_id_)).c_str());
#endif
#ifdef PLATFORM_86

View File

@ -60,7 +60,7 @@ void Worker::SetAffinity() {
}
return;
#else
#if !defined(__APPLE__) && !defined(SUPPORT_MSVC)
#if !defined(__APPLE__) && !defined(_MSC_VER)
int ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &mask_);
if (ret != THREAD_OK) {
THREAD_ERROR("bind thread %lu to cpu failed. ERROR %d", pthread_self(), errno);
@ -91,7 +91,7 @@ void Worker::InitWorkerMask(const std::vector<int> &core_list, const size_t work
void Worker::Run() {
SetAffinity();
#if !defined(__APPLE__) && !defined(SUPPORT_MSVC)
#if !defined(__APPLE__) && !defined(_MSC_VER)
static std::atomic_int index = {0};
(void)pthread_setname_np(pthread_self(), ("KernelThread_" + std::to_string(index++)).c_str());
#endif

View File

@ -19,7 +19,7 @@
#include <utility>
#define HANDLER_DEFINE(return_type, name, args...) \
#define HANDLER_DEFINE(return_type, name, ...) \
public: \
template <typename... Args> \
static return_type name(const Args &... argss) { \
@ -28,7 +28,7 @@
} \
return name##_handler_(argss...); \
} \
using name##Handler = std::function<decltype(name<args>)>; \
using name##Handler = std::function<decltype(name<__VA_ARGS__>)>; \
static void Set##name##Handler(name##Handler handler) { name##_handler_ = std::move(handler); } \
\
private: \

View File

@ -1,6 +1,5 @@
if(MSVC)
add_compile_definitions(SUPPORT_MSVC)
add_compile_definitions(_ENABLE_ATOMIC_ALIGNMENT_FIX)
set(CMAKE_C_FLAGS "/O2 /EHsc /GS /Zi /utf-8")
set(CMAKE_CXX_FLAGS "/O2 /EHsc /GS /Zi /utf-8 /std:c++17")

View File

@ -31,7 +31,7 @@
namespace mindspore {
namespace lite {
uint64_t GetTimeUs() {
#ifdef SUPPORT_MSVC
#ifdef _MSC_VER
const int sec_to_us = 1000000;
LARGE_INTEGER cur_time, frequency;
QueryPerformanceCounter(&cur_time);

View File

@ -577,7 +577,7 @@ int Model::Export(Model *model, const char *filename) {
ofs.seekp(0, std::ios::beg);
ofs.write(liteModel->buf, liteModel->buf_size_);
ofs.close();
#ifdef SUPPORT_MSVC
#ifdef _MSC_VER
return RET_OK;
#else
return chmod(filename, S_IRUSR);