2019-04-17 10:49:11 +08:00
|
|
|
//
|
|
|
|
// CPURuntime.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2018/08/31.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
#ifndef CPURuntime_hpp
|
|
|
|
#define CPURuntime_hpp
|
|
|
|
|
2021-06-11 17:17:13 +08:00
|
|
|
#include <stdint.h>
|
2024-07-22 19:51:53 +08:00
|
|
|
#include <vector>
|
2021-06-11 17:17:13 +08:00
|
|
|
#include "core/Macro.h"
|
2024-07-22 19:51:53 +08:00
|
|
|
struct CPUGroup {
|
|
|
|
uint32_t minFreq;
|
|
|
|
uint32_t maxFreq;
|
|
|
|
std::vector<int> ids;
|
|
|
|
};
|
|
|
|
struct MNNCPUInfo {
|
2020-03-22 20:16:29 +08:00
|
|
|
bool fp16arith;
|
|
|
|
bool dot;
|
2022-10-30 08:44:24 +08:00
|
|
|
bool i8mm;
|
2024-07-22 19:51:53 +08:00
|
|
|
bool sve2;
|
2025-01-07 10:18:20 +08:00
|
|
|
bool sme2;
|
2024-07-22 19:51:53 +08:00
|
|
|
std::vector<CPUGroup> groups;
|
|
|
|
int cpuNumber = 0;
|
2020-03-22 20:16:29 +08:00
|
|
|
};
|
2025-07-16 13:11:57 +08:00
|
|
|
using cpu_mask_t = unsigned long;
|
2024-07-22 19:51:53 +08:00
|
|
|
int MNNSetSchedAffinity(const int* cpuIDs, int size);
|
|
|
|
int MNNGetCurrentPid();
|
2025-07-16 13:11:57 +08:00
|
|
|
cpu_mask_t MNNGetCPUMask(const std::vector<int>& cpuIds);
|
2024-07-22 19:51:53 +08:00
|
|
|
const MNNCPUInfo* MNNGetCPUInfo();
|
2020-03-22 20:16:29 +08:00
|
|
|
|
2019-04-17 10:49:11 +08:00
|
|
|
#endif /* CPUInfo_hpp */
|