Skip to content

Commit

Permalink
Merge pull request #1106 from wenju-he/fix-native_cpu-build-warnings
Browse files Browse the repository at this point in the history
[NATIVECPU] Fix build errors when -Werror=on
  • Loading branch information
kbenzie committed Nov 24, 2023
2 parents b4e665f + d0319b2 commit 433b952
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 5 additions & 4 deletions source/adapters/native_cpu/enqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,11 @@ static inline ur_result_t enqueueMemBufferReadWriteRect_impl(
size_t host_origin = (d + HostOffset.z) * HostSlicePitch +
(h + HostOffset.y) * HostRowPitch + w +
HostOffset.x;
int8_t &host_mem = ur_cast<int8_t *>(DstMem)[host_origin];
int8_t &buff_mem = ur_cast<int8_t *>(Buff->_mem)[buff_orign];
if (IsRead)
host_mem = buff_mem;
if constexpr (IsRead)
ur_cast<int8_t *>(DstMem)[host_origin] = buff_mem;
else
buff_mem = host_mem;
buff_mem = ur_cast<const int8_t *>(DstMem)[host_origin];
}
return UR_RESULT_SUCCESS;
}
Expand All @@ -160,6 +159,8 @@ static inline ur_result_t doCopy_impl(ur_queue_handle_t hQueue, void *DstPtr,
const ur_event_handle_t *EventWaitList,
ur_event_handle_t *Event) {
// todo: non-blocking, events, UR integration
std::ignore = EventWaitList;
std::ignore = Event;
std::ignore = hQueue;
std::ignore = numEventsInWaitList;
if (SrcPtr != DstPtr && Size)
Expand Down
10 changes: 9 additions & 1 deletion source/adapters/native_cpu/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ urKernelCreate(ur_program_handle_t hProgram, const char *pKernelName,
if (kernelEntry == hProgram->_kernels.end())
return UR_RESULT_ERROR_INVALID_KERNEL;

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

*phKernel = kernel;
Expand Down Expand Up @@ -171,6 +172,13 @@ urKernelGetSubGroupInfo(ur_kernel_handle_t hKernel, ur_device_handle_t hDevice,
// todo: set proper values
return ReturnValue(0);
}
case UR_KERNEL_SUB_GROUP_INFO_FORCE_UINT32: {
#ifdef _MSC_VER
__assume(0);
#else
__builtin_unreachable();
#endif
}
}
DIE_NO_IMPLEMENTATION;
}
Expand Down
1 change: 1 addition & 0 deletions source/adapters/native_cpu/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct _ur_buffer final : ur_mem_handle_t_ {
: ur_mem_handle_t_(Size, false) {}
_ur_buffer(_ur_buffer *b, size_t Offset, size_t Size)
: ur_mem_handle_t_(b->_mem + Offset, false), SubBuffer(b) {
std::ignore = Size;
SubBuffer.Origin = Offset;
}

Expand Down

0 comments on commit 433b952

Please sign in to comment.