From: Ilya Lavrenov Date: Fri, 31 Jan 2014 10:00:05 +0000 (+0400) Subject: cached commonly used device properties X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~3513^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50cf152977041c5705de25d7787aa0a553040beb;p=platform%2Fupstream%2Fopencv.git cached commonly used device properties --- diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 7201fca..9959b54 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -1626,6 +1626,16 @@ struct Device::Impl { handle = (cl_device_id)d; refcount = 1; + + name_ = getStrProp(CL_DEVICE_NAME); + version_ = getStrProp(CL_DEVICE_VERSION); + doubleFPConfig_ = getProp(CL_DEVICE_DOUBLE_FP_CONFIG); + hostUnifiedMemory_ = getBoolProp(CL_DEVICE_HOST_UNIFIED_MEMORY); + maxComputeUnits_ = getProp(CL_DEVICE_MAX_COMPUTE_UNITS); + maxWorkGroupSize_ = getProp(CL_DEVICE_MAX_WORK_GROUP_SIZE); + type_ = getProp(CL_DEVICE_TYPE); + deviceVersion_ = getStrProp(CL_DEVICE_VERSION); + driverVersion_ = getStrProp(CL_DRIVER_VERSION); } template @@ -1657,6 +1667,16 @@ struct Device::Impl IMPLEMENT_REFCOUNTABLE(); cl_device_id handle; + + String name_; + String version_; + int doubleFPConfig_; + bool hostUnifiedMemory_; + int maxComputeUnits_; + size_t maxWorkGroupSize_; + int type_; + String deviceVersion_; + String driverVersion_; }; @@ -1708,13 +1728,13 @@ void* Device::ptr() const } String Device::name() const -{ return p ? p->getStrProp(CL_DEVICE_NAME) : String(); } +{ return p ? p->name_ : String(); } String Device::extensions() const { return p ? p->getStrProp(CL_DEVICE_EXTENSIONS) : String(); } String Device::version() const -{ return p ? p->getStrProp(CL_DEVICE_VERSION) : String(); } +{ return p ? p->version_ : String(); } String Device::vendor() const { return p ? p->getStrProp(CL_DEVICE_VENDOR) : String(); } @@ -1726,13 +1746,13 @@ String Device::OpenCLVersion() const { return p ? p->getStrProp(CL_DEVICE_EXTENSIONS) : String(); } String Device::deviceVersion() const -{ return p ? p->getStrProp(CL_DEVICE_VERSION) : String(); } +{ return p ? p->deviceVersion_ : String(); } String Device::driverVersion() const -{ return p ? p->getStrProp(CL_DRIVER_VERSION) : String(); } +{ return p ? p->driverVersion_ : String(); } int Device::type() const -{ return p ? p->getProp(CL_DEVICE_TYPE) : 0; } +{ return p ? p->type_ : 0; } int Device::addressBits() const { return p ? p->getProp(CL_DEVICE_ADDRESS_BITS) : 0; } @@ -1751,7 +1771,7 @@ bool Device::linkerAvailable() const #endif int Device::doubleFPConfig() const -{ return p ? p->getProp(CL_DEVICE_DOUBLE_FP_CONFIG) : 0; } +{ return p ? p->doubleFPConfig_ : 0; } int Device::singleFPConfig() const { return p ? p->getProp(CL_DEVICE_SINGLE_FP_CONFIG) : 0; } @@ -1791,7 +1811,7 @@ int Device::localMemType() const { return p ? p->getProp(CL_DEVICE_LOCAL_MEM_TYPE) : 0; } bool Device::hostUnifiedMemory() const -{ return p ? p->getBoolProp(CL_DEVICE_HOST_UNIFIED_MEMORY) : false; } +{ return p ? p->hostUnifiedMemory_ : false; } bool Device::imageSupport() const { return p ? p->getBoolProp(CL_DEVICE_IMAGE_SUPPORT) : false; } @@ -1829,7 +1849,7 @@ int Device::maxClockFrequency() const { return p ? p->getProp(CL_DEVICE_MAX_CLOCK_FREQUENCY) : 0; } int Device::maxComputeUnits() const -{ return p ? p->getProp(CL_DEVICE_MAX_COMPUTE_UNITS) : 0; } +{ return p ? p->maxComputeUnits_ : 0; } int Device::maxConstantArgs() const { return p ? p->getProp(CL_DEVICE_MAX_CONSTANT_ARGS) : 0; } @@ -1853,7 +1873,7 @@ int Device::maxSamplers() const { return p ? p->getProp(CL_DEVICE_MAX_SAMPLERS) : 0; } size_t Device::maxWorkGroupSize() const -{ return p ? p->getProp(CL_DEVICE_MAX_WORK_GROUP_SIZE) : 0; } +{ return p ? p->maxWorkGroupSize_ : 0; } int Device::maxWorkItemDims() const { return p ? p->getProp(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS) : 0; }