cached commonly used device properties
This commit is contained in:
parent
9041c31813
commit
50cf152977
@ -1626,6 +1626,16 @@ struct Device::Impl
|
|||||||
{
|
{
|
||||||
handle = (cl_device_id)d;
|
handle = (cl_device_id)d;
|
||||||
refcount = 1;
|
refcount = 1;
|
||||||
|
|
||||||
|
name_ = getStrProp(CL_DEVICE_NAME);
|
||||||
|
version_ = getStrProp(CL_DEVICE_VERSION);
|
||||||
|
doubleFPConfig_ = getProp<cl_device_fp_config, int>(CL_DEVICE_DOUBLE_FP_CONFIG);
|
||||||
|
hostUnifiedMemory_ = getBoolProp(CL_DEVICE_HOST_UNIFIED_MEMORY);
|
||||||
|
maxComputeUnits_ = getProp<cl_uint, int>(CL_DEVICE_MAX_COMPUTE_UNITS);
|
||||||
|
maxWorkGroupSize_ = getProp<size_t, size_t>(CL_DEVICE_MAX_WORK_GROUP_SIZE);
|
||||||
|
type_ = getProp<cl_device_type, int>(CL_DEVICE_TYPE);
|
||||||
|
deviceVersion_ = getStrProp(CL_DEVICE_VERSION);
|
||||||
|
driverVersion_ = getStrProp(CL_DRIVER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _TpCL, typename _TpOut>
|
template<typename _TpCL, typename _TpOut>
|
||||||
@ -1657,6 +1667,16 @@ struct Device::Impl
|
|||||||
|
|
||||||
IMPLEMENT_REFCOUNTABLE();
|
IMPLEMENT_REFCOUNTABLE();
|
||||||
cl_device_id handle;
|
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
|
String Device::name() const
|
||||||
{ return p ? p->getStrProp(CL_DEVICE_NAME) : String(); }
|
{ return p ? p->name_ : String(); }
|
||||||
|
|
||||||
String Device::extensions() const
|
String Device::extensions() const
|
||||||
{ return p ? p->getStrProp(CL_DEVICE_EXTENSIONS) : String(); }
|
{ return p ? p->getStrProp(CL_DEVICE_EXTENSIONS) : String(); }
|
||||||
|
|
||||||
String Device::version() const
|
String Device::version() const
|
||||||
{ return p ? p->getStrProp(CL_DEVICE_VERSION) : String(); }
|
{ return p ? p->version_ : String(); }
|
||||||
|
|
||||||
String Device::vendor() const
|
String Device::vendor() const
|
||||||
{ return p ? p->getStrProp(CL_DEVICE_VENDOR) : String(); }
|
{ return p ? p->getStrProp(CL_DEVICE_VENDOR) : String(); }
|
||||||
@ -1726,13 +1746,13 @@ String Device::OpenCLVersion() const
|
|||||||
{ return p ? p->getStrProp(CL_DEVICE_EXTENSIONS) : String(); }
|
{ return p ? p->getStrProp(CL_DEVICE_EXTENSIONS) : String(); }
|
||||||
|
|
||||||
String Device::deviceVersion() const
|
String Device::deviceVersion() const
|
||||||
{ return p ? p->getStrProp(CL_DEVICE_VERSION) : String(); }
|
{ return p ? p->deviceVersion_ : String(); }
|
||||||
|
|
||||||
String Device::driverVersion() const
|
String Device::driverVersion() const
|
||||||
{ return p ? p->getStrProp(CL_DRIVER_VERSION) : String(); }
|
{ return p ? p->driverVersion_ : String(); }
|
||||||
|
|
||||||
int Device::type() const
|
int Device::type() const
|
||||||
{ return p ? p->getProp<cl_device_type, int>(CL_DEVICE_TYPE) : 0; }
|
{ return p ? p->type_ : 0; }
|
||||||
|
|
||||||
int Device::addressBits() const
|
int Device::addressBits() const
|
||||||
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_ADDRESS_BITS) : 0; }
|
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_ADDRESS_BITS) : 0; }
|
||||||
@ -1751,7 +1771,7 @@ bool Device::linkerAvailable() const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int Device::doubleFPConfig() const
|
int Device::doubleFPConfig() const
|
||||||
{ return p ? p->getProp<cl_device_fp_config, int>(CL_DEVICE_DOUBLE_FP_CONFIG) : 0; }
|
{ return p ? p->doubleFPConfig_ : 0; }
|
||||||
|
|
||||||
int Device::singleFPConfig() const
|
int Device::singleFPConfig() const
|
||||||
{ return p ? p->getProp<cl_device_fp_config, int>(CL_DEVICE_SINGLE_FP_CONFIG) : 0; }
|
{ return p ? p->getProp<cl_device_fp_config, int>(CL_DEVICE_SINGLE_FP_CONFIG) : 0; }
|
||||||
@ -1791,7 +1811,7 @@ int Device::localMemType() const
|
|||||||
{ return p ? p->getProp<cl_device_local_mem_type, int>(CL_DEVICE_LOCAL_MEM_TYPE) : 0; }
|
{ return p ? p->getProp<cl_device_local_mem_type, int>(CL_DEVICE_LOCAL_MEM_TYPE) : 0; }
|
||||||
|
|
||||||
bool Device::hostUnifiedMemory() const
|
bool Device::hostUnifiedMemory() const
|
||||||
{ return p ? p->getBoolProp(CL_DEVICE_HOST_UNIFIED_MEMORY) : false; }
|
{ return p ? p->hostUnifiedMemory_ : false; }
|
||||||
|
|
||||||
bool Device::imageSupport() const
|
bool Device::imageSupport() const
|
||||||
{ return p ? p->getBoolProp(CL_DEVICE_IMAGE_SUPPORT) : false; }
|
{ return p ? p->getBoolProp(CL_DEVICE_IMAGE_SUPPORT) : false; }
|
||||||
@ -1829,7 +1849,7 @@ int Device::maxClockFrequency() const
|
|||||||
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_MAX_CLOCK_FREQUENCY) : 0; }
|
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_MAX_CLOCK_FREQUENCY) : 0; }
|
||||||
|
|
||||||
int Device::maxComputeUnits() const
|
int Device::maxComputeUnits() const
|
||||||
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_MAX_COMPUTE_UNITS) : 0; }
|
{ return p ? p->maxComputeUnits_ : 0; }
|
||||||
|
|
||||||
int Device::maxConstantArgs() const
|
int Device::maxConstantArgs() const
|
||||||
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_MAX_CONSTANT_ARGS) : 0; }
|
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_MAX_CONSTANT_ARGS) : 0; }
|
||||||
@ -1853,7 +1873,7 @@ int Device::maxSamplers() const
|
|||||||
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_MAX_SAMPLERS) : 0; }
|
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_MAX_SAMPLERS) : 0; }
|
||||||
|
|
||||||
size_t Device::maxWorkGroupSize() const
|
size_t Device::maxWorkGroupSize() const
|
||||||
{ return p ? p->getProp<size_t, size_t>(CL_DEVICE_MAX_WORK_GROUP_SIZE) : 0; }
|
{ return p ? p->maxWorkGroupSize_ : 0; }
|
||||||
|
|
||||||
int Device::maxWorkItemDims() const
|
int Device::maxWorkItemDims() const
|
||||||
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS) : 0; }
|
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS) : 0; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user