Skip to content

Commit

Permalink
CID-369005, CID-369006: Amend #8198 with missing essential operators (#…
Browse files Browse the repository at this point in the history
…8207)

Add default copy, move ctor and assignment to classes where explicit
dtor was added in #8198.

An explicit dtor implies the object is not trivially destructed, hence
compiler cannot assume the object can betrivially moved or maybe even
assigned.  Alas, full slew of essential operators must be explicitly
defined.

PR #8198 added explicit dtor to bo, device, hw_context, kernel and
run. This PR adds the essential operators to those that did not
already have them.

Signed-off-by: Soren Soe <[email protected]>
  • Loading branch information
stsoe authored May 31, 2024
1 parent 002c55c commit 05659f0
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 29 deletions.
11 changes: 0 additions & 11 deletions src/runtime_src/core/common/api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.

# if (CMAKE_BUILD_TYPE STREQUAL "Debug")
# find_program(CLANG_TIDY "clang-tidy" HINT /home/stsoe/git-nobkup/llvm-project/build)
# if(NOT CLANG_TIDY)
# message(WARNING "-- clang-tidy not found, cannot enable static analysis")
# else()
# message("-- Enabling clang-tidy")
# set(CMAKE_CXX_CLANG_TIDY "/home/stsoe/git-nobkup/llvm-project/build/bin/clang-tidy")
# endif()
# endif()

add_library(core_common_api_library_objects OBJECT
context_mgr.cpp
hw_queue.cpp
Expand Down
34 changes: 28 additions & 6 deletions src/runtime_src/core/include/xrt/xrt_hw_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ class hw_context : public detail::pimpl<hw_context_impl>
*/
hw_context() = default;

/**
* ~hw_context() - Destructor
*/
XCL_DRIVER_DLLESPEC
~hw_context();

/**
* hw_context() - Constructor with QoS control
*
Expand Down Expand Up @@ -126,6 +120,34 @@ class hw_context : public detail::pimpl<hw_context_impl>
{}
/// @endcond

/**
* hw_context() - Copy ctor
*/
hw_context(const hw_context&) = default;

/**
* hw_context() - Move ctor
*/
hw_context(hw_context&&) = default;

/**
* ~hw_context() - Destructor
*/
XCL_DRIVER_DLLESPEC
~hw_context();

/**
* operator= () - Copy assignment
*/
hw_context&
operator=(const hw_context&) = default;

/**
* operator= () - Move assignment
*/
hw_context&
operator=(hw_context&&) = default;

///@cond
// Undocument experimental API to change the QoS of a hardware context
// Subject to change or removal
Expand Down
68 changes: 56 additions & 12 deletions src/runtime_src/core/include/xrt/xrt_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,6 @@ class run
*/
run() = default;

/**
* ~run() - Destruct run object
*/
XCL_DRIVER_DLLESPEC
~run();

/**
* run() - Construct run object from a kernel object
*
Expand All @@ -145,6 +139,34 @@ class run
explicit
run(const kernel& krnl);

/**
* run() - Copy ctor
*/
run(const run&) = default;

/**
* run() - Move ctor
*/
run(run&&) = default;

/**
* ~run() - Destruct run object
*/
XCL_DRIVER_DLLESPEC
~run();

/**
* operator= () - Copy assignment
*/
run&
operator=(const run&) = default;

/**
* operator= () - Move assignment
*/
run&
operator=(run&&) = default;

/**
* start() - Start one execution of a run.
*
Expand Down Expand Up @@ -676,12 +698,6 @@ class kernel
*/
kernel() = default;

/**
* Destructor for kernel - needed for tracing
*/
XCL_DRIVER_DLLESPEC
~kernel();

/**
* kernel() - Constructor from a device and xclbin
*
Expand Down Expand Up @@ -727,6 +743,34 @@ class kernel
cu_access_mode mode = cu_access_mode::shared);
/// @endcond

/**
* kernel() - Copy ctor
*/
kernel(const kernel&) = default;

/**
* kernel() - Move ctor
*/
kernel(kernel&&) = default;

/**
* Destructor for kernel - needed for tracing
*/
XCL_DRIVER_DLLESPEC
~kernel();

/**
* operator= () - Copy assignment
*/
kernel&
operator=(const kernel&) = default;

/**
* operator= () - Move assignment
*/
kernel&
operator=(kernel&&) = default;

/**
* operator() - Invoke the kernel function
*
Expand Down

0 comments on commit 05659f0

Please sign in to comment.