CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
77 lines
2.6 KiB
C++
77 lines
2.6 KiB
C++
// Copyright (c) Advanced Micro Devices, Inc.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#include "writer_impl.hpp"
|
|
#include "storage_impl.hpp"
|
|
|
|
#include <memory>
|
|
#include <stdexcept>
|
|
|
|
namespace profiler_hub
|
|
{
|
|
|
|
template <typename Policy>
|
|
writer_impl_core<Policy>::writer_impl_core(std::shared_ptr<writer_context> ctx)
|
|
: m_ctx(std::move(ctx))
|
|
, m_stmts(std::make_shared<stmts_t>(m_ctx->backend, m_ctx->uuid))
|
|
, m_common_ops(std::make_shared<common_ops_t>(m_ctx, m_stmts))
|
|
, m_info_writer(
|
|
std::make_unique<typename Policy::info_writer_t>(m_ctx, m_stmts, m_common_ops))
|
|
, m_kernel_dispatch_writer(
|
|
std::make_unique<typename Policy::kernel_dispatch_writer_t>(m_ctx,
|
|
m_stmts,
|
|
m_common_ops))
|
|
, m_memory_copy_writer(
|
|
std::make_unique<typename Policy::memory_copy_writer_t>(m_ctx,
|
|
m_stmts,
|
|
m_common_ops))
|
|
, m_memory_alloc_writer(
|
|
std::make_unique<typename Policy::memory_alloc_writer_t>(m_ctx,
|
|
m_stmts,
|
|
m_common_ops))
|
|
, m_region_writer(
|
|
std::make_unique<typename Policy::region_writer_t>(m_ctx, m_stmts, m_common_ops))
|
|
, m_pmc_event_writer(
|
|
std::make_unique<typename Policy::pmc_event_writer_t>(m_ctx, m_stmts, m_common_ops))
|
|
{}
|
|
|
|
template class writer_impl_core<active_policy_t>;
|
|
|
|
std::shared_ptr<writer_context>
|
|
writer_t::impl::create_writer_context(const std::unique_ptr<storage_t>& storage)
|
|
{
|
|
if(!storage)
|
|
{
|
|
throw std::invalid_argument("Provided pointer to a non-existing storage!");
|
|
}
|
|
|
|
auto ctx = std::make_shared<writer_context>();
|
|
ctx->backend =
|
|
storage->m_impl->create_database(storage_t::impl::storage_type_t::write);
|
|
ctx->registry = std::make_shared<entity_registry>();
|
|
ctx->key_providers = std::make_shared<primary_key_providers>();
|
|
ctx->uuid = storage->m_impl->get_uuid();
|
|
|
|
if(!ctx->backend)
|
|
{
|
|
throw std::invalid_argument("Provided pointer to a non-existing database!");
|
|
}
|
|
|
|
if(ctx->uuid.empty())
|
|
{
|
|
throw std::invalid_argument("Empty UUID provided!");
|
|
}
|
|
|
|
ctx->validator = std::make_shared<insert_validator>(ctx->registry);
|
|
ctx->backend->initialize_schema();
|
|
|
|
return ctx;
|
|
}
|
|
|
|
writer_t::impl::impl(std::unique_ptr<profiler_hub::storage_t> storage)
|
|
: writer_impl_core<active_policy_t>(create_writer_context(storage))
|
|
, m_storage(std::move(storage))
|
|
{}
|
|
|
|
} // namespace profiler_hub
|