Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
769f8f9
WIP
stsoe May 11, 2026
279be8a
Add recipe builder
stsoe May 14, 2026
01ff440
Add artifacts dumper
stsoe May 14, 2026
1cc0409
Fix custom streambuf
stsoe May 15, 2026
c7c2cb1
Sweep changes and cleanup
stsoe May 15, 2026
e5907df
Capture frame data at frame level
stsoe May 17, 2026
e3009af
Capture runs as a resource
stsoe May 17, 2026
35fc9d1
Add recipe::execution::frames
stsoe May 17, 2026
47a53c6
Rename XRT_RECIPE_CAPTURE to XRT_REPLAY_CAPTURE
stsoe May 18, 2026
c2cb331
Rename qos to cfg
stsoe May 18, 2026
2f35f08
Add replayer
stsoe May 18, 2026
5de1326
Save replay script in same dir as artifacts
stsoe May 18, 2026
3a68705
Fix bug writing scalar values to json
stsoe May 18, 2026
5bea5d2
Fix windows build errors
stsoe May 18, 2026
39b0525
Make frames an array of array
stsoe May 18, 2026
2c14f71
Add frames::bo for tracking sync
stsoe May 20, 2026
c06dbb3
Update replay for new json
stsoe May 22, 2026
e6f52a4
Derive run_impl_debug and runlist_impl_debug
stsoe May 23, 2026
82eba91
Capture frame wait
stsoe May 23, 2026
dc84b65
Split a frame into runs and waits
stsoe May 23, 2026
c77fc94
Templatize run_impl_debug
stsoe May 24, 2026
e902f0d
Move capture/ to runner/
stsoe May 24, 2026
a159060
Share replay and runner details in details dir
stsoe May 24, 2026
60baa10
Comments and minor tweaks
stsoe May 24, 2026
9b89a2d
Fix object naming
stsoe May 24, 2026
d252d1b
More comments
stsoe May 24, 2026
668cb72
Add documenation
stsoe May 25, 2026
1bdd906
Fix windows compile errors
stsoe May 25, 2026
5e686e7
Fix clangtidy warnings
stsoe May 25, 2026
bcf46a8
Fix runlist capturing and replay, still WIP
stsoe May 26, 2026
8617d36
Fix frame initialization when frame has multiple runs (runlist)
stsoe May 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/runtime_src/core/common/api/bo_int.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
// Copyright (C) 2024-2026 Advanced Micro Devices, Inc. All rights reserved.
//
#ifndef _XRT_COMMON_BO_INT_H_
#define _XRT_COMMON_BO_INT_H_
#ifndef XRT_COMMON_BO_INT_H_
#define XRT_COMMON_BO_INT_H_

// This file defines implementation extensions to the XRT BO APIs.
#include "core/common/config.h"
Expand Down Expand Up @@ -97,6 +97,13 @@ XRT_CORE_COMMON_EXPORT
void
unconfig_bo(const xrt::bo& bo, const xrt_core::hwctx_handle* ctx_handle = nullptr);

// get_bo_from_impl() - Convert impl to xrt::bo
//
// The argument impl is created from a shared ptr, this function wraps
// the impl in that shared_ptr.
xrt::bo
get_bo_from_impl(const xrt::bo_impl*);

} // bo_int, xrt_core

#endif
20 changes: 13 additions & 7 deletions src/runtime_src/core/common/api/hw_context_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// Provide access to xrt::xclbin data that is not directly exposed
// to end users via xrt::xclbin. These functions are used by
// XRT core implementation.
namespace xrt_core { namespace hw_context_int {
namespace xrt_core::hw_context_int {

// Get the core_device from this context
// Exported for xdp access
Expand Down Expand Up @@ -51,6 +51,11 @@ create_hw_context_from_implementation(void* hwctx_impl);
xrt::elf
get_elf(const xrt::hw_context& hwctx, const std::string& kname);

// get_config_elfs() - Return list of configuration elfs for hwctx
// In non-elf flow, this function return empty set.
std::vector<xrt::elf>
get_config_elfs(const xrt::hw_context& hwctx);

// Get the partition size (number of columns). May not be available
// in xclbin mode.
XRT_CORE_COMMON_EXPORT
Expand Down Expand Up @@ -98,15 +103,16 @@ XRT_CORE_COMMON_EXPORT
xrt::hw_context::qos_type
get_qos_map(const xrt::hw_context& hwctx);

// Get the configuration parameters from the hw context.
// The returned map contains key-value pairs
// key: string, value: string for both QoS-related settings and
// other hw context configuration parameters.
// Throws std::runtime_error if the context currently does not store cfg_type
// get_cfg_map() - Get the configuration parameters
//
// The returned map contains string to string key-value pairs both
// QoS-related settings and other hw context configuration parameters.
// If hwctx was configured with string to integral key-value pairs,
// then the integral values are converted to strings.
XRT_CORE_COMMON_EXPORT
xrt::hw_context::cfg_type
get_cfg_map(const xrt::hw_context& hwctx);

}} // hw_context_int, xrt_core
} // xrt_core::hw_context_int

