Skip to content

Commit

Permalink
Fixed a few compilation issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
inakleinbottle committed Oct 25, 2023
1 parent 43c4b64 commit 69cb2d0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 39 deletions.
35 changes: 16 additions & 19 deletions device/include/roughpy/device/kernel_arg.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
namespace rpy {
namespace devices {


class RPY_EXPORT KernelArgument
{

Expand Down Expand Up @@ -84,47 +83,45 @@ class RPY_EXPORT KernelArgument
m_info(dtl::type_info<T>())
{}

RPY_NO_DISCARD
constexpr bool is_buffer() const noexcept {
RPY_NO_DISCARD constexpr bool is_buffer() const noexcept
{
return m_mode == BufferPointer || m_mode == ConstBufferPointer;
}

RPY_NO_DISCARD
constexpr bool is_const() const noexcept {
RPY_NO_DISCARD constexpr bool is_const() const noexcept
{
return m_mode == ConstPointer || m_mode == ConstBufferPointer;
}

RPY_NO_DISCARD
constexpr void* pointer() const noexcept {
RPY_NO_DISCARD constexpr void* pointer() const noexcept
{
RPY_DBG_ASSERT(m_mode == Pointer);
return p_data;
}

RPY_NO_DISCARD
constexpr const void* const_pointer() const noexcept {
RPY_NO_DISCARD constexpr const void* const_pointer() const noexcept
{
RPY_DBG_ASSERT(!is_buffer());
return (m_mode == Pointer) ? p_data : p_const_data;
}

RPY_NO_DISCARD
constexpr Buffer& buffer() const noexcept {
RPY_NO_DISCARD constexpr Buffer& buffer() const noexcept
{
RPY_DBG_ASSERT(m_mode == BufferPointer);
return *p_buffer;
}

RPY_NO_DISCARD
constexpr const Buffer& const_buffer() const noexcept {
RPY_NO_DISCARD constexpr const Buffer& const_buffer() const noexcept
{
RPY_DBG_ASSERT(is_buffer());
return (m_mode == BufferPointer) ? *p_buffer : *p_const_buffer;
return (m_mode == BufferPointer) ? static_cast<const Buffer&>(*p_buffer)
: *p_const_buffer;
}

RPY_NO_DISCARD
constexpr dimn_t size() const noexcept {
RPY_NO_DISCARD constexpr dimn_t size() const noexcept
{
return (is_buffer()) ? sizeof(void*) : m_info.bytes;
}



};

}// namespace devices
Expand Down
6 changes: 0 additions & 6 deletions device/src/buffer_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,3 @@ BufferMode BufferInterface::mode() const {
dimn_t BufferInterface::size() const {
return 0;
}

void* BufferInterface::ptr() {
return nullptr;
}

void* BufferInterface::ptr() const { return nullptr; }
6 changes: 1 addition & 5 deletions device/src/cpu/cpu_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ Event CPUKernel::launch_kernel_async(
Slice<KernelArgument> args
)
{
if (queue.is_default() && m_fallback != nullptr) {
m_fallback(args.begin(), params.total_work_dims());
}

return KernelInterface::launch_kernel_async(queue, params, args);
return Event();
}
std::unique_ptr<rpy::devices::dtl::InterfaceBase> CPUKernel::clone() const
{
Expand Down
7 changes: 0 additions & 7 deletions device/src/kernel_arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,3 @@

using namespace rpy;
using namespace rpy::devices;

void* devices::arg_to_pointer(const Buffer& buffer) {
return buffer.ptr();
}
void* devices::arg_to_pointer(Buffer& buffer) {
return buffer.ptr();
}
3 changes: 1 addition & 2 deletions device/src/opencl/ocl_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void check_and_set_argument(
device->context(),
flags,
buf_ref.size(),
buf_ref.ptr(),
static_cast<cl_mem>(const_cast<void*>(buf_ref.ptr())),
&ecode
);
if (new_buffer == nullptr) { RPY_HANDLE_OCL_ERROR(ecode); }
Expand Down Expand Up @@ -229,7 +229,6 @@ Event OCLKernel::launch_kernel_async(
)
{
RPY_DBG_ASSERT(m_kernel != nullptr);
RPY_DBG_ASSERT(args.size() == arg_sizes.size());

auto n_args = num_args();
RPY_DBG_ASSERT(args.size() == n_args);
Expand Down

0 comments on commit 69cb2d0

Please sign in to comment.