Skip to content

Commit 9db44f8

Browse files
authored
[SYCL][FPGA][NFC] Prevent conflicts with template params in pipes.hpp (#2484)
Updating fpga_lsu.hpp templates to limit parameter scope and prevent conflicts when any defines that may use B or N. User's code could cause conflict for headers local variables, internal types. and function parameters, adding the prefix "_"
1 parent a7df1e1 commit 9db44f8

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

sycl/include/CL/sycl/INTEL/pipes.hpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,31 @@ template <class _name, class _dataT, int32_t _min_capacity = 0> class pipe {
2121
// Non-blocking pipes
2222
// Reading from pipe is lowered to SPIR-V instruction OpReadPipe via SPIR-V
2323
// friendly LLVM IR.
24-
static _dataT read(bool &Success) {
24+
static _dataT read(bool &_Success) {
2525
#ifdef __SYCL_DEVICE_ONLY__
26-
RPipeTy<_dataT> RPipe =
26+
RPipeTy<_dataT> _RPipe =
2727
__spirv_CreatePipeFromPipeStorage_read<_dataT>(&m_Storage);
2828
_dataT TempData;
29-
Success = !static_cast<bool>(
30-
__spirv_ReadPipe(RPipe, &TempData, m_Size, m_Alignment));
29+
_Success = !static_cast<bool>(
30+
__spirv_ReadPipe(_RPipe, &TempData, m_Size, m_Alignment));
3131
return TempData;
3232
#else
33-
(void)Success;
33+
(void)_Success;
3434
assert(!"Pipes are not supported on a host device!");
3535
#endif // __SYCL_DEVICE_ONLY__
3636
}
3737

3838
// Writing to pipe is lowered to SPIR-V instruction OpWritePipe via SPIR-V
3939
// friendly LLVM IR.
40-
static void write(const _dataT &Data, bool &Success) {
40+
static void write(const _dataT &_Data, bool &_Success) {
4141
#ifdef __SYCL_DEVICE_ONLY__
42-
WPipeTy<_dataT> WPipe =
42+
WPipeTy<_dataT> _WPipe =
4343
__spirv_CreatePipeFromPipeStorage_write<_dataT>(&m_Storage);
44-
Success = !static_cast<bool>(
45-
__spirv_WritePipe(WPipe, &Data, m_Size, m_Alignment));
44+
_Success = !static_cast<bool>(
45+
__spirv_WritePipe(_WPipe, &_Data, m_Size, m_Alignment));
4646
#else
47-
(void)Success;
48-
(void)Data;
47+
(void)_Success;
48+
(void)_Data;
4949
assert(!"Pipes are not supported on a host device!");
5050
#endif // __SYCL_DEVICE_ONLY__
5151
}
@@ -55,10 +55,10 @@ template <class _name, class _dataT, int32_t _min_capacity = 0> class pipe {
5555
// friendly LLVM IR.
5656
static _dataT read() {
5757
#ifdef __SYCL_DEVICE_ONLY__
58-
RPipeTy<_dataT> RPipe =
58+
RPipeTy<_dataT> _RPipe =
5959
__spirv_CreatePipeFromPipeStorage_read<_dataT>(&m_Storage);
6060
_dataT TempData;
61-
__spirv_ReadPipeBlockingINTEL(RPipe, &TempData, m_Size, m_Alignment);
61+
__spirv_ReadPipeBlockingINTEL(_RPipe, &TempData, m_Size, m_Alignment);
6262
return TempData;
6363
#else
6464
assert(!"Pipes are not supported on a host device!");
@@ -67,13 +67,13 @@ template <class _name, class _dataT, int32_t _min_capacity = 0> class pipe {
6767

6868
// Writing to pipe is lowered to SPIR-V instruction OpWritePipe via SPIR-V
6969
// friendly LLVM IR.
70-
static void write(const _dataT &Data) {
70+
static void write(const _dataT &_Data) {
7171
#ifdef __SYCL_DEVICE_ONLY__
72-
WPipeTy<_dataT> WPipe =
72+
WPipeTy<_dataT> _WPipe =
7373
__spirv_CreatePipeFromPipeStorage_write<_dataT>(&m_Storage);
74-
__spirv_WritePipeBlockingINTEL(WPipe, &Data, m_Size, m_Alignment);
74+
__spirv_WritePipeBlockingINTEL(_WPipe, &_Data, m_Size, m_Alignment);
7575
#else
76-
(void)Data;
76+
(void)_Data;
7777
assert(!"Pipes are not supported on a host device!");
7878
#endif // __SYCL_DEVICE_ONLY__
7979
}
@@ -114,16 +114,16 @@ class kernel_readable_io_pipe {
114114
// Non-blocking pipes
115115
// Reading from pipe is lowered to SPIR-V instruction OpReadPipe via SPIR-V
116116
// friendly LLVM IR.
117-
static _dataT read(bool &Success) {
117+
static _dataT read(bool &_Success) {
118118
#ifdef __SYCL_DEVICE_ONLY__
119-
RPipeTy<_dataT> RPipe =
119+
RPipeTy<_dataT> _RPipe =
120120
__spirv_CreatePipeFromPipeStorage_read<_dataT>(&m_Storage);
121121
_dataT TempData;
122-
Success = !static_cast<bool>(
123-
__spirv_ReadPipe(RPipe, &TempData, m_Size, m_Alignment));
122+
_Success = !static_cast<bool>(
123+
__spirv_ReadPipe(_RPipe, &TempData, m_Size, m_Alignment));
124124
return TempData;
125125
#else
126-
(void)Success;
126+
(void)_Success;
127127
assert(!"Pipes are not supported on a host device!");
128128
#endif // __SYCL_DEVICE_ONLY__
129129
}
@@ -133,10 +133,10 @@ class kernel_readable_io_pipe {
133133
// friendly LLVM IR.
134134
static _dataT read() {
135135
#ifdef __SYCL_DEVICE_ONLY__
136-
RPipeTy<_dataT> RPipe =
136+
RPipeTy<_dataT> _RPipe =
137137
__spirv_CreatePipeFromPipeStorage_read<_dataT>(&m_Storage);
138138
_dataT TempData;
139-
__spirv_ReadPipeBlockingINTEL(RPipe, &TempData, m_Size, m_Alignment);
139+
__spirv_ReadPipeBlockingINTEL(_RPipe, &TempData, m_Size, m_Alignment);
140140
return TempData;
141141
#else
142142
assert(!"Pipes are not supported on a host device!");
@@ -160,29 +160,29 @@ class kernel_writeable_io_pipe {
160160
// Non-blocking pipes
161161
// Writing to pipe is lowered to SPIR-V instruction OpWritePipe via SPIR-V
162162
// friendly LLVM IR.
163-
static void write(const _dataT &Data, bool &Success) {
163+
static void write(const _dataT &_Data, bool &_Success) {
164164
#ifdef __SYCL_DEVICE_ONLY__
165-
WPipeTy<_dataT> WPipe =
165+
WPipeTy<_dataT> _WPipe =
166166
__spirv_CreatePipeFromPipeStorage_write<_dataT>(&m_Storage);
167-
Success = !static_cast<bool>(
168-
__spirv_WritePipe(WPipe, &Data, m_Size, m_Alignment));
167+
_Success = !static_cast<bool>(
168+
__spirv_WritePipe(_WPipe, &_Data, m_Size, m_Alignment));
169169
#else
170-
(void)Data;
171-
(void)Success;
170+
(void)_Data;
171+
(void)_Success;
172172
assert(!"Pipes are not supported on a host device!");
173173
#endif // __SYCL_DEVICE_ONLY__
174174
}
175175

176176
// Blocking pipes
177177
// Writing to pipe is lowered to SPIR-V instruction OpWritePipe via SPIR-V
178178
// friendly LLVM IR.
179-
static void write(const _dataT &Data) {
179+
static void write(const _dataT &_Data) {
180180
#ifdef __SYCL_DEVICE_ONLY__
181-
WPipeTy<_dataT> WPipe =
181+
WPipeTy<_dataT> _WPipe =
182182
__spirv_CreatePipeFromPipeStorage_write<_dataT>(&m_Storage);
183-
__spirv_WritePipeBlockingINTEL(WPipe, &Data, m_Size, m_Alignment);
183+
__spirv_WritePipeBlockingINTEL(_WPipe, &_Data, m_Size, m_Alignment);
184184
#else
185-
(void)Data;
185+
(void)_Data;
186186
assert(!"Pipes are not supported on a host device!");
187187
#endif // __SYCL_DEVICE_ONLY__
188188
}

0 commit comments

Comments
 (0)