C++: added access to CL's platform id via driver::Platform

This commit is contained in:
Philippe Tillet
2015-08-18 14:21:12 -07:00
parent 9b0eb09f2e
commit feda5a8c9c
4 changed files with 37 additions and 14 deletions

View File

@@ -26,6 +26,7 @@ public:
std::string name() const; std::string name() const;
std::string version() const; std::string version() const;
void devices(std::vector<Device> &) const; void devices(std::vector<Device> &) const;
cl_platform_id cl_id() const;
private: private:
backend_type backend_; backend_type backend_;
cl_platform_id cl_platform_; cl_platform_id cl_platform_;

View File

@@ -1,5 +1,7 @@
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
#include <cstring>
#include <memory>
#include "isaac/driver/device.h" #include "isaac/driver/device.h"
#include "helpers/ocl/infos.hpp" #include "helpers/ocl/infos.hpp"
@@ -60,12 +62,27 @@ Device::Vendor Device::vendor() const
return Vendor::UNKNOWN; return Vendor::UNKNOWN;
} }
Device::Architecture Device::architecture() const Device::Architecture Device::architecture() const
{ {
switch(vendor()) switch(vendor())
{ {
case Vendor::INTEL: case Vendor::INTEL:
{ {
// int64_t product;
// char* id = (char*)(platform().cl_id());
// for(unsigned int aa = 0 ; aa < 128 ; ++aa)
// {
// std::uintptr_t ptrid = (std::uintptr_t)id;
// if(aa && ptrid % aa)
// ptrid += aa - ptrid % aa;
// id = (char*)(ptrid);
// std::memcpy(&product, id, sizeof(product));
// std::cout << product << std::endl;
// }
return Architecture::BROADWELL; return Architecture::BROADWELL;
} }
default: default:

View File

@@ -47,6 +47,11 @@ std::string Platform::name() const
} }
} }
cl_platform_id Platform::cl_id() const
{
return cl_platform_;
}
void Platform::devices(std::vector<Device> & devices) const void Platform::devices(std::vector<Device> & devices) const
{ {
switch(backend_) switch(backend_)

View File

@@ -460,23 +460,23 @@ gemm_parameters::gemm_parameters(unsigned int simd_width
stream << "}" << std::endl; stream << "}" << std::endl;
// if(A_trans_=='N' || B_trans_=='T') if(A_trans_=='N' || B_trans_=='T')
// stream << "int Ky = K - idT.y;" << std::endl; stream << "int Ky = K - idT.y;" << std::endl;
// if(A_trans_=='T' || B_trans_=='N') if(A_trans_=='T' || B_trans_=='N')
// stream << "int Kx = K - idT.x;" << std::endl; stream << "int Kx = K - idT.x;" << std::endl;
// if(A_trans_=='N' || B_trans_=='T') if(A_trans_=='N' || B_trans_=='T')
// for(unsigned int k = 0; k < p_.kL; k += p_.local_fetch_1) for(unsigned int k = 0; k < p_.kL; k += p_.local_fetch_1)
// stream << "int condy" << k << " = " << k << " < Ky;" << std::endl; stream << "int condy" << k << " = " << k << " < Ky;" << std::endl;
// if(A_trans_=='T' || B_trans_=='N') if(A_trans_=='T' || B_trans_=='N')
// { {
// for(unsigned int k = 0 ; k < p_.kL ; k += p_.local_fetch_0*p_.simd_width) for(unsigned int k = 0 ; k < p_.kL ; k += p_.local_fetch_0*p_.simd_width)
// for(unsigned int s = 0 ; s < p_.simd_width ; ++s) for(unsigned int s = 0 ; s < p_.simd_width ; ++s)
// stream << "int condx" << k + s << " = " << k + s << " < Kx;" << std::endl; stream << "int condx" << k + s << " = " << k + s << " < Kx;" << std::endl;
// } }
// fetch_to_lds(true); fetch_to_lds(true);
stream << "//Write back C" << std::endl; stream << "//Write back C" << std::endl;
stream << "M += ids.x;" << std::endl; stream << "M += ids.x;" << std::endl;