Skip to content

Commit 433b952

Browse files
authored
Merge pull request #1106 from wenju-he/fix-native_cpu-build-warnings
[NATIVECPU] Fix build errors when -Werror=on
2 parents b4e665f + d0319b2 commit 433b952

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

source/adapters/native_cpu/enqueue.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,11 @@ static inline ur_result_t enqueueMemBufferReadWriteRect_impl(
144144
size_t host_origin = (d + HostOffset.z) * HostSlicePitch +
145145
(h + HostOffset.y) * HostRowPitch + w +
146146
HostOffset.x;
147-
int8_t &host_mem = ur_cast<int8_t *>(DstMem)[host_origin];
148147
int8_t &buff_mem = ur_cast<int8_t *>(Buff->_mem)[buff_orign];
149-
if (IsRead)
150-
host_mem = buff_mem;
148+
if constexpr (IsRead)
149+
ur_cast<int8_t *>(DstMem)[host_origin] = buff_mem;
151150
else
152-
buff_mem = host_mem;
151+
buff_mem = ur_cast<const int8_t *>(DstMem)[host_origin];
153152
}
154153
return UR_RESULT_SUCCESS;
155154
}
@@ -160,6 +159,8 @@ static inline ur_result_t doCopy_impl(ur_queue_handle_t hQueue, void *DstPtr,
160159
const ur_event_handle_t *EventWaitList,
161160
ur_event_handle_t *Event) {
162161
// todo: non-blocking, events, UR integration
162+
std::ignore = EventWaitList;
163+
std::ignore = Event;
163164
std::ignore = hQueue;
164165
std::ignore = numEventsInWaitList;
165166
if (SrcPtr != DstPtr && Size)

source/adapters/native_cpu/kernel.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ urKernelCreate(ur_program_handle_t hProgram, const char *pKernelName,
2525
if (kernelEntry == hProgram->_kernels.end())
2626
return UR_RESULT_ERROR_INVALID_KERNEL;
2727

28-
auto f = reinterpret_cast<nativecpu_ptr_t>(kernelEntry->second);
28+
auto f = reinterpret_cast<nativecpu_ptr_t>(
29+
const_cast<unsigned char *>(kernelEntry->second));
2930
auto kernel = new ur_kernel_handle_t_(pKernelName, *f);
3031

3132
*phKernel = kernel;
@@ -171,6 +172,13 @@ urKernelGetSubGroupInfo(ur_kernel_handle_t hKernel, ur_device_handle_t hDevice,
171172
// todo: set proper values
172173
return ReturnValue(0);
173174
}
175+
case UR_KERNEL_SUB_GROUP_INFO_FORCE_UINT32: {
176+
#ifdef _MSC_VER
177+
__assume(0);
178+
#else
179+
__builtin_unreachable();
180+
#endif
181+
}
174182
}
175183
DIE_NO_IMPLEMENTATION;
176184
}

source/adapters/native_cpu/memory.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct _ur_buffer final : ur_mem_handle_t_ {
6161
: ur_mem_handle_t_(Size, false) {}
6262
_ur_buffer(_ur_buffer *b, size_t Offset, size_t Size)
6363
: ur_mem_handle_t_(b->_mem + Offset, false), SubBuffer(b) {
64+
std::ignore = Size;
6465
SubBuffer.Origin = Offset;
6566
}
6667

0 commit comments

Comments
 (0)