String name() const;
String extensions() const;
+ bool isExtensionSupported(const String& extensionName) const;
String version() const;
String vendorName() const;
String OpenCL_C_Version() const;
uint imagePitchAlignment() const;
uint imageBaseAddressAlignment() const;
+ /// deprecated, use isExtensionSupported() method (probably with "cl_khr_subgroups" value)
bool intelSubgroupsSupport() const;
size_t image2DMaxWidth() const;
#include <list>
#include <map>
#include <deque>
+#include <set>
#include <string>
#include <sstream>
#include <iostream> // std::cerr
name_ = getStrProp(CL_DEVICE_NAME);
version_ = getStrProp(CL_DEVICE_VERSION);
+ extensions_ = getStrProp(CL_DEVICE_EXTENSIONS);
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);
String deviceVersion_ = getStrProp(CL_DEVICE_VERSION);
parseDeviceVersion(deviceVersion_, deviceVersionMajor_, deviceVersionMinor_);
+ size_t pos = 0;
+ while (pos < extensions_.size())
+ {
+ size_t pos2 = extensions_.find(' ', pos);
+ if (pos2 == String::npos)
+ pos2 = extensions_.size();
+ if (pos2 > pos)
+ {
+ std::string extensionName = extensions_.substr(pos, pos2 - pos);
+ extensions_set_.insert(extensionName);
+ }
+ pos = pos2 + 1;
+ }
+
intelSubgroupsSupport_ = isExtensionSupported("cl_intel_subgroups");
vendorName_ = getStrProp(CL_DEVICE_VENDOR);
sz < sizeof(buf) ? String(buf) : String();
}
- bool isExtensionSupported(const String& extensionName) const
+ bool isExtensionSupported(const std::string& extensionName) const
{
- bool ret = false;
- size_t pos = getStrProp(CL_DEVICE_EXTENSIONS).find(extensionName);
- if (pos != String::npos)
- {
- ret = true;
- }
- return ret;
+ return extensions_set_.count(extensionName) > 0;
}
IMPLEMENT_REFCOUNTABLE();
+
cl_device_id handle;
String name_;
String version_;
+ std::string extensions_;
int doubleFPConfig_;
bool hostUnifiedMemory_;
int maxComputeUnits_;
String vendorName_;
int vendorID_;
bool intelSubgroupsSupport_;
+
+ std::set<std::string> extensions_set_;
};
{ return p ? p->name_ : String(); }
String Device::extensions() const
-{ return p ? p->getStrProp(CL_DEVICE_EXTENSIONS) : String(); }
+{ return p ? String(p->extensions_) : String(); }
+
+bool Device::isExtensionSupported(const String& extensionName) const
+{ return p ? p->isExtensionSupported(extensionName) : false; }
String Device::version() const
{ return p ? p->version_ : String(); }
bool Device::imageFromBufferSupport() const
{
- bool ret = false;
- if (p)
- {
- size_t pos = p->getStrProp(CL_DEVICE_EXTENSIONS).find("cl_khr_image2d_from_buffer");
- if (pos != String::npos)
- {
- ret = true;
- }
- }
- return ret;
+ return p ? p->isExtensionSupported("cl_khr_image2d_from_buffer") : false;
}
uint Device::imagePitchAlignment() const