#include "../include/hip/hcc_detail/code_object_bundle.hpp" #include #include #include #include #include #include using namespace std; // DATA - STATICS constexpr const char hip_impl::Bundled_code_header::magic_string_[]; // CREATORS hip_impl::Bundled_code_header::Bundled_code_header(const vector& x) : Bundled_code_header{x.cbegin(), x.cend()} {} hip_impl::Bundled_code_header::Bundled_code_header( const void* p) { // This is a pretty terrible interface, useful only because // hipLoadModuleData is so poorly specified (for no fault of its own). if (!p) return; auto ph = static_cast(p); if (!equal(magic_string_, magic_string_ + magic_string_sz_, ph->bundler_magic_string_)) { return; } size_t sz = sizeof(Header_) + ph->bundle_cnt_ * sizeof(Bundled_code::Header); auto pb = static_cast(p) + sizeof(Header_); auto n = ph->bundle_cnt_; while (n--) { sz += reinterpret_cast(pb)->bundle_sz; pb += sizeof(Bundled_code::Header); } read(static_cast(p), static_cast(p) + sz, *this); }