Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
rocm_bandwidth_test
Commits
bd07a451
Unverified
Commit
bd07a451
authored
Mar 14, 2018
by
rerrabolu
Committed by
GitHub
Mar 14, 2018
Browse files
Merge pull request #14 from RadeonOpenCompute/addNumaDist
Add hop distances in computing Numa distance
parents
d4799ef9
feb1bc10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
16 deletions
+33
-16
rocm_bandwidth_test.hpp
rocm_bandwidth_test.hpp
+1
-0
rocm_bandwidth_test_topology.cpp
rocm_bandwidth_test_topology.cpp
+32
-16
No files found.
rocm_bandwidth_test.hpp
View file @
bd07a451
...
@@ -207,6 +207,7 @@ class RocmBandwidthTest : public BaseTest {
...
@@ -207,6 +207,7 @@ class RocmBandwidthTest : public BaseTest {
// @brief: Populate link weight for the set of agents
// @brief: Populate link weight for the set of agents
void
DiscoverLinkWeight
();
void
DiscoverLinkWeight
();
void
BindLinkWeight
(
uint32_t
idx1
,
uint32_t
idx2
);
// @brief: Populates the access matrix
// @brief: Populates the access matrix
void
PopulateAccessMatrix
();
void
PopulateAccessMatrix
();
...
...
rocm_bandwidth_test_topology.cpp
View file @
bd07a451
...
@@ -270,6 +270,37 @@ void RocmBandwidthTest::DiscoverTopology() {
...
@@ -270,6 +270,37 @@ void RocmBandwidthTest::DiscoverTopology() {
DiscoverLinkWeight
();
DiscoverLinkWeight
();
}
}
void
RocmBandwidthTest
::
BindLinkWeight
(
uint32_t
idx1
,
uint32_t
idx2
)
{
// Agent has no pools so no need to look for numa distance
if
(
agent_pool_list_
[
idx2
].
pool_list
.
size
()
==
0
)
{
return
;
}
uint32_t
hops
=
0
;
hsa_agent_t
agent1
=
agent_list_
[
idx1
].
agent_
;
hsa_amd_memory_pool_t
&
pool
=
agent_pool_list_
[
idx2
].
pool_list
[
0
].
pool_
;
err_
=
hsa_amd_agent_memory_pool_get_info
(
agent1
,
pool
,
HSA_AMD_AGENT_MEMORY_POOL_INFO_NUM_LINK_HOPS
,
&
hops
);
if
(
hops
<
1
)
{
link_matrix_
[(
idx1
*
agent_index_
)
+
idx2
]
=
0xFFFFFFFF
;
return
;
}
hsa_amd_memory_pool_link_info_t
*
link_info
;
uint32_t
link_info_sz
=
hops
*
sizeof
(
hsa_amd_memory_pool_link_info_t
);
link_info
=
(
hsa_amd_memory_pool_link_info_t
*
)
malloc
(
link_info_sz
);
memset
(
link_info
,
0
,
(
hops
*
sizeof
(
hsa_amd_memory_pool_link_info_t
)));
err_
=
hsa_amd_agent_memory_pool_get_info
(
agent1
,
pool
,
HSA_AMD_AGENT_MEMORY_POOL_INFO_LINK_INFO
,
link_info
);
link_matrix_
[(
idx1
*
agent_index_
)
+
idx2
]
=
0
;
for
(
uint32_t
hopIdx
=
0
;
hopIdx
<
hops
;
hopIdx
++
)
{
link_matrix_
[(
idx1
*
agent_index_
)
+
idx2
]
+=
(
link_info
[
hopIdx
]).
numa_distance
;
}
free
(
link_info
);
}
void
RocmBandwidthTest
::
DiscoverLinkWeight
()
{
void
RocmBandwidthTest
::
DiscoverLinkWeight
()
{
// Allocate space if it is first time
// Allocate space if it is first time
...
@@ -278,28 +309,13 @@ void RocmBandwidthTest::DiscoverLinkWeight() {
...
@@ -278,28 +309,13 @@ void RocmBandwidthTest::DiscoverLinkWeight() {
}
}
agent_info_t
agent_info
;
agent_info_t
agent_info
;
hsa_agent_t
agent1
;
hsa_amd_memory_pool_link_info_t
link_info
=
{
0
};
for
(
uint32_t
idx1
=
0
;
idx1
<
agent_index_
;
idx1
++
)
{
for
(
uint32_t
idx1
=
0
;
idx1
<
agent_index_
;
idx1
++
)
{
agent1
=
agent_list_
[
idx1
].
agent_
;
for
(
uint32_t
idx2
=
0
;
idx2
<
agent_index_
;
idx2
++
)
{
for
(
uint32_t
idx2
=
0
;
idx2
<
agent_index_
;
idx2
++
)
{
if
(
idx1
==
idx2
)
{
if
(
idx1
==
idx2
)
{
link_matrix_
[(
idx1
*
agent_index_
)
+
idx2
]
=
0
;
link_matrix_
[(
idx1
*
agent_index_
)
+
idx2
]
=
0
;
continue
;
continue
;
}
}
uint32_t
hops
=
0
;
BindLinkWeight
(
idx1
,
idx2
);
if
(
agent_pool_list_
[
idx2
].
pool_list
.
size
()
!=
0
)
{
hsa_amd_memory_pool_t
&
pool
=
agent_pool_list_
[
idx2
].
pool_list
[
0
].
pool_
;
err_
=
hsa_amd_agent_memory_pool_get_info
(
agent1
,
pool
,
HSA_AMD_AGENT_MEMORY_POOL_INFO_NUM_LINK_HOPS
,
&
hops
);
if
(
hops
>
0
)
{
err_
=
hsa_amd_agent_memory_pool_get_info
(
agent1
,
pool
,
HSA_AMD_AGENT_MEMORY_POOL_INFO_LINK_INFO
,
&
link_info
);
link_matrix_
[(
idx1
*
agent_index_
)
+
idx2
]
=
link_info
.
numa_distance
;
}
else
{
link_matrix_
[(
idx1
*
agent_index_
)
+
idx2
]
=
0xFFFFFFFF
;
}
}
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment