Lines Matching refs:device
380 device; in SelectOpenCLDevice() local
391 device=clEnv->devices[i]; in SelectOpenCLDevice()
392 if (device->type != type) in SelectOpenCLDevice()
395 device->enabled=MagickTrue; in SelectOpenCLDevice()
402 if (IsSameOpenCLDevice(device,other_device)) in SelectOpenCLDevice()
459 ReleaseOpenCLDevice(info->device); in DestroyMagickCLCacheInfo()
467 MagickPrivate cl_mem CreateOpenCLBuffer(MagickCLDevice device, in CreateOpenCLBuffer() argument
470 return(openCL_library->clCreateBuffer(device->context,flags,size,host_ptr, in CreateOpenCLBuffer()
524 MagickPrivate MagickCLCacheInfo AcquireMagickCLCacheInfo(MagickCLDevice device, in AcquireMagickCLCacheInfo() argument
536 device->requested++; in AcquireMagickCLCacheInfo()
538 info->device=device; in AcquireMagickCLCacheInfo()
542 info->buffer=openCL_library->clCreateBuffer(device->context, in AcquireMagickCLCacheInfo()
573 device; in AcquireMagickCLDevice() local
575 device=(MagickCLDevice) AcquireMagickMemory(sizeof(*device)); in AcquireMagickCLDevice()
576 if (device != NULL) in AcquireMagickCLDevice()
578 (void) memset(device,0,sizeof(*device)); in AcquireMagickCLDevice()
579 ActivateSemaphoreInfo(&device->lock); in AcquireMagickCLDevice()
580 device->score=MAGICKCORE_OPENCL_UNDEFINED_SCORE; in AcquireMagickCLDevice()
581 device->command_queues_index=-1; in AcquireMagickCLDevice()
582 device->enabled=MagickTrue; in AcquireMagickCLDevice()
584 return(device); in AcquireMagickCLDevice()
647 MagickPrivate cl_command_queue AcquireOpenCLCommandQueue(MagickCLDevice device) in AcquireOpenCLCommandQueue() argument
655 assert(device != (MagickCLDevice) NULL); in AcquireOpenCLCommandQueue()
656 LockSemaphoreInfo(device->lock); in AcquireOpenCLCommandQueue()
657 if ((device->profile_kernels == MagickFalse) && in AcquireOpenCLCommandQueue()
658 (device->command_queues_index >= 0)) in AcquireOpenCLCommandQueue()
660 queue=device->command_queues[device->command_queues_index--]; in AcquireOpenCLCommandQueue()
661 UnlockSemaphoreInfo(device->lock); in AcquireOpenCLCommandQueue()
665 UnlockSemaphoreInfo(device->lock); in AcquireOpenCLCommandQueue()
667 if (device->profile_kernels != MagickFalse) in AcquireOpenCLCommandQueue()
669 queue=openCL_library->clCreateCommandQueue(device->context, in AcquireOpenCLCommandQueue()
670 device->deviceID,properties,(cl_int *) NULL); in AcquireOpenCLCommandQueue()
703 MagickPrivate cl_kernel AcquireOpenCLKernel(MagickCLDevice device, in AcquireOpenCLKernel() argument
709 assert(device != (MagickCLDevice) NULL); in AcquireOpenCLKernel()
710 kernel=openCL_library->clCreateKernel(device->program,kernel_name, in AcquireOpenCLKernel()
813 device; in LoadOpenCLDeviceBenchmark() local
820 device=clEnv->devices[i]; in LoadOpenCLDeviceBenchmark()
821 if (IsBenchmarkedOpenCLDevice(device,device_benchmark)) in LoadOpenCLDeviceBenchmark()
822 device->score=device_benchmark->score; in LoadOpenCLDeviceBenchmark()
1105 MagickCLDevice device) in RunDeviceBenckmark() argument
1107 testEnv->devices[0]=device; in RunDeviceBenckmark()
1109 device->score=RunOpenCLBenchmark(MagickFalse); in RunDeviceBenckmark()
1123 device; in CacheOpenCLBenchmarks() local
1144 device=clEnv->devices[i]; in CacheOpenCLBenchmarks()
1148 if (IsSameOpenCLDevice(clEnv->devices[j],device)) in CacheOpenCLBenchmarks()
1158 if (device->score != MAGICKCORE_OPENCL_UNDEFINED_SCORE) in CacheOpenCLBenchmarks()
1162 device->platform_name,device->vendor_name,device->name,device->version, in CacheOpenCLBenchmarks()
1163 (int)device->max_clock_frequency,(int)device->max_compute_units, in CacheOpenCLBenchmarks()
1164 device->score); in CacheOpenCLBenchmarks()
1174 device; in BenchmarkOpenCLDevices() local
1196 device=clEnv->devices[i]; in BenchmarkOpenCLDevices()
1197 if (device->score == MAGICKCORE_OPENCL_UNDEFINED_SCORE) in BenchmarkOpenCLDevices()
1198 RunDeviceBenckmark(clEnv,testEnv,device); in BenchmarkOpenCLDevices()
1207 if (IsSameOpenCLDevice(device,other_device)) in BenchmarkOpenCLDevices()
1208 other_device->score=device->score; in BenchmarkOpenCLDevices()
1255 static void CacheOpenCLKernel(MagickCLDevice device,char *filename, in CacheOpenCLKernel() argument
1267 status=openCL_library->clGetProgramInfo(device->program, in CacheOpenCLKernel()
1278 status=openCL_library->clGetProgramInfo(device->program, in CacheOpenCLKernel()
1285 static MagickBooleanType LoadCachedOpenCLKernel(MagickCLDevice device, in LoadCachedOpenCLKernel() argument
1307 device->program=openCL_library->clCreateProgramWithBinary(device->context,1, in LoadCachedOpenCLKernel()
1308 &device->deviceID,&length,(const unsigned char**)&binaryProgram, in LoadCachedOpenCLKernel()
1315 static void LogOpenCLBuildFailure(MagickCLDevice device,const char *kernel, in LogOpenCLBuildFailure() argument
1331 openCL_library->clGetProgramBuildInfo(device->program,device->deviceID, in LogOpenCLBuildFailure()
1334 openCL_library->clGetProgramBuildInfo(device->program,device->deviceID, in LogOpenCLBuildFailure()
1345 static MagickBooleanType CompileOpenCLKernel(MagickCLDevice device, in CompileOpenCLKernel() argument
1363 (void) CopyMagickString(deviceName,device->name,MagickPathExtent); in CompileOpenCLKernel()
1378 loaded=LoadCachedOpenCLKernel(device,filename); in CompileOpenCLKernel()
1383 device->program=openCL_library->clCreateProgramWithSource( in CompileOpenCLKernel()
1384 device->context,1,&kernel,&length,&status); in CompileOpenCLKernel()
1389 status=openCL_library->clBuildProgram(device->program,1,&device->deviceID, in CompileOpenCLKernel()
1395 LogOpenCLBuildFailure(device,kernel,exception); in CompileOpenCLKernel()
1401 CacheOpenCLKernel(device,filename,exception); in CompileOpenCLKernel()
1491 queue=AcquireOpenCLCommandQueue(info->device); in CopyMagickCLCacheInfo()
1496 ReleaseOpenCLCommandQueue(info->device,queue); in CopyMagickCLCacheInfo()
1560 device; in DumpOpenCLProfileData() local
1562 device=clEnv->devices[i]; in DumpOpenCLProfileData()
1563 if ((device->profile_kernels == MagickFalse) || in DumpOpenCLProfileData()
1564 (device->profile_records == (KernelProfileRecord *) NULL)) in DumpOpenCLProfileData()
1568 fprintf(log,"Device: %s\n",device->name); in DumpOpenCLProfileData()
1569 fprintf(log,"Version: %s\n",device->version); in DumpOpenCLProfileData()
1574 while (device->profile_records[j] != (KernelProfileRecord) NULL) in DumpOpenCLProfileData()
1579 profile=device->profile_records[j]; in DumpOpenCLProfileData()
1715 (void) OpenCLThrowMagickException(input_info->opencl->device,exception, in EnqueueOpenCLKernel()
1722 if (RecordProfileData(input_info->opencl->device,kernel,event) == MagickFalse) in EnqueueOpenCLKernel()
1803 const MagickCLDevice device) in GetOpenCLDeviceBenchmarkScore() argument
1805 if (device == (MagickCLDevice) NULL) in GetOpenCLDeviceBenchmarkScore()
1807 return(device->score); in GetOpenCLDeviceBenchmarkScore()
1833 const MagickCLDevice device) in GetOpenCLDeviceEnabled() argument
1835 if (device == (MagickCLDevice) NULL) in GetOpenCLDeviceEnabled()
1837 return(device->enabled); in GetOpenCLDeviceEnabled()
1862 MagickExport const char *GetOpenCLDeviceName(const MagickCLDevice device) in GetOpenCLDeviceName() argument
1864 if (device == (MagickCLDevice) NULL) in GetOpenCLDeviceName()
1866 return(device->name); in GetOpenCLDeviceName()
1891 MagickExport const char *GetOpenCLDeviceVendorName(const MagickCLDevice device) in GetOpenCLDeviceVendorName() argument
1893 if (device == (MagickCLDevice) NULL) in GetOpenCLDeviceVendorName()
1895 return(device->vendor_name); in GetOpenCLDeviceVendorName()
1967 const MagickCLDevice device) in GetOpenCLDeviceType() argument
1969 if (device == (MagickCLDevice) NULL) in GetOpenCLDeviceType()
1971 if (device->type == CL_DEVICE_TYPE_GPU) in GetOpenCLDeviceType()
1973 if (device->type == CL_DEVICE_TYPE_CPU) in GetOpenCLDeviceType()
2000 MagickExport const char *GetOpenCLDeviceVersion(const MagickCLDevice device) in GetOpenCLDeviceVersion() argument
2002 if (device == (MagickCLDevice) NULL) in GetOpenCLDeviceVersion()
2004 return(device->version); in GetOpenCLDeviceVersion()
2061 const MagickCLDevice device,size_t *length) in GetOpenCLKernelProfileRecords() argument
2063 if ((device == (const MagickCLDevice) NULL) || (device->profile_records == in GetOpenCLKernelProfileRecords()
2073 LockSemaphoreInfo(device->lock); in GetOpenCLKernelProfileRecords()
2074 while (device->profile_records[*length] != (KernelProfileRecord) NULL) in GetOpenCLKernelProfileRecords()
2076 UnlockSemaphoreInfo(device->lock); in GetOpenCLKernelProfileRecords()
2078 return(device->profile_records); in GetOpenCLKernelProfileRecords()
2166 device; in HasOpenCLDevices() local
2171 device=clEnv->devices[i]; in HasOpenCLDevices()
2172 if ((device->enabled == MagickFalse) || in HasOpenCLDevices()
2173 (device->program != (cl_program) NULL)) in HasOpenCLDevices()
2176 LockSemaphoreInfo(device->lock); in HasOpenCLDevices()
2177 if (device->program != (cl_program) NULL) in HasOpenCLDevices()
2179 UnlockSemaphoreInfo(device->lock); in HasOpenCLDevices()
2183 device_signature^=StringSignature(device->platform_name); in HasOpenCLDevices()
2184 status=CompileOpenCLKernel(device,accelerateKernelsBuffer,options, in HasOpenCLDevices()
2186 UnlockSemaphoreInfo(device->lock); in HasOpenCLDevices()
2338 device; in LoadOpenCLDevices() local
2340 device=AcquireMagickCLDevice(); in LoadOpenCLDevices()
2341 if (device == (MagickCLDevice) NULL) in LoadOpenCLDevices()
2344 device->context=clEnv->contexts[i]; in LoadOpenCLDevices()
2345 device->deviceID=devices[j]; in LoadOpenCLDevices()
2349 device->platform_name=AcquireCriticalMemory(length* in LoadOpenCLDevices()
2350 sizeof(*device->platform_name)); in LoadOpenCLDevices()
2352 device->platform_name,NULL); in LoadOpenCLDevices()
2356 device->vendor_name=AcquireCriticalMemory(length* in LoadOpenCLDevices()
2357 sizeof(*device->vendor_name)); in LoadOpenCLDevices()
2359 device->vendor_name,NULL); in LoadOpenCLDevices()
2363 device->name=AcquireCriticalMemory(length*sizeof(*device->name)); in LoadOpenCLDevices()
2365 device->name,NULL); in LoadOpenCLDevices()
2369 device->version=AcquireCriticalMemory(length*sizeof(*device->version)); in LoadOpenCLDevices()
2371 device->version,NULL); in LoadOpenCLDevices()
2374 sizeof(cl_uint),&device->max_clock_frequency,NULL); in LoadOpenCLDevices()
2377 sizeof(cl_uint),&device->max_compute_units,NULL); in LoadOpenCLDevices()
2380 sizeof(cl_device_type),&device->type,NULL); in LoadOpenCLDevices()
2383 sizeof(cl_ulong),&device->local_memory_size,NULL); in LoadOpenCLDevices()
2385 clEnv->devices[next]=device; in LoadOpenCLDevices()
2612 MagickCLDevice device,ExceptionInfo *exception,const char *module, in OpenCLThrowMagickException() argument
2619 assert(device != (MagickCLDevice) NULL); in OpenCLThrowMagickException()
2626 if (device->type == CL_DEVICE_TYPE_CPU) in OpenCLThrowMagickException()
2630 if (strncmp(device->platform_name, "Intel",5) == 0) in OpenCLThrowMagickException()
2681 MagickPrivate MagickBooleanType RecordProfileData(MagickCLDevice device, in RecordProfileData() argument
2702 if (device->profile_kernels == MagickFalse) in RecordProfileData()
2729 LockSemaphoreInfo(device->lock); in RecordProfileData()
2732 if (device->profile_records != (KernelProfileRecord *) NULL) in RecordProfileData()
2734 while (device->profile_records[i] != (KernelProfileRecord) NULL) in RecordProfileData()
2736 if (LocaleCompare(device->profile_records[i]->kernel_name,name) == 0) in RecordProfileData()
2738 profile_record=device->profile_records[i]; in RecordProfileData()
2751 device->profile_records=ResizeMagickMemory(device->profile_records,(i+2)* in RecordProfileData()
2752 sizeof(*device->profile_records)); in RecordProfileData()
2753 if (device->profile_records == (KernelProfileRecord *) NULL) in RecordProfileData()
2755 device->profile_records[i]=profile_record; in RecordProfileData()
2756 device->profile_records[i+1]=(KernelProfileRecord) NULL; in RecordProfileData()
2764 UnlockSemaphoreInfo(device->lock); in RecordProfileData()
2793 MagickPrivate void ReleaseOpenCLCommandQueue(MagickCLDevice device, in ReleaseOpenCLCommandQueue() argument
2799 assert(device != (MagickCLDevice) NULL); in ReleaseOpenCLCommandQueue()
2800 LockSemaphoreInfo(device->lock); in ReleaseOpenCLCommandQueue()
2801 if ((device->profile_kernels != MagickFalse) || in ReleaseOpenCLCommandQueue()
2802 (device->command_queues_index >= MAGICKCORE_OPENCL_COMMAND_QUEUES-1)) in ReleaseOpenCLCommandQueue()
2804 UnlockSemaphoreInfo(device->lock); in ReleaseOpenCLCommandQueue()
2811 device->command_queues[++device->command_queues_index]=queue; in ReleaseOpenCLCommandQueue()
2812 UnlockSemaphoreInfo(device->lock); in ReleaseOpenCLCommandQueue()
2839 MagickPrivate void ReleaseOpenCLDevice(MagickCLDevice device) in ReleaseOpenCLDevice() argument
2841 assert(device != (MagickCLDevice) NULL); in ReleaseOpenCLDevice()
2843 device->requested--; in ReleaseOpenCLDevice()
2949 static MagickCLDevice RelinquishMagickCLDevice(MagickCLDevice device) in RelinquishMagickCLDevice() argument
2951 if (device == (MagickCLDevice) NULL) in RelinquishMagickCLDevice()
2954 device->platform_name=RelinquishMagickMemory(device->platform_name); in RelinquishMagickCLDevice()
2955 device->vendor_name=RelinquishMagickMemory(device->vendor_name); in RelinquishMagickCLDevice()
2956 device->name=RelinquishMagickMemory(device->name); in RelinquishMagickCLDevice()
2957 device->version=RelinquishMagickMemory(device->version); in RelinquishMagickCLDevice()
2958 if (device->program != (cl_program) NULL) in RelinquishMagickCLDevice()
2959 (void) openCL_library->clReleaseProgram(device->program); in RelinquishMagickCLDevice()
2960 while (device->command_queues_index >= 0) in RelinquishMagickCLDevice()
2962 device->command_queues[device->command_queues_index--]); in RelinquishMagickCLDevice()
2963 RelinquishSemaphoreInfo(&device->lock); in RelinquishMagickCLDevice()
2964 return((MagickCLDevice) RelinquishMagickMemory(device)); in RelinquishMagickCLDevice()
3035 device; in RequestOpenCLDevice() local
3055 device=(MagickCLDevice) NULL; in RequestOpenCLDevice()
3065 if ((device == (MagickCLDevice) NULL) || (score < best_score)) in RequestOpenCLDevice()
3067 device=clEnv->devices[i]; in RequestOpenCLDevice()
3071 if (device != (MagickCLDevice)NULL) in RequestOpenCLDevice()
3072 device->requested++; in RequestOpenCLDevice()
3075 return(device); in RequestOpenCLDevice()
3103 MagickExport void SetOpenCLDeviceEnabled(MagickCLDevice device, in SetOpenCLDeviceEnabled() argument
3106 if (device == (MagickCLDevice) NULL) in SetOpenCLDeviceEnabled()
3108 device->enabled=value; in SetOpenCLDeviceEnabled()
3138 MagickExport void SetOpenCLKernelProfileEnabled(MagickCLDevice device, in SetOpenCLKernelProfileEnabled() argument
3141 if (device == (MagickCLDevice) NULL) in SetOpenCLKernelProfileEnabled()
3143 device->profile_kernels=value; in SetOpenCLKernelProfileEnabled()
3183 const MagickCLDevice magick_unused(device)) in GetOpenCLDeviceBenchmarkScore() argument
3185 magick_unreferenced(device); in GetOpenCLDeviceBenchmarkScore()
3190 const MagickCLDevice magick_unused(device)) in GetOpenCLDeviceEnabled() argument
3192 magick_unreferenced(device); in GetOpenCLDeviceEnabled()
3197 const MagickCLDevice magick_unused(device)) in GetOpenCLDeviceName() argument
3199 magick_unreferenced(device); in GetOpenCLDeviceName()
3213 const MagickCLDevice magick_unused(device)) in GetOpenCLDeviceType() argument
3215 magick_unreferenced(device); in GetOpenCLDeviceType()
3220 const MagickCLDevice magick_unused(device),size_t *length) in GetOpenCLKernelProfileRecords() argument
3222 magick_unreferenced(device); in GetOpenCLKernelProfileRecords()
3229 const MagickCLDevice magick_unused(device)) in GetOpenCLDeviceVersion() argument
3231 magick_unreferenced(device); in GetOpenCLDeviceVersion()
3241 MagickCLDevice magick_unused(device), in SetOpenCLDeviceEnabled() argument
3244 magick_unreferenced(device); in SetOpenCLDeviceEnabled()
3256 MagickCLDevice magick_unused(device), in SetOpenCLKernelProfileEnabled() argument
3259 magick_unreferenced(device); in SetOpenCLKernelProfileEnabled()