rocr/xdna-driver: Initial support for amdxdna driver
Change-Id: I319b55d89dc644e7151228cb6c19d1a633171295
[ROCm/ROCR-Runtime commit: 86f40ae489]
This commit is contained in:
1 parent
a7b0f541b7
commit
c75f2d749d
9 files changed
+906
-13
No files matched your search
@@ -72,6 +72,12 @@ namespace AMD {
|
||||
static const uint kKfdVersionMajor = 0;
|
||||
static const uint kKfdVersionMinor = 99;
|
||||
|
||||
void DiscoverDrivers(bool &gpu_found, bool &aie_found) {
|
||||
// Open connection to GPU and AIE kernel drivers.
|
||||
gpu_found = (hsaKmtOpenKFD() == HSAKMT_STATUS_SUCCESS);
|
||||
aie_found = (XdnaDriver::DiscoverDriver() == HSA_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
// Query for user preference and use that to determine Xnack mode of ROCm system.
|
||||
// Return true if Xnack mode is ON or false if OFF. Xnack mode of a system is
|
||||
// orthogonal to devices that do not support Xnack mode. It is legal for a
|
||||
@@ -419,13 +425,10 @@ void BuildTopology() {
|
||||
}
|
||||
|
||||
bool Load() {
|
||||
bool gpu_found = true;
|
||||
bool gpu_found = false;
|
||||
bool aie_found = false;
|
||||
|
||||
// Open connection to kernel driver.
|
||||
if (hsaKmtOpenKFD() != HSAKMT_STATUS_SUCCESS) {
|
||||
gpu_found = false;
|
||||
}
|
||||
DiscoverDrivers(gpu_found, aie_found);
|
||||
|
||||
if (!(gpu_found || aie_found)) {
|
||||
return false;
|
||||
|
||||
@@ -244,6 +244,11 @@ void Runtime::RegisterAgent(Agent* agent, bool Enabled) {
|
||||
}
|
||||
}
|
||||
|
||||
// Register driver.
|
||||
void Runtime::RegisterDriver(std::unique_ptr<Driver> &driver) {
|
||||
agent_drivers_.push_back(std::move(driver));
|
||||
}
|
||||
|
||||
void Runtime::DestroyAgents() {
|
||||
agents_by_node_.clear();
|
||||
|
||||
@@ -267,6 +272,14 @@ void Runtime::DestroyAgents() {
|
||||
system_regions_coarse_.clear();
|
||||
}
|
||||
|
||||
void Runtime::DestroyDrivers() {
|
||||
for (auto &d : agent_drivers_) {
|
||||
d->Close();
|
||||
}
|
||||
|
||||
agent_drivers_.clear();
|
||||
}
|
||||
|
||||
void Runtime::SetLinkCount(size_t num_nodes) {
|
||||
num_nodes_ = num_nodes;
|
||||
link_matrix_.resize(num_nodes * num_nodes);
|
||||
@@ -2062,6 +2075,8 @@ void Runtime::Unload() {
|
||||
|
||||
CloseTools();
|
||||
|
||||
DestroyDrivers();
|
||||
|
||||
AMD::Unload();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user