#endif
43 changes: 33 additions & 10 deletions src/runtime_src/core/common/api/kernel_int.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2020 Xilinx, Inc
// Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.
// Copyright (C) 2022-2026 Advanced Micro Devices, Inc. All rights reserved.
//
// Xilinx Runtime (XRT) Experimental APIs

Expand All @@ -24,7 +24,7 @@ namespace xrt_core::xdp {
struct xrt_kernel_data;
}

namespace xrt_core { namespace kernel_int {
namespace xrt_core::kernel_int {

// Provide access to kdma command based BO copy Used by xrt::bo::copy.
// Arguably this should implemented by by shim->copy_bo, but must wait
Expand Down Expand Up @@ -88,18 +88,41 @@ XRT_CORE_COMMON_EXPORT
size_t
get_regmap_size(const xrt::kernel& kernel);

// Get hw ctx using which this kernel is created
// get_instance_name() - Get the kernel instance name
// Return the name used to create the kernel before it is stripped to
// remove instance identifier part. In xclbin flow, this name is not
// necessarily an instance name, but in ELF flow it uniquely
// identifies a kernel instance.
std::string
get_instance_name(const xrt::kernel&);

// get_hwctx() - Get hwctx in which this kernel is created
xrt::hw_context
get_hw_ctx(const xrt::kernel& kernel);
get_hwctx(const xrt::kernel& kernel);

// get_ctrlcode() - Get kernel ctrlcode
// For kernels created from legacy xrt::module
xrt::elf
get_ctrlcode(const xrt::kernel&);

// Get hw ctx using which this kernel is created
// get_hwctx() - Get hwctx in which the run kernel is created
XRT_CORE_COMMON_EXPORT
xrt::hw_context
get_hw_ctx(const xrt::run&);
get_hwctx(const xrt::run&);

// Allows the creation of the kernel object from a kernel_impl pointer
// This is used for logging usage mertrics
// get_kernel() - Get xrt::kernel fron which run is created
xrt::kernel
create_kernel_from_implementation(const xrt::kernel_impl* kernel_impl);
get_kernel(const xrt::run&);

// get_kernel_from_impl() - wrap impl in an xrt::kernel
// Returns xrt::kernel created from shared kernel_impl.
xrt::kernel
get_kernel_from_impl(const xrt::kernel_impl* kernel_impl);

// get_run_from_impl() - wrap impl in an xrt::run
// Returns xrt::run created from shared run_impl.
xrt::run
get_run_from_impl(const xrt::run_impl*);

// Fill XDP kernel data from a run_impl pointer for profiling hooks
XRT_CORE_COMMON_EXPORT
Expand All @@ -112,6 +135,6 @@ XRT_CORE_COMMON_EXPORT
void
set_dtrace_control_file(xrt::run_impl* run_impl, const std::string& path);

}} // kernel_int, xrt_core
} // xrt_core::kernel_int

#endif
20 changes: 14 additions & 6 deletions src/runtime_src/core/common/api/xclbin_int.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2021 Xilinx, Inc. All rights reserved.
*/
#ifndef _XRT_COMMON_XCLBIN_INT_H_
#define _XRT_COMMON_XCLBIN_INT_H_
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2021 Xilinx, Inc. All rights reserved.
// Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved.
#ifndef XRT_COMMON_XCLBIN_INT_H_
#define XRT_COMMON_XCLBIN_INT_H_

// This file defines implementation extensions to the XRT XCLBIN APIs.
#include "core/include/xrt/experimental/xrt_xclbin.h"

#include "core/common/config.h"
#include "core/common/xclbin_parser.h"

#include "xrt/detail/span.h"

