-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VITIS-11024 enable hw_context support for xrt::graph objects (#8340)
1) bo function calls sync / async added with hw ctx along with device specific 2) profiling functions added with hw ctx along with device specific Signed-off-by: Sravankumar allu <[email protected]> Signed-off-by: Sravankumar allu <[email protected]> Co-authored-by: Sravankumar allu <[email protected]>
- Loading branch information
1 parent
29767e0
commit 820a7bb
Showing
15 changed files
with
343 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights reserved. | ||
#ifndef XRT_CORE_PROFILE_HANDLE_H | ||
#define XRT_CORE_PROFILE_HANDLE_H | ||
|
||
#include <stdint.h> | ||
#include "core/common/error.h" | ||
|
||
namespace xrt_core { | ||
|
||
class profile_handle | ||
{ | ||
public: | ||
virtual int | ||
start(int, const char*, const char*, uint32_t) | ||
{ | ||
throw xrt_core::error(std::errc::not_supported, __func__); | ||
} | ||
|
||
virtual uint64_t | ||
read() | ||
{ | ||
throw xrt_core::error(std::errc::not_supported, __func__); | ||
} | ||
|
||
virtual void | ||
stop() | ||
{ | ||
throw xrt_core::error(std::errc::not_supported, __func__); | ||
} | ||
|
||
}; //profile_handle | ||
|
||
} //namespace xrt_core | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. | ||
#include "profile_object.h" | ||
#include "core/edge/user/shim.h" | ||
|
||
static inline | ||
std::string value_or_empty(const char* s) | ||
{ | ||
return s == nullptr ? "" : s; | ||
} | ||
|
||
namespace zynqaie { | ||
|
||
profile_object:: | ||
profile_object(ZYNQ::shim* shim, Aie* aie_array) | ||
: m_shim{shim}, | ||
m_aie_array{aie_array}, | ||
m_profile_id{invalid_profile_id} | ||
{} | ||
|
||
int | ||
profile_object:: | ||
start(int option, const char* port1Name, const char* port2Name, uint32_t value) | ||
{ | ||
auto device = xrt_core::get_userpf_device(m_shim); | ||
|
||
if (!m_aie_array->is_context_set()) { | ||
m_aie_array->open_context(device.get(), xrt::aie::access_mode::primary); | ||
} | ||
m_profile_id = m_aie_array->start_profiling(option, value_or_empty(port1Name), value_or_empty(port2Name), value); | ||
return m_profile_id; | ||
} | ||
|
||
uint64_t | ||
profile_object:: | ||
read() | ||
{ | ||
auto device = xrt_core::get_userpf_device(m_shim); | ||
|
||
if (!m_aie_array->is_context_set()) { | ||
m_aie_array->open_context(device.get(), xrt::aie::access_mode::primary); | ||
} | ||
return m_aie_array->read_profiling(m_profile_id); | ||
} | ||
|
||
void | ||
profile_object:: | ||
stop() | ||
{ | ||
auto device = xrt_core::get_userpf_device(m_shim); | ||
|
||
if (!m_aie_array->is_context_set()) { | ||
m_aie_array->open_context(device.get(), xrt::aie::access_mode::primary); | ||
} | ||
m_aie_array->stop_profiling(m_profile_id); | ||
} | ||
|
||
} //namespace zynqaie |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. | ||
#ifndef _ZYNQ_PROFILE_OBJECT_H_ | ||
#define _ZYNQ_PROFILE_OBJECT_H_ | ||
|
||
#include "core/common/shim/profile_handle.h" | ||
#include <string> | ||
|
||
namespace ZYNQ { | ||
|
||
class shim; | ||
|
||
} | ||
|
||
namespace zynqaie { | ||
|
||
class Aie; | ||
|
||
class profile_object : public xrt_core::profile_handle | ||
{ | ||
public: | ||
static constexpr int invalid_profile_id = -1; | ||
ZYNQ::shim* m_shim{nullptr}; | ||
Aie* m_aie_array{nullptr}; | ||
int m_profile_id; | ||
|
||
profile_object(ZYNQ::shim* shim, Aie* aie_array); | ||
|
||
int | ||
start(int option, const char* port1Name, const char* port2Name, uint32_t value) override; | ||
|
||
uint64_t | ||
read() override; | ||
|
||
void | ||
stop() override; | ||
|
||
}; //profile_object | ||
|
||
} // namespace zynqaie | ||
#endif |
Oops, something went wrong.