| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef NCNN_CPU_H |
| | #define NCNN_CPU_H |
| |
|
| | #include <stddef.h> |
| |
|
| | #if (defined _WIN32 && !(defined __MINGW32__)) |
| | #define WIN32_LEAN_AND_MEAN |
| | #include <windows.h> |
| | #endif |
| | #if defined __ANDROID__ || defined __linux__ |
| | #include <sched.h> |
| | #endif |
| |
|
| | #include "platform.h" |
| |
|
| | namespace ncnn { |
| |
|
| | class NCNN_EXPORT CpuSet |
| | { |
| | public: |
| | CpuSet(); |
| | void enable(int cpu); |
| | void disable(int cpu); |
| | void disable_all(); |
| | bool is_enabled(int cpu) const; |
| | int num_enabled() const; |
| |
|
| | public: |
| | #if (defined _WIN32 && !(defined __MINGW32__)) |
| | ULONG_PTR mask; |
| | #endif |
| | #if defined __ANDROID__ || defined __linux__ |
| | cpu_set_t cpu_set; |
| | #endif |
| | #if __APPLE__ |
| | unsigned int policy; |
| | #endif |
| | }; |
| |
|
| | |
| | |
| | NCNN_EXPORT int cpu_support_arm_edsp(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_neon(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_vfpv4(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_asimdhp(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_cpuid(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_asimddp(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_asimdfhm(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_bf16(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_i8mm(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_sve(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_sve2(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_svebf16(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_svei8mm(); |
| | |
| | NCNN_EXPORT int cpu_support_arm_svef32mm(); |
| |
|
| | |
| | NCNN_EXPORT int cpu_support_x86_avx(); |
| | |
| | NCNN_EXPORT int cpu_support_x86_fma(); |
| | |
| | NCNN_EXPORT int cpu_support_x86_xop(); |
| | |
| | NCNN_EXPORT int cpu_support_x86_f16c(); |
| | |
| | NCNN_EXPORT int cpu_support_x86_avx2(); |
| | |
| | NCNN_EXPORT int cpu_support_x86_avx_vnni(); |
| | |
| | NCNN_EXPORT int cpu_support_x86_avx512(); |
| | |
| | NCNN_EXPORT int cpu_support_x86_avx512_vnni(); |
| | |
| | NCNN_EXPORT int cpu_support_x86_avx512_bf16(); |
| | |
| | NCNN_EXPORT int cpu_support_x86_avx512_fp16(); |
| |
|
| | |
| | NCNN_EXPORT int cpu_support_loongarch_lsx(); |
| | |
| | NCNN_EXPORT int cpu_support_loongarch_lasx(); |
| |
|
| | |
| | NCNN_EXPORT int cpu_support_mips_msa(); |
| | |
| | NCNN_EXPORT int cpu_support_loongson_mmi(); |
| |
|
| | |
| | NCNN_EXPORT int cpu_support_riscv_v(); |
| | |
| | NCNN_EXPORT int cpu_support_riscv_zfh(); |
| | |
| | NCNN_EXPORT int cpu_riscv_vlenb(); |
| |
|
| | |
| | NCNN_EXPORT int get_cpu_count(); |
| | NCNN_EXPORT int get_little_cpu_count(); |
| | NCNN_EXPORT int get_big_cpu_count(); |
| |
|
| | NCNN_EXPORT int get_physical_cpu_count(); |
| | NCNN_EXPORT int get_physical_little_cpu_count(); |
| | NCNN_EXPORT int get_physical_big_cpu_count(); |
| |
|
| | |
| | NCNN_EXPORT int get_cpu_level2_cache_size(); |
| | NCNN_EXPORT int get_cpu_level3_cache_size(); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | NCNN_EXPORT int get_cpu_powersave(); |
| | NCNN_EXPORT int set_cpu_powersave(int powersave); |
| |
|
| | |
| | NCNN_EXPORT const CpuSet& get_cpu_thread_affinity_mask(int powersave); |
| |
|
| | |
| | NCNN_EXPORT int set_cpu_thread_affinity(const CpuSet& thread_affinity_mask); |
| |
|
| | |
| | NCNN_EXPORT int is_current_thread_running_on_a53_a55(); |
| |
|
| | |
| | NCNN_EXPORT int get_omp_num_threads(); |
| | NCNN_EXPORT void set_omp_num_threads(int num_threads); |
| |
|
| | NCNN_EXPORT int get_omp_dynamic(); |
| | NCNN_EXPORT void set_omp_dynamic(int dynamic); |
| |
|
| | NCNN_EXPORT int get_omp_thread_num(); |
| |
|
| | NCNN_EXPORT int get_kmp_blocktime(); |
| | NCNN_EXPORT void set_kmp_blocktime(int time_ms); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | NCNN_EXPORT int get_flush_denormals(); |
| | NCNN_EXPORT int set_flush_denormals(int flush_denormals); |
| |
|
| | } |
| |
|
| | #endif |
| |
|