@@ -29,89 +29,92 @@ __SYCL_INLINE_NAMESPACE(cl) {
29
29
namespace sycl {
30
30
namespace detail {
31
31
32
- // / This is the device interface version required (and used) by this implementation of
33
- // / the ESIMD CPU emulator.
32
+ // / This is the device interface version required (and used) by this
33
+ // / implementation of the ESIMD CPU emulator.
34
34
#define ESIMD_DEVICE_INTERFACE_VERSION 1
35
35
36
- // 'ESIMDDeviceInterface' structure defines interface for ESIMD CPU
37
- // emulation (ESIMD_CPU) to access LibCM CPU emulation functionalities
38
- // from kernel application under emulation.
36
+ // 'ESIMDDeviceInterface' structure defines interface for ESIMD CPU
37
+ // emulation (ESIMD_CPU) to access LibCM CPU emulation functionalities
38
+ // from kernel application under emulation.
39
39
40
- // Header files included in the structure contains only function
41
- // pointers to access CM functionalities. Only new function can be
42
- // added - reordering, changing, or removing existing function pointer
43
- // is not allowed.
40
+ // Header files included in the structure contains only function
41
+ // pointers to access CM functionalities. Only new function can be
42
+ // added - reordering, changing, or removing existing function pointer
43
+ // is not allowed.
44
44
45
- // Whenever a new function(s) is added to this interface, a new header
46
- // file must be added following naming convention that contains
47
- // version number such as 'v1' from 'ESIMD_DEVICE_INTERFACE_VERSION'.
48
- struct ESIMDDeviceInterface {
49
- uintptr_t version;
50
- void *reserved;
45
+ // Whenever a new function(s) is added to this interface, a new header
46
+ // file must be added following naming convention that contains
47
+ // version number such as 'v1' from 'ESIMD_DEVICE_INTERFACE_VERSION'.
48
+ struct ESIMDDeviceInterface {
49
+ uintptr_t version;
50
+ void *reserved;
51
51
52
- ESIMDDeviceInterface ();
52
+ ESIMDDeviceInterface ();
53
53
#include " esimd_emu_functions_v1.h"
54
- };
54
+ };
55
55
56
56
// Denotes the data version used by the implementation.
57
- // Increment whenever the 'data' field interpretation within PluginOpaqueData is changed.
57
+ // Increment whenever the 'data' field interpretation within PluginOpaqueData is
58
+ // changed.
58
59
#define ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION 0
59
- // / This structure denotes a ESIMD EMU plugin-specific data returned via the
60
- // / piextPluginGetOpaqueData PI call. Depending on the \c version field, the second \c data
61
- // / field can be interpreted differently.
62
- struct ESIMDEmuPluginOpaqueData {
63
- uintptr_t version;
64
- void *data;
65
- };
66
- // The table below shows the correspondence between the \c version
67
- // and the contents of the \c data field:
68
- // version == 0, data is ESIMDDeviceInterface*
69
-
70
- ESIMDDeviceInterface *getESIMDDeviceInterface () {
71
- // TODO (performance) cache the interface pointer, can make a difference when
72
- // calling fine-grained libCM APIs through it (like memory access in a tight
73
- // loop)
74
- void *PIOpaqueData = nullptr ;
75
-
76
- PIOpaqueData = getPluginOpaqueData<cl::sycl::backend::esimd_cpu>(nullptr );
77
-
78
- ESIMDEmuPluginOpaqueData *OpaqueData = reinterpret_cast <ESIMDEmuPluginOpaqueData *>(PIOpaqueData);
79
-
80
- // First check if opaque data version is compatible.
81
- if (OpaqueData->version != ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION) {
82
- // NOTE: the version check should always be '!=' as layouts of different
83
- // versions of PluginOpaqueData is not backward compatible, unlike
84
- // layout of the ESIMDDeviceInterface.
85
-
86
- std::cerr << __FUNCTION__ << std::endl
87
- << " Opaque data returned by ESIMD Emu plugin is incompatible with"
88
- << " the one used in current implementation." << std::endl
89
- << " Returned version : " << OpaqueData->version << std::endl
90
- << " Required version : " << ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION
91
- << std::endl;
92
- throw cl::sycl::feature_not_supported ();
60
+ // / This structure denotes a ESIMD EMU plugin-specific data returned via the
61
+ // / piextPluginGetOpaqueData PI call. Depending on the \c version field, the
62
+ // / second \c data field can be interpreted differently.
63
+ struct ESIMDEmuPluginOpaqueData {
64
+ uintptr_t version;
65
+ void *data;
66
+ };
67
+ // The table below shows the correspondence between the \c version
68
+ // and the contents of the \c data field:
69
+ // version == 0, data is ESIMDDeviceInterface*
70
+
71
+ ESIMDDeviceInterface *getESIMDDeviceInterface () {
72
+ // TODO (performance) cache the interface pointer, can make a difference
73
+ // when calling fine-grained libCM APIs through it (like memory access in a
74
+ // tight loop)
75
+ void *PIOpaqueData = nullptr ;
76
+
77
+ PIOpaqueData = getPluginOpaqueData<cl::sycl::backend::esimd_cpu>(nullptr );
78
+
79
+ ESIMDEmuPluginOpaqueData *OpaqueData =
80
+ reinterpret_cast <ESIMDEmuPluginOpaqueData *>(PIOpaqueData);
81
+
82
+ // First check if opaque data version is compatible.
83
+ if (OpaqueData->version != ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION) {
84
+ // NOTE: the version check should always be '!=' as layouts of different
85
+ // versions of PluginOpaqueData is not backward compatible, unlike
86
+ // layout of the ESIMDDeviceInterface.
87
+
88
+ std::cerr
89
+ << __FUNCTION__ << std::endl
90
+ << " Opaque data returned by ESIMD Emu plugin is incompatible with"
91
+ << " the one used in current implementation." << std::endl
92
+ << " Returned version : " << OpaqueData->version << std::endl
93
+ << " Required version : " << ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION
94
+ << std::endl;
95
+ throw cl::sycl::feature_not_supported ();
96
+ }
97
+ // Opaque data version is OK, can cast the 'data' field.
98
+ ESIMDDeviceInterface *Interface =
99
+ reinterpret_cast <ESIMDDeviceInterface *>(OpaqueData->data );
100
+
101
+ // Now check that device interface version is compatible.
102
+ if (Interface->version < ESIMD_DEVICE_INTERFACE_VERSION) {
103
+ std::cerr << __FUNCTION__ << std::endl
104
+ << " The device interface version provided from plug-in "
105
+ << " library is behind required device interface version"
106
+ << std::endl
107
+ << " Found version : " << Interface->version << std::endl
108
+ << " Required version :" << ESIMD_DEVICE_INTERFACE_VERSION
109
+ << std::endl;
110
+ throw cl::sycl::feature_not_supported ();
111
+ }
112
+ return Interface;
93
113
}
94
- // Opaque data version is OK, can cast the 'data' field.
95
- ESIMDDeviceInterface *Interface =
96
- reinterpret_cast <ESIMDDeviceInterface*>(OpaqueData->data );
97
-
98
- // Now check that device interface version is compatible.
99
- if (Interface->version < ESIMD_DEVICE_INTERFACE_VERSION) {
100
- std::cerr << __FUNCTION__ << std::endl
101
- << " The device interface version provided from plug-in "
102
- << " library is behind required device interface version"
103
- << std::endl
104
- << " Found version : " << Interface->version << std::endl
105
- << " Required version :" << ESIMD_DEVICE_INTERFACE_VERSION
106
- << std::endl;
107
- throw cl::sycl::feature_not_supported ();
108
- }
109
- return Interface;
110
- }
111
114
112
115
#undef ESIMD_DEVICE_INTERFACE_VERSION
113
116
#undef ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION
114
117
115
- } // namespace detail
116
- } // namespace sycl
118
+ } // namespace detail
119
+ } // namespace sycl
117
120
} // __SYCL_INLINE_NAMESPACE(cl)
0 commit comments