avx512 x86cpu info
This commit is contained in:
parent
8f1bd1c1bb
commit
b7e1fd30d6
|
@ -92,26 +92,26 @@ int IntelX86CpuInfoInit(void) {
|
|||
return NNACL_OK;
|
||||
}
|
||||
|
||||
bool IntelX86InstructionSetSupportCheck(void) {
|
||||
X86CpuInfoErrorCodeEnum IntelX86InstructionSetSupportCheck(void) {
|
||||
if (IntelX86CpuInfoInit() != NNACL_OK) {
|
||||
return false;
|
||||
return X86CPUINFO_PLATFORM_ERR;
|
||||
}
|
||||
#ifdef ENABLE_AVX512
|
||||
if (!X86_Avx512_Support()) {
|
||||
return false;
|
||||
return X86CPUINFO_AVX512_ERR;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AVX
|
||||
if (!X86_Avx_Support()) {
|
||||
return false;
|
||||
return X86CPUINFO_AVX_ERR;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SSE
|
||||
if (!X86_Sse_Support()) {
|
||||
return false;
|
||||
return X86CPUINFO_SSE_ERR;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
return X86CPUINFO_OK;
|
||||
}
|
||||
|
|
|
@ -23,13 +23,22 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum X86CpuInfoErrorCodeEnum {
|
||||
X86CPUINFO_OK = 0,
|
||||
X86CPUINFO_PLATFORM_ERR = 1,
|
||||
X86CPUINFO_AVX512_ERR,
|
||||
X86CPUINFO_AVX_ERR,
|
||||
X86CPUINFO_SSE_ERR,
|
||||
X86CPUINFO_END = 9999
|
||||
} X86CpuInfoErrorCodeEnum;
|
||||
|
||||
const bool X86_Fma_Support(void);
|
||||
const bool X86_Sse_Support(void);
|
||||
const bool X86_Avx_Support(void);
|
||||
const bool X86_Avx512_Support(void);
|
||||
|
||||
bool IsIntelX86Platform(void);
|
||||
bool IntelX86InstructionSetSupportCheck(void);
|
||||
X86CpuInfoErrorCodeEnum IntelX86InstructionSetSupportCheck(void);
|
||||
|
||||
int IntelX86CpuInfoInit(void);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2021 Huawei Technologies Co., Ltd
|
||||
* Copyright 2021-2022 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -22,13 +22,24 @@
|
|||
#endif
|
||||
|
||||
inline bool PlatformInstructionSetSupportCheck() {
|
||||
bool flag = true;
|
||||
|
||||
#if defined(ENABLE_AVX512) || defined(ENABLE_AVX)
|
||||
flag = IntelX86InstructionSetSupportCheck();
|
||||
auto ret = IntelX86InstructionSetSupportCheck();
|
||||
if (ret == X86CPUINFO_PLATFORM_ERR) {
|
||||
MS_LOG(WARNING) << "This is not intel platform.";
|
||||
return true;
|
||||
} else if (ret == X86CPUINFO_AVX512_ERR) {
|
||||
MS_LOG(ERROR) << "This is avx512 version, but the platform don't support avx512 instruction.";
|
||||
return false;
|
||||
} else if (ret == X86CPUINFO_AVX_ERR) {
|
||||
MS_LOG(ERROR) << "This is avx version, but the platform don't support avx instruction.";
|
||||
return false;
|
||||
} else if (ret == X86CPUINFO_SSE_ERR) {
|
||||
MS_LOG(ERROR) << "This is sse version, but the platform don't support sse instruction.";
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return flag;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ARM
|
||||
|
|
|
@ -16,9 +16,13 @@
|
|||
#include "include/api/model_parallel_runner.h"
|
||||
#include "src/cxx_api/model_pool/model_pool.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "src/cpu_info.h"
|
||||
|
||||
namespace mindspore {
|
||||
Status ModelParallelRunner::Init(const std::string &model_path, const std::shared_ptr<RunnerConfig> &runner_config) {
|
||||
if (!PlatformInstructionSetSupportCheck()) {
|
||||
return kLiteNotSupport;
|
||||
}
|
||||
model_pool_ = std::make_shared<ModelPool>();
|
||||
if (model_pool_ == nullptr) {
|
||||
MS_LOG(ERROR) << "model pool is nullptr.";
|
||||
|
|
Loading…
Reference in New Issue