diff --git a/ttg/CMakeLists.txt b/ttg/CMakeLists.txt index 644b4dfb4..4f2dc5daf 100644 --- a/ttg/CMakeLists.txt +++ b/ttg/CMakeLists.txt @@ -210,6 +210,7 @@ if (TARGET MADworld) set(ttg-mad-headers ${CMAKE_CURRENT_SOURCE_DIR}/ttg/madness/buffer.h ${CMAKE_CURRENT_SOURCE_DIR}/ttg/madness/device.h + ${CMAKE_CURRENT_SOURCE_DIR}/ttg/madness/devicefunc.h ${CMAKE_CURRENT_SOURCE_DIR}/ttg/madness/fwd.h ${CMAKE_CURRENT_SOURCE_DIR}/ttg/madness/import.h ${CMAKE_CURRENT_SOURCE_DIR}/ttg/madness/ttg.h diff --git a/ttg/ttg/madness/buffer.h b/ttg/ttg/madness/buffer.h index 27e29d05b..fba1ee9e1 100644 --- a/ttg/ttg/madness/buffer.h +++ b/ttg/ttg/madness/buffer.h @@ -186,6 +186,10 @@ struct Buffer : private Allocator { throw std::runtime_error("not implemented yet"); } + bool empty() const { + return (m_host_data == nullptr); + } + /* TODO: can we do this automatically? * Pin the memory on all devices we currently track. * Pinned memory won't be released by PaRSEC and can be used diff --git a/ttg/ttg/madness/devicefunc.h b/ttg/ttg/madness/devicefunc.h new file mode 100644 index 000000000..563b433cf --- /dev/null +++ b/ttg/ttg/madness/devicefunc.h @@ -0,0 +1,30 @@ +#ifndef TTG_MAD_DEVICEFUNC_H +#define TTG_MAD_DEVICEFUNC_H + +#include "ttg/madness/buffer.h" + +namespace ttg_madness { + + template + auto buffer_data(const Buffer& buffer) { + /* for now return the internal pointer, should be adapted if ever relevant for madness */ + return buffer.current_device_ptr(); + } + + template + inline bool register_device_memory(std::tuple &views) + { + /* nothing to do here */ + return true; + } + + template + inline bool register_device_memory(const ttg::span& span) + { + /* nothing to do here */ + return true; + } + +} // namespace ttg_madness + +#endif // TTG_MAD_DEVICEFUNC_H \ No newline at end of file diff --git a/ttg/ttg/madness/fwd.h b/ttg/ttg/madness/fwd.h index 6bee1a832..b164a6f50 100644 --- a/ttg/ttg/madness/fwd.h +++ b/ttg/ttg/madness/fwd.h @@ -3,6 +3,7 @@ #include "ttg/fwd.h" #include "ttg/util/typelist.h" +#include "ttg/util/span.h" #include @@ -71,6 +72,9 @@ namespace ttg_madness { template inline bool register_device_memory(std::tuple &views); + template + inline bool register_device_memory(const ttg::span& span); + template inline void post_device_out(std::tuple &b); diff --git a/ttg/ttg/madness/ttg.h b/ttg/ttg/madness/ttg.h index d84f29dcc..690c8c404 100644 --- a/ttg/ttg/madness/ttg.h +++ b/ttg/ttg/madness/ttg.h @@ -14,6 +14,7 @@ #include "ttg/base/tt.h" #include "ttg/func.h" #include "ttg/madness/device.h" +#include "ttg/madness/devicefunc.h" #include "ttg/runtimes.h" #include "ttg/tt.h" #include "ttg/util/bug.h"