specialized spawner object

[ROCm/clr commit: 1e49cff87a]
This commit is contained in:
Evgeny
2018-11-11 23:44:16 -06:00
کامیت شده توسط root
والد 96b7f0404e
کامیت f6d8fa5487
2فایلهای تغییر یافته به همراه25 افزوده شده و 11 حذف شده
@@ -127,21 +127,19 @@ typedef activity_sync_callback_t hip_act_callback_t;
// HIP API callbacks spawner object macro
#define HIP_CB_SPAWNER_OBJECT(CB_ID) \
if (HIP_API_ID_##CB_ID < HIP_API_ID_NUMBER) { \
hip_api_data_t api_data{}; \
INIT_CB_ARGS_DATA(CB_ID, api_data); \
api_callbacks_spawner_t __api_tracer(HIP_API_ID_##CB_ID, api_data); \
}
hip_api_data_t api_data{}; \
INIT_CB_ARGS_DATA(CB_ID, api_data); \
api_callbacks_spawner_t<HIP_API_ID_##CB_ID> __api_tracer(HIP_API_ID_##CB_ID, api_data);
typedef api_callbacks_table_templ<hip_api_record_t,
hip_api_callback_t,
hip_act_callback_t> api_callbacks_table_t;
extern api_callbacks_table_t callbacks_table;
template <int cid_>
class api_callbacks_spawner_t {
public:
api_callbacks_spawner_t(const hip_api_id_t& cid, hip_api_data_t& api_data) :
cid_(cid),
api_data_(api_data),
record_({})
{
@@ -174,7 +172,6 @@ class api_callbacks_spawner_t {
return callbacks_table.entry(id);
}
const hip_api_id_t cid_;
hip_api_data_t& api_data_;
hip_api_record_t record_;
@@ -184,6 +181,12 @@ class api_callbacks_spawner_t {
void* arg;
};
template <>
class api_callbacks_spawner_t<HIP_API_ID_NUMBER> {
public:
api_callbacks_spawner_t(const hip_api_id_t& cid, hip_api_data_t& api_data) {}
};
#else
#define HIP_CB_SPAWNER_OBJECT(x) do {} while(0)
@@ -5,7 +5,6 @@
#include <string>
// Dummy API callbacks definition
#define INIT_hipHccModuleLaunchKernel_CB_ARGS_DATA(cb_data) {};
#define INIT_hipHccGetAccelerator_CB_ARGS_DATA(cb_data) {};
#define INIT_hipHccGetAcceleratorView_CB_ARGS_DATA(cb_data) {};
#define INIT_hipDeviceCanAccessPeer2_CB_ARGS_DATA(cb_data) {};
@@ -177,10 +176,10 @@ enum hip_api_id_t {
HIP_API_ID_hipModuleGetFunction = 135,
HIP_API_ID_hipGetDevice = 136,
HIP_API_ID_hipGetDeviceCount = 137,
HIP_API_ID_NUMBER = 138,
HIP_API_ID_ANY = 139,
HIP_API_ID_hipHccModuleLaunchKernel = 138,
HIP_API_ID_NUMBER = 139,
HIP_API_ID_ANY = 140,
HIP_API_ID_hipHccModuleLaunchKernel = HIP_API_ID_NUMBER,
HIP_API_ID_hipHccGetAccelerator = HIP_API_ID_NUMBER,
HIP_API_ID_hipHccGetAcceleratorView = HIP_API_ID_NUMBER,
HIP_API_ID_hipDeviceCanAccessPeer2 = HIP_API_ID_NUMBER,
@@ -340,6 +339,7 @@ static const char* hip_api_name(const uint32_t& id) {
case HIP_API_ID_hipCtxEnablePeerAccess: return "hipCtxEnablePeerAccess";
case HIP_API_ID_hipMemcpyDtoHAsync: return "hipMemcpyDtoHAsync";
case HIP_API_ID_hipModuleLaunchKernel: return "hipModuleLaunchKernel";
case HIP_API_ID_hipHccModuleLaunchKernel: return "hipHccModuleLaunchKernel";
case HIP_API_ID_hipModuleGetTexRef: return "hipModuleGetTexRef";
case HIP_API_ID_hipRemoveActivityCallback: return "hipRemoveActivityCallback";
case HIP_API_ID_hipDeviceGetLimit: return "hipDeviceGetLimit";
@@ -907,6 +907,9 @@ struct hip_api_data_t {
void** kernelParams;
void** extra;
} hipModuleLaunchKernel;
struct {
hipFunction_t f;
} hipHccModuleLaunchKernel;
struct {
textureReference** texRef;
hipModule_t hmod;
@@ -1526,6 +1529,9 @@ struct hip_api_data_t {
cb_data.args.hipModuleLaunchKernel.kernelParams = (void**)kernelParams; \
cb_data.args.hipModuleLaunchKernel.extra = (void**)extra; \
};
#define INIT_hipHccModuleLaunchKernel_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipModuleLaunchKernel.f = (hipFunction_t)f; \
};
#define INIT_hipModuleGetTexRef_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipModuleGetTexRef.texRef = (textureReference**)texRef; \
cb_data.args.hipModuleGetTexRef.hmod = (hipModule_t)hmod; \
@@ -2396,6 +2402,11 @@ const char* hipApiString(hip_api_id_t id, const hip_api_data_t* data) {
<< " extra=" << data->args.hipModuleLaunchKernel.extra
<< ")";
break;
case HIP_API_ID_hipHccModuleLaunchKernel:
oss << "hipHccModuleLaunchKernel("
<< " f=" << data->args.hipHccModuleLaunchKernel.f << ","
<< ")";
break;
case HIP_API_ID_hipModuleGetTexRef:
oss << "hipModuleGetTexRef("
<< " texRef=" << data->args.hipModuleGetTexRef.texRef << ","