#include <cstring>
#include <string>
#include <vector>
Expand All @@ -20,6 +21,9 @@
// XRT core implementation.
namespace xrt_core { namespace xclbin_int {

template<typename T>
using span = xrt::detail::span<T>;

// get_axlf() - Retrieve complete axlf from handle
const axlf*
get_axlf(xrtXclbinHandle);
Expand All @@ -41,6 +45,10 @@ get_axlf_sections(const xrt::xclbin& xclbin, axlf_section_kind kind);
std::vector<char>
read_xclbin(const std::string& fnm);

// get_xclbin_data() - Access raw xclbin data
span<const char>
get_xclbin_data(const xrt::xclbin&);

// get_properties() - Get kernel properties
XRT_CORE_COMMON_EXPORT
const xrt_core::xclbin::kernel_properties&
Expand Down
28 changes: 26 additions & 2 deletions src/runtime_src/core/common/api/xrt_bo.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2020-2022 Xilinx, Inc
// Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
// Copyright (C) 2022-2026 Advanced Micro Devices, Inc. All rights reserved.

// This file implements XRT BO APIs as declared in
// core/include/experimental/xrt_bo.h
Expand Down Expand Up @@ -30,6 +30,7 @@
#include "core/common/unistd.h"
#include "core/common/xclbin_parser.h"

#include "core/common/runner/capture.h"
#include "core/common/shim/buffer_handle.h"
#include "core/common/shim/shared_handle.h"

Expand Down Expand Up @@ -199,7 +200,7 @@ namespace xrt {
//
// Life time of buffers are managed through shared pointers.
// A buffer is freed when last references is released.
class bo_impl
class bo_impl : public std::enable_shared_from_this<bo_impl>
{
public:
using export_handle = xrt_core::shared_handle::export_handle;
Expand Down Expand Up @@ -246,6 +247,18 @@ class bo_impl
: size(sz)
{}

std::shared_ptr<bo_impl>
get_shared_ptr()
{
return shared_from_this();
}

std::shared_ptr<bo_impl>
get_mutable_shared_ptr() const
{
return std::const_pointer_cast<bo_impl>(shared_from_this());
}

// Managed handle shared with another bo_impl
bo_impl(device_type dev, std::shared_ptr<xrt_core::buffer_handle> bhdl, size_t sz)
: device(std::move(dev))
Expand Down Expand Up @@ -482,6 +495,8 @@ class bo_impl
// if (get_flags() != bo::flags::host_only)
handle->sync(static_cast<xrt_core::buffer_handle::direction>(dir), sz, offset);
m_usage_logger->log_buffer_sync(device->get_device_id(), device.get_hwctx_handle(), sz, dir);

XRT_REPLAY_CAPTURE(bo_sync, this, static_cast<int>(dir));
Comment thread
stsoe marked this conversation as resolved.
}

virtual uint64_t
Expand Down Expand Up @@ -957,6 +972,8 @@ class buffer_sub : public bo_impl

// sync through parent buffer, which handles nodma case also
m_parent->sync(dir, sz, off);

XRT_REPLAY_CAPTURE(bo_sync, this, static_cast<int>(dir));
Comment thread
stsoe marked this conversation as resolved.
}
};

Expand Down Expand Up @@ -1804,6 +1821,13 @@ unconfig_bo(const xrt::bo& bo, const xrt_core::hwctx_handle* ctx_handle)
: bo_impl->get_handle()->unconfig(bo_impl->get_hwctx_handle());
}

xrt::bo
get_bo_from_impl(const xrt::bo_impl* bo_impl)
{
return bo_impl->get_mutable_shared_ptr();
}


} // xrt_core::bo_int

////////////////////////////////////////////////////////////////
Expand Down
23 changes: 19 additions & 4 deletions src/runtime_src/core/common/api/xrt_elf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "core/common/message.h"
#include "core/common/trace.h"
#include "core/common/xclbin_parser.h"
#include "core/common/runner/capture.h"

#include <boost/interprocess/streams/bufferstream.hpp>
#include <elfio/elfio.hpp>
Expand Down Expand Up @@ -220,6 +221,7 @@ load_elfio(std::istream& stream)
ELFIO::elfio elfio;
if (!elfio.load(stream))
throw std::runtime_error("not a valid ELF stream");

return elfio;
}

Expand All @@ -231,6 +233,7 @@ load_elfio(const void* data, size_t size)
boost::interprocess::ibufferstream istr(static_cast<const char*>(data), size);
if (!elfio.load(istr))
throw std::runtime_error("not valid ELF data");

return elfio;
}

Expand Down Expand Up @@ -1512,22 +1515,34 @@ valid_or_error(const std::shared_ptr<elf_impl>& handle)
elf::
elf(const std::string& fnm)
: detail::pimpl<elf_impl>{create_elf_impl(load_elfio(fnm), fnm)}
{}
{
// ELFIO cannot be post dumped. Track elf_impl to elf data
XRT_REPLAY_CAPTURE(elf_ctor, handle.get(), fnm);
Comment thread
stsoe marked this conversation as resolved.
}

elf::
elf(std::istream& stream)
: detail::pimpl<elf_impl>{create_elf_impl(load_elfio(stream))}
{}
{
// ELFIO cannot be post dumped. Track elf_impl to elf data
XRT_REPLAY_CAPTURE(elf_ctor, handle.get(), stream);
Comment thread
stsoe marked this conversation as resolved.
}

elf::
elf(const void* data, size_t size)
: detail::pimpl<elf_impl>{create_elf_impl(load_elfio(data, size))}
{}
{
// ELFIO cannot be post dumped. Track elf_impl to elf data
XRT_REPLAY_CAPTURE(elf_ctor, handle.get(), data, size);
Comment thread
stsoe marked this conversation as resolved.
}

elf::
elf(const std::string_view& sv)
: detail::pimpl<elf_impl>{create_elf_impl(load_elfio(sv.data(), sv.size()))}
{}
{
// ELFIO cannot be post dumped. Track elf_impl to elf data
XRT_REPLAY_CAPTURE(elf_ctor, handle.get(), sv.data(), sv.size());
Comment thread
stsoe marked this conversation as resolved.
}

xrt::uuid
elf::
Expand Down
Loading
Loading