Skip to content

Commit 8663a65

Browse files
Clang-formatting
1 parent a2c08d8 commit 8663a65

File tree

3 files changed

+84
-79
lines changed

3 files changed

+84
-79
lines changed

sycl/include/CL/sycl/INTEL/esimd/detail/emu/esimdcpu_device_interface.hpp

Lines changed: 74 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -29,89 +29,92 @@ __SYCL_INLINE_NAMESPACE(cl) {
2929
namespace sycl {
3030
namespace detail {
3131

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.
3434
#define ESIMD_DEVICE_INTERFACE_VERSION 1
3535

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.
3939

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.
4444

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;
5151

52-
ESIMDDeviceInterface();
52+
ESIMDDeviceInterface();
5353
#include "esimd_emu_functions_v1.h"
54-
};
54+
};
5555

5656
// 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.
5859
#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;
93113
}
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-
}
111114

112115
#undef ESIMD_DEVICE_INTERFACE_VERSION
113116
#undef ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION
114117

115-
} // namespace detail
116-
} // namespace sycl
118+
} // namespace detail
119+
} // namespace sycl
117120
} // __SYCL_INLINE_NAMESPACE(cl)

sycl/include/CL/sycl/detail/pi.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,11 +1600,12 @@ __SYCL_EXPORT pi_result piextUSMGetMemAllocInfo(
16001600
pi_context context, const void *ptr, pi_mem_info param_name,
16011601
size_t param_value_size, void *param_value, size_t *param_value_size_ret);
16021602

1603-
/// API to get Plugin internal data, opaque to SYCL RT. Some devices whose device code is compiled
1604-
/// by the host compiler (e.g. CPU emulators) may use it to access some device code functionality
1605-
/// implemented in/behind the plugin.
1606-
/// \param opaque_data_param - unspecified argument, interpretation is specific to a plugin
1607-
/// \param opaque_data_return - placeholder for the returned opaque data.
1603+
/// API to get Plugin internal data, opaque to SYCL RT. Some devices whose
1604+
/// device code is compiled by the host compiler (e.g. CPU emulators) may use it
1605+
/// to access some device code functionality implemented in/behind the plugin.
1606+
/// \param opaque_data_param - unspecified argument, interpretation is specific
1607+
/// to a plugin \param opaque_data_return - placeholder for the returned opaque
1608+
/// data.
16081609
__SYCL_EXPORT pi_result piextPluginGetOpaqueData(void *opaque_data_param,
16091610
void **opaque_data_return);
16101611

sycl/plugins/esimd_cpu/pi_esimd_cpu.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,10 @@ sycl::detail::ESIMDDeviceInterface::ESIMDDeviceInterface() {
480480
cm_sbarrier_ptr = nullptr; /* cm_support::split_barrier; */
481481
cm_fence_ptr = nullptr; /* cm_support::fence; */
482482

483-
sycl_get_surface_base_addr_ptr = nullptr; /* cm_support::get_surface_base_addr; */
484-
__cm_emu_get_slm_ptr = nullptr; /* cm_support::get_slm_base; */
485-
cm_slm_init_ptr = nullptr; /* cm_support::init_slm; */
483+
sycl_get_surface_base_addr_ptr =
484+
nullptr; /* cm_support::get_surface_base_addr; */
485+
__cm_emu_get_slm_ptr = nullptr; /* cm_support::get_slm_base; */
486+
cm_slm_init_ptr = nullptr; /* cm_support::init_slm; */
486487
}
487488

488489
extern "C" {

0 commit comments

Comments
 (0)