1 /* 2 * Developed by Claudio André <claudioandre.br at gmail.com> in 2012 3 * 4 * Copyright (c) 2012-2015 Claudio André <claudioandre.br at gmail.com> 5 * This program comes with ABSOLUTELY NO WARRANTY; express or implied. 6 * 7 * This is free software, and you are welcome to redistribute it 8 * under certain conditions; as expressed here 9 * http://www.gnu.org/licenses/gpl-2.0.html 10 */ 11 12 #ifndef OPENCL_DEVICE_INFO_H 13 #define OPENCL_DEVICE_INFO_H 14 15 //Copied from opencl_common.h 16 #define DEV_UNKNOWN 0 //0 17 #define DEV_CPU (1 << 0) //1 18 #define DEV_GPU (1 << 1) //2 19 #define DEV_ACCELERATOR (1 << 2) //4 20 #define DEV_AMD (1 << 3) //8 21 #define DEV_NVIDIA (1 << 4) //16 22 #define DEV_INTEL (1 << 5) //32 23 #define PLATFORM_APPLE (1 << 6) //64 24 #define DEV_AMD_GCN_10 (1 << 7) //128 25 #define DEV_AMD_GCN_11 (1 << 8) //256 26 #define DEV_AMD_GCN_12 (1 << 9) //512 27 #define DEV_AMD_VLIW4 (1 << 12) //4096 28 #define DEV_AMD_VLIW5 (1 << 13) //8192 29 #define DEV_NV_C2X (1 << 14) //16384 30 #define DEV_NV_C30 (1 << 15) //32768 31 #define DEV_NV_C32 (1 << 16) //65536 32 #define DEV_NV_C35 (1 << 17) //131072 33 #define DEV_NV_MAXWELL (1 << 18) //262144 34 #define DEV_NV_PASCAL (1 << 19) //524288 35 #define DEV_NV_VOLTA (1 << 20) //1M 36 #define DEV_USE_LOCAL (1 << 21) //2M 37 #define DEV_NO_BYTE_ADDRESSABLE (1 << 22) //4M 38 #define PLATFORM_MESA (1 << 23) //8M 39 #define PLATFORM_BEIGNET (1 << 24) //16M 40 #define PLATFORM_POCL (1 << 25) //32M 41 42 #define cpu(n) ((n & DEV_CPU) == (DEV_CPU)) 43 #define gpu(n) ((n & DEV_GPU) == (DEV_GPU)) 44 #define gpu_amd(n) ((n & DEV_AMD) && gpu(n)) 45 #define gpu_nvidia(n) ((n & DEV_NVIDIA) && gpu(n)) 46 #define gpu_intel(n) ((n & DEV_INTEL) && gpu(n)) 47 #define cpu_amd(n) ((n & DEV_AMD) && cpu(n)) 48 #define cpu_intel(n) ((n & DEV_INTEL) && cpu(n)) 49 #define amd_gcn_10(n) ((n & DEV_AMD_GCN_10) && gpu_amd(n)) 50 #define amd_gcn_11(n) ((n & DEV_AMD_GCN_11) && gpu_amd(n)) 51 #define amd_gcn_12(n) ((n & DEV_AMD_GCN_12) && gpu_amd(n)) 52 #define amd_gcn(n) (amd_gcn_10(n) || (amd_gcn_11(n)) || amd_gcn_12(n)) 53 #define amd_vliw4(n) ((n & DEV_AMD_VLIW4) && gpu_amd(n)) 54 #define amd_vliw5(n) ((n & DEV_AMD_VLIW5) && gpu_amd(n)) 55 #define nvidia_sm_2x(n) ((n & DEV_NV_C2X) && gpu_nvidia(n)) 56 #define nvidia_sm_3x(n) (((n & DEV_NV_C30) || (n & DEV_NV_C32) || (n & DEV_NV_C35)) && gpu_nvidia(n)) 57 #define nvidia_sm_5x(n) ((n & DEV_NV_MAXWELL) && gpu_nvidia(n)) 58 #define nvidia_sm_6x(n) ((n & DEV_NV_PASCAL) && gpu_nvidia(n)) 59 #define no_byte_addressable(n) ((n & DEV_NO_BYTE_ADDRESSABLE)) 60 #define use_local(n) ((n & DEV_USE_LOCAL)) 61 62 /* Only usable in host code */ 63 #if !_OPENCL_COMPILER 64 #define platform_apple(p) (get_platform_vendor_id(p) == PLATFORM_APPLE) 65 #endif 66 67 #endif /* OPENCL_DEVICE_INFO_H */ 68