Merge pull request #2441 from akarsakov:ocl_platform_vendor
This commit is contained in:
commit
182d74d33f
@ -87,7 +87,7 @@ public:
|
|||||||
String name() const;
|
String name() const;
|
||||||
String extensions() const;
|
String extensions() const;
|
||||||
String version() const;
|
String version() const;
|
||||||
String vendor() const;
|
String vendorName() const;
|
||||||
String OpenCL_C_Version() const;
|
String OpenCL_C_Version() const;
|
||||||
String OpenCLVersion() const;
|
String OpenCLVersion() const;
|
||||||
int deviceVersionMajor() const;
|
int deviceVersionMajor() const;
|
||||||
@ -161,6 +161,17 @@ public:
|
|||||||
size_t imageMaxBufferSize() const;
|
size_t imageMaxBufferSize() const;
|
||||||
size_t imageMaxArraySize() const;
|
size_t imageMaxArraySize() const;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
UNKNOWN_VENDOR=0,
|
||||||
|
VENDOR_AMD=1,
|
||||||
|
VENDOR_INTEL=2,
|
||||||
|
VENDOR_NVIDIA=3
|
||||||
|
};
|
||||||
|
int vendorID() const;
|
||||||
|
inline bool isAMD() const { return vendorID() == VENDOR_AMD; };
|
||||||
|
inline bool isIntel() const { return vendorID() == VENDOR_INTEL; };
|
||||||
|
|
||||||
int maxClockFrequency() const;
|
int maxClockFrequency() const;
|
||||||
int maxComputeUnits() const;
|
int maxComputeUnits() const;
|
||||||
int maxConstantArgs() const;
|
int maxConstantArgs() const;
|
||||||
|
@ -1712,6 +1712,17 @@ struct Device::Impl
|
|||||||
|
|
||||||
String deviceVersion_ = getStrProp(CL_DEVICE_VERSION);
|
String deviceVersion_ = getStrProp(CL_DEVICE_VERSION);
|
||||||
parseDeviceVersion(deviceVersion_, deviceVersionMajor_, deviceVersionMinor_);
|
parseDeviceVersion(deviceVersion_, deviceVersionMajor_, deviceVersionMinor_);
|
||||||
|
|
||||||
|
vendorName_ = getStrProp(CL_DEVICE_VENDOR);
|
||||||
|
if (vendorName_ == "Advanced Micro Devices, Inc." ||
|
||||||
|
vendorName_ == "AMD")
|
||||||
|
vendorID_ = VENDOR_AMD;
|
||||||
|
else if (vendorName_ == "Intel(R) Corporation")
|
||||||
|
vendorID_ = VENDOR_INTEL;
|
||||||
|
else if (vendorName_ == "NVIDIA Corporation")
|
||||||
|
vendorID_ = VENDOR_NVIDIA;
|
||||||
|
else
|
||||||
|
vendorID_ = UNKNOWN_VENDOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _TpCL, typename _TpOut>
|
template<typename _TpCL, typename _TpOut>
|
||||||
@ -1754,6 +1765,8 @@ struct Device::Impl
|
|||||||
int deviceVersionMajor_;
|
int deviceVersionMajor_;
|
||||||
int deviceVersionMinor_;
|
int deviceVersionMinor_;
|
||||||
String driverVersion_;
|
String driverVersion_;
|
||||||
|
String vendorName_;
|
||||||
|
int vendorID_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1813,8 +1826,11 @@ String Device::extensions() const
|
|||||||
String Device::version() const
|
String Device::version() const
|
||||||
{ return p ? p->version_ : String(); }
|
{ return p ? p->version_ : String(); }
|
||||||
|
|
||||||
String Device::vendor() const
|
String Device::vendorName() const
|
||||||
{ return p ? p->getStrProp(CL_DEVICE_VENDOR) : String(); }
|
{ return p ? p->vendorName_ : String(); }
|
||||||
|
|
||||||
|
int Device::vendorID() const
|
||||||
|
{ return p ? p->vendorID_ : 0; }
|
||||||
|
|
||||||
String Device::OpenCL_C_Version() const
|
String Device::OpenCL_C_Version() const
|
||||||
{ return p ? p->getStrProp(CL_DEVICE_OPENCL_C_VERSION) : String(); }
|
{ return p ? p->getStrProp(CL_DEVICE_OPENCL_C_VERSION) : String(); }
|
||||||
@ -3009,6 +3025,12 @@ struct Program::Impl
|
|||||||
for( i = 0; i < n; i++ )
|
for( i = 0; i < n; i++ )
|
||||||
deviceList[i] = ctx.device(i).ptr();
|
deviceList[i] = ctx.device(i).ptr();
|
||||||
|
|
||||||
|
Device device = Device::getDefault();
|
||||||
|
if (device.isAMD())
|
||||||
|
buildflags += " -D AMD_DEVICE";
|
||||||
|
else if (device.isIntel())
|
||||||
|
buildflags += " -D INTEL_DEVICE";
|
||||||
|
|
||||||
retval = clBuildProgram(handle, n,
|
retval = clBuildProgram(handle, n,
|
||||||
(const cl_device_id*)deviceList,
|
(const cl_device_id*)deviceList,
|
||||||
buildflags.c_str(), 0, 0);
|
buildflags.c_str(), 0, 0);
|
||||||
|
@ -583,9 +583,7 @@ bool HaarEvaluator::read(const FileNode& node, Size _origWinSize)
|
|||||||
localSize = lbufSize = Size(0, 0);
|
localSize = lbufSize = Size(0, 0);
|
||||||
if (ocl::haveOpenCL())
|
if (ocl::haveOpenCL())
|
||||||
{
|
{
|
||||||
String vname = ocl::Device::getDefault().vendor();
|
if (ocl::Device::getDefault().isAMD())
|
||||||
if (vname == "Advanced Micro Devices, Inc." ||
|
|
||||||
vname == "AMD")
|
|
||||||
{
|
{
|
||||||
localSize = Size(8, 8);
|
localSize = Size(8, 8);
|
||||||
lbufSize = Size(origWinSize.width + localSize.width,
|
lbufSize = Size(origWinSize.width + localSize.width,
|
||||||
@ -769,9 +767,7 @@ bool LBPEvaluator::read( const FileNode& node, Size _origWinSize )
|
|||||||
if (ocl::haveOpenCL())
|
if (ocl::haveOpenCL())
|
||||||
{
|
{
|
||||||
const ocl::Device& device = ocl::Device::getDefault();
|
const ocl::Device& device = ocl::Device::getDefault();
|
||||||
String vname = device.vendor();
|
if (device.isAMD() && !device.hostUnifiedMemory())
|
||||||
if ((vname == "Advanced Micro Devices, Inc." ||
|
|
||||||
vname == "AMD") && !device.hostUnifiedMemory())
|
|
||||||
localSize = Size(8, 8);
|
localSize = Size(8, 8);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user