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
a1a217aa
Unverified
Commit
a1a217aa
authored
Feb 02, 2019
by
Ramesh Errabolu
Committed by
GitHub
Feb 02, 2019
Browse files
Merge pull request #28 from RadeonOpenCompute/fixBufferSizeType
Update data type used for buffer size
parents
8de8c1b2
0d790334
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
52 deletions
+57
-52
rocm_bandwidth_test.cpp
rocm_bandwidth_test.cpp
+23
-23
rocm_bandwidth_test.hpp
rocm_bandwidth_test.hpp
+18
-17
rocm_bandwidth_test_parse.cpp
rocm_bandwidth_test_parse.cpp
+4
-1
rocm_bandwidth_test_print.cpp
rocm_bandwidth_test_print.cpp
+3
-2
rocm_bandwidth_test_report.cpp
rocm_bandwidth_test_report.cpp
+1
-1
rocm_bandwidth_test_trans.cpp
rocm_bandwidth_test_trans.cpp
+4
-4
rocm_bandwidth_test_validate.cpp
rocm_bandwidth_test_validate.cpp
+4
-4
No files found.
rocm_bandwidth_test.cpp
View file @
a1a217aa
...
@@ -52,25 +52,25 @@
...
@@ -52,25 +52,25 @@
#include <limits>
#include <limits>
// The values are in megabytes at allocation time
// The values are in megabytes at allocation time
const
uint32
_t
RocmBandwidthTest
::
SIZE_LIST
[]
=
{
1
*
1024
,
const
size
_t
RocmBandwidthTest
::
SIZE_LIST
[]
=
{
1
*
1024
,
2
*
1024
,
4
*
1024
,
8
*
1024
,
2
*
1024
,
4
*
1024
,
8
*
1024
,
16
*
1024
,
32
*
1024
,
64
*
1024
,
16
*
1024
,
32
*
1024
,
64
*
1024
,
128
*
1024
,
256
*
1024
,
512
*
1024
,
128
*
1024
,
256
*
1024
,
512
*
1024
,
1
*
1024
*
1024
,
2
*
1024
*
1024
,
1
*
1024
*
1024
,
2
*
1024
*
1024
,
4
*
1024
*
1024
,
8
*
1024
*
1024
,
4
*
1024
*
1024
,
8
*
1024
*
1024
,
16
*
1024
*
1024
,
32
*
1024
*
1024
,
16
*
1024
*
1024
,
32
*
1024
*
1024
,
64
*
1024
*
1024
,
128
*
1024
*
1024
,
64
*
1024
*
1024
,
128
*
1024
*
1024
,
256
*
1024
*
1024
,
512
*
1024
*
1024
};
256
*
1024
*
1024
,
512
*
1024
*
1024
};
const
uint32
_t
RocmBandwidthTest
::
LATENCY_SIZE_LIST
[]
=
{
1
,
const
size
_t
RocmBandwidthTest
::
LATENCY_SIZE_LIST
[]
=
{
1
,
2
,
4
,
8
,
2
,
4
,
8
,
16
,
32
,
64
,
16
,
32
,
64
,
128
,
256
,
512
,
128
,
256
,
512
,
1
*
1024
,
2
*
1024
,
1
*
1024
,
2
*
1024
,
4
*
1024
,
8
*
1024
,
4
*
1024
,
8
*
1024
,
16
*
1024
,
32
*
1024
,
16
*
1024
,
32
*
1024
,
64
*
1024
,
128
*
1024
,
64
*
1024
,
128
*
1024
,
256
*
1024
,
512
*
1024
};
256
*
1024
,
512
*
1024
};
uint32_t
RocmBandwidthTest
::
GetIterationNum
()
{
uint32_t
RocmBandwidthTest
::
GetIterationNum
()
{
return
(
validate_
)
?
1
:
(
num_iteration_
*
1.2
+
1
);
return
(
validate_
)
?
1
:
(
num_iteration_
*
1.2
+
1
);
...
@@ -97,7 +97,7 @@ void RocmBandwidthTest::AcquirePoolAcceses(uint32_t src_dev_idx,
...
@@ -97,7 +97,7 @@ void RocmBandwidthTest::AcquirePoolAcceses(uint32_t src_dev_idx,
return
;
return
;
}
}
void
RocmBandwidthTest
::
AllocateHostBuffers
(
uint32
_t
size
,
void
RocmBandwidthTest
::
AllocateHostBuffers
(
size
_t
size
,
uint32_t
src_dev_idx
,
uint32_t
src_dev_idx
,
uint32_t
dst_dev_idx
,
uint32_t
dst_dev_idx
,
void
*&
src
,
void
*&
dst
,
void
*&
src
,
void
*&
dst
,
...
@@ -132,7 +132,7 @@ void RocmBandwidthTest::AllocateHostBuffers(uint32_t size,
...
@@ -132,7 +132,7 @@ void RocmBandwidthTest::AllocateHostBuffers(uint32_t size,
return
;
return
;
}
}
void
RocmBandwidthTest
::
AllocateCopyBuffers
(
uint32
_t
size
,
void
RocmBandwidthTest
::
AllocateCopyBuffers
(
size
_t
size
,
uint32_t
src_dev_idx
,
uint32_t
dst_dev_idx
,
uint32_t
src_dev_idx
,
uint32_t
dst_dev_idx
,
void
*&
src
,
hsa_amd_memory_pool_t
src_pool
,
void
*&
src
,
hsa_amd_memory_pool_t
src_pool
,
void
*&
dst
,
hsa_amd_memory_pool_t
dst_pool
,
void
*&
dst
,
hsa_amd_memory_pool_t
dst_pool
,
...
@@ -222,8 +222,8 @@ void RocmBandwidthTest::RunCopyBenchmark(async_trans_t& trans) {
...
@@ -222,8 +222,8 @@ void RocmBandwidthTest::RunCopyBenchmark(async_trans_t& trans) {
bool
bidir
=
trans
.
copy
.
bidir_
;
bool
bidir
=
trans
.
copy
.
bidir_
;
// Initialize size of buffer to equal the largest element of allocation
// Initialize size of buffer to equal the largest element of allocation
size_t
max_size
=
size_list_
.
back
();
uint32_t
size_len
=
size_list_
.
size
();
uint32_t
size_len
=
size_list_
.
size
();
uint32_t
max_size
=
size_list_
.
back
();
// Bind to resources such as pool and agents that are involved
// Bind to resources such as pool and agents that are involved
// in both forward and reverse copy operations
// in both forward and reverse copy operations
...
@@ -299,7 +299,7 @@ void RocmBandwidthTest::RunCopyBenchmark(async_trans_t& trans) {
...
@@ -299,7 +299,7 @@ void RocmBandwidthTest::RunCopyBenchmark(async_trans_t& trans) {
for
(
uint32_t
idx
=
0
;
idx
<
size_len
;
idx
++
)
{
for
(
uint32_t
idx
=
0
;
idx
<
size_len
;
idx
++
)
{
// This should not be happening
// This should not be happening
uint32
_t
curr_size
=
size_list_
[
idx
];
size
_t
curr_size
=
size_list_
[
idx
];
if
(
curr_size
>
max_size
)
{
if
(
curr_size
>
max_size
)
{
break
;
break
;
}
}
...
...
rocm_bandwidth_test.hpp
View file @
a1a217aa
...
@@ -268,16 +268,16 @@ class RocmBandwidthTest : public BaseTest {
...
@@ -268,16 +268,16 @@ class RocmBandwidthTest : public BaseTest {
bool
ValidateArguments
();
bool
ValidateArguments
();
bool
ValidateReadReq
();
bool
ValidateReadReq
();
bool
ValidateWriteReq
();
bool
ValidateWriteReq
();
bool
ValidateReadOrWriteReq
(
vector
<
uint32
_t
>&
in_list
);
bool
ValidateReadOrWriteReq
(
vector
<
size
_t
>&
in_list
);
bool
ValidateBidirCopyReq
();
bool
ValidateBidirCopyReq
();
bool
ValidateUnidirCopyReq
();
bool
ValidateUnidirCopyReq
();
bool
ValidateCopyReq
(
vector
<
uint32
_t
>&
in_list
);
bool
ValidateCopyReq
(
vector
<
size
_t
>&
in_list
);
void
PrintIOAccessError
(
uint32_t
agent_idx
,
uint32_t
pool_idx
);
void
PrintIOAccessError
(
uint32_t
agent_idx
,
uint32_t
pool_idx
);
void
PrintCopyAccessError
(
uint32_t
src_pool_idx
,
uint32_t
dst_pool_idx
);
void
PrintCopyAccessError
(
uint32_t
src_pool_idx
,
uint32_t
dst_pool_idx
);
bool
PoolIsPresent
(
vector
<
uint32
_t
>&
in_list
);
bool
PoolIsPresent
(
vector
<
size
_t
>&
in_list
);
bool
PoolIsDuplicated
(
vector
<
uint32
_t
>&
in_list
);
bool
PoolIsDuplicated
(
vector
<
size
_t
>&
in_list
);
// @brief: Builds a list of transaction per user request
// @brief: Builds a list of transaction per user request
void
ComputeCopyTime
(
async_trans_t
&
trans
);
void
ComputeCopyTime
(
async_trans_t
&
trans
);
...
@@ -289,12 +289,12 @@ class RocmBandwidthTest : public BaseTest {
...
@@ -289,12 +289,12 @@ class RocmBandwidthTest : public BaseTest {
bool
BuildAllPoolsBidirCopyTrans
();
bool
BuildAllPoolsBidirCopyTrans
();
bool
BuildAllPoolsUnidirCopyTrans
();
bool
BuildAllPoolsUnidirCopyTrans
();
bool
BuildReadOrWriteTrans
(
uint32_t
req_type
,
bool
BuildReadOrWriteTrans
(
uint32_t
req_type
,
vector
<
uint32
_t
>&
in_list
);
vector
<
size
_t
>&
in_list
);
bool
BuildCopyTrans
(
uint32_t
req_type
,
bool
BuildCopyTrans
(
uint32_t
req_type
,
vector
<
uint32
_t
>&
src_list
,
vector
<
size
_t
>&
src_list
,
vector
<
uint32
_t
>&
dst_list
);
vector
<
size
_t
>&
dst_list
);
void
AllocateCopyBuffers
(
uint32
_t
size
,
void
AllocateCopyBuffers
(
size
_t
size
,
uint32_t
src_dev_idx
,
uint32_t
dst_dev_idx
,
uint32_t
src_dev_idx
,
uint32_t
dst_dev_idx
,
void
*&
src
,
hsa_amd_memory_pool_t
src_pool
,
void
*&
src
,
hsa_amd_memory_pool_t
src_pool
,
void
*&
dst
,
hsa_amd_memory_pool_t
dst_pool
,
void
*&
dst
,
hsa_amd_memory_pool_t
dst_pool
,
...
@@ -305,7 +305,7 @@ class RocmBandwidthTest : public BaseTest {
...
@@ -305,7 +305,7 @@ class RocmBandwidthTest : public BaseTest {
void
*
dst_fwd
,
void
*
dst_rev
,
void
*
dst_fwd
,
void
*
dst_rev
,
hsa_signal_t
signal_fwd
,
hsa_signal_t
signal_rev
);
hsa_signal_t
signal_fwd
,
hsa_signal_t
signal_rev
);
double
GetGpuCopyTime
(
bool
bidir
,
hsa_signal_t
signal_fwd
,
hsa_signal_t
signal_rev
);
double
GetGpuCopyTime
(
bool
bidir
,
hsa_signal_t
signal_fwd
,
hsa_signal_t
signal_rev
);
void
AllocateHostBuffers
(
uint32
_t
size
,
void
AllocateHostBuffers
(
size
_t
size
,
uint32_t
src_dev_idx
,
uint32_t
src_dev_idx
,
uint32_t
dst_dev_idx
,
uint32_t
dst_dev_idx
,
void
*&
src
,
void
*&
dst
,
void
*&
src
,
void
*&
dst
,
...
@@ -352,6 +352,7 @@ class RocmBandwidthTest : public BaseTest {
...
@@ -352,6 +352,7 @@ class RocmBandwidthTest : public BaseTest {
// Used to pack space for structure alignment
// Used to pack space for structure alignment
uint32_t
reserved
;
uint32_t
reserved
;
};
};
RocmBandwidthVersion
version_
;
RocmBandwidthVersion
version_
;
void
PrintVersion
()
const
;
void
PrintVersion
()
const
;
std
::
string
GetVersion
()
const
;
std
::
string
GetVersion
()
const
;
...
@@ -377,31 +378,31 @@ class RocmBandwidthTest : public BaseTest {
...
@@ -377,31 +378,31 @@ class RocmBandwidthTest : public BaseTest {
// List of agents involved in a bidrectional copy operation
// List of agents involved in a bidrectional copy operation
// Size of the list cannot exceed the number of agents
// Size of the list cannot exceed the number of agents
// reported by the system
// reported by the system
vector
<
uint32
_t
>
bidir_list_
;
vector
<
size
_t
>
bidir_list_
;
// List of source agents in a unidrectional copy operation
// List of source agents in a unidrectional copy operation
// Size of the list cannot exceed the number of agents
// Size of the list cannot exceed the number of agents
// reported by the system
// reported by the system
vector
<
uint32
_t
>
src_list_
;
vector
<
size
_t
>
src_list_
;
// List of destination agents in a unidrectional copy operation
// List of destination agents in a unidrectional copy operation
// Size of the list cannot exceed the number of agents
// Size of the list cannot exceed the number of agents
// reported by the system
// reported by the system
vector
<
uint32
_t
>
dst_list_
;
vector
<
size
_t
>
dst_list_
;
// List of agents involved in read operation. Has
// List of agents involved in read operation. Has
// two agents, the first agent hosts the memory pool
// two agents, the first agent hosts the memory pool
// while the second agent executes the read operation
// while the second agent executes the read operation
vector
<
uint32
_t
>
read_list_
;
vector
<
size
_t
>
read_list_
;
// List of agents involved in write operation. Has
// List of agents involved in write operation. Has
// two agents, the first agent hosts the memory pool
// two agents, the first agent hosts the memory pool
// while the second agent executes the write operation
// while the second agent executes the write operation
vector
<
uint32
_t
>
write_list_
;
vector
<
size
_t
>
write_list_
;
// List of sizes to use in copy and read/write transactions
// List of sizes to use in copy and read/write transactions
// Size is specified in terms of Megabytes
// Size is specified in terms of Megabytes
vector
<
uint32
_t
>
size_list_
;
vector
<
size
_t
>
size_list_
;
// Type of service requested by user
// Type of service requested by user
uint32_t
req_read_
;
uint32_t
req_read_
;
...
@@ -469,8 +470,8 @@ class RocmBandwidthTest : public BaseTest {
...
@@ -469,8 +470,8 @@ class RocmBandwidthTest : public BaseTest {
// System region
// System region
hsa_amd_memory_pool_t
sys_pool_
;
hsa_amd_memory_pool_t
sys_pool_
;
static
const
uint32
_t
SIZE_LIST
[
20
];
static
const
size
_t
SIZE_LIST
[
20
];
static
const
uint32
_t
LATENCY_SIZE_LIST
[
20
];
static
const
size
_t
LATENCY_SIZE_LIST
[
20
];
// Exit value to return in case of error
// Exit value to return in case of error
int32_t
exit_value_
;
int32_t
exit_value_
;
...
...
rocm_bandwidth_test_parse.cpp
View file @
a1a217aa
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
// Parse option value string. The string has one more decimal
// Parse option value string. The string has one more decimal
// values separated by comma - "3,6,9,12,15".
// values separated by comma - "3,6,9,12,15".
static
bool
ParseOptionValue
(
char
*
value
,
vector
<
uint32
_t
>&
value_list
)
{
static
bool
ParseOptionValue
(
char
*
value
,
vector
<
size
_t
>&
value_list
)
{
// Capture the option value string
// Capture the option value string
std
::
stringstream
stream
;
std
::
stringstream
stream
;
...
@@ -60,6 +60,9 @@ static bool ParseOptionValue(char* value, vector<uint32_t>&value_list) {
...
@@ -60,6 +60,9 @@ static bool ParseOptionValue(char* value, vector<uint32_t>&value_list) {
// Read the option value
// Read the option value
stream
>>
token
;
stream
>>
token
;
if
(
stream
.
fail
())
{
exit
(
-
1
);
}
// Update output list with values
// Update output list with values
value_list
.
push_back
(
token
);
value_list
.
push_back
(
token
);
...
...
rocm_bandwidth_test_print.cpp
View file @
a1a217aa
...
@@ -169,9 +169,12 @@ void RocmBandwidthTest::PrintAccessMatrix() const {
...
@@ -169,9 +169,12 @@ void RocmBandwidthTest::PrintAccessMatrix() const {
for
(
uint32_t
dst_idx
=
0
;
dst_idx
<
agent_index_
;
dst_idx
++
)
{
for
(
uint32_t
dst_idx
=
0
;
dst_idx
<
agent_index_
;
dst_idx
++
)
{
uint32_t
path_exists
=
access_matrix_
[(
src_idx
*
agent_index_
)
+
dst_idx
];
uint32_t
path_exists
=
access_matrix_
[(
src_idx
*
agent_index_
)
+
dst_idx
];
std
::
cout
.
width
(
format
);
std
::
cout
.
width
(
format
);
/* Remove this block - as it is not always correct
* i.e. access path can be asymmetric
if (path_exists == 2) {
if (path_exists == 2) {
path_exists = 1;
path_exists = 1;
}
}
*/
std
::
cout
<<
path_exists
;
std
::
cout
<<
path_exists
;
}
}
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
...
@@ -309,8 +312,6 @@ void RocmBandwidthTest::PrintCopyAccessError(uint32_t src_idx, uint32_t dst_idx)
...
@@ -309,8 +312,6 @@ void RocmBandwidthTest::PrintCopyAccessError(uint32_t src_idx, uint32_t dst_idx)
hsa_device_type_t
dst_dev_type
=
agent_list_
[
dst_dev_idx
].
device_type_
;
hsa_device_type_t
dst_dev_type
=
agent_list_
[
dst_dev_idx
].
device_type_
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
//std::cout << "Index of Src Memory: " << src_idx << std::endl;
//std::cout << "Index of Dst Memory: " << dst_idx << std::endl;
std
::
cout
<<
"Src Device: Index "
std
::
cout
<<
"Src Device: Index "
<<
src_dev_idx
<<
src_dev_idx
<<
", Type: "
<<
", Type: "
...
...
rocm_bandwidth_test_report.cpp
View file @
a1a217aa
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
#include <sstream>
#include <sstream>
#include <algorithm>
#include <algorithm>
static
void
printRecord
(
uint32
_t
size
,
double
avg_time
,
static
void
printRecord
(
size
_t
size
,
double
avg_time
,
double
avg_bandwidth
,
double
min_time
,
double
avg_bandwidth
,
double
min_time
,
double
peak_bandwidth
)
{
double
peak_bandwidth
)
{
...
...
rocm_bandwidth_test_trans.cpp
View file @
a1a217aa
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
#include "rocm_bandwidth_test.hpp"
#include "rocm_bandwidth_test.hpp"
bool
RocmBandwidthTest
::
BuildReadOrWriteTrans
(
uint32_t
req_type
,
bool
RocmBandwidthTest
::
BuildReadOrWriteTrans
(
uint32_t
req_type
,
vector
<
uint32
_t
>&
in_list
)
{
vector
<
size
_t
>&
in_list
)
{
// Validate the list of pool-agent tuples
// Validate the list of pool-agent tuples
hsa_status_t
status
;
hsa_status_t
status
;
...
@@ -118,8 +118,8 @@ bool RocmBandwidthTest::FilterCpuPool(uint32_t req_type,
...
@@ -118,8 +118,8 @@ bool RocmBandwidthTest::FilterCpuPool(uint32_t req_type,
}
}
bool
RocmBandwidthTest
::
BuildCopyTrans
(
uint32_t
req_type
,
bool
RocmBandwidthTest
::
BuildCopyTrans
(
uint32_t
req_type
,
vector
<
uint32
_t
>&
src_list
,
vector
<
size
_t
>&
src_list
,
vector
<
uint32
_t
>&
dst_list
)
{
vector
<
size
_t
>&
dst_list
)
{
// bool filter_out;
// bool filter_out;
uint32_t
src_size
=
src_list
.
size
();
uint32_t
src_size
=
src_list
.
size
();
...
@@ -281,7 +281,7 @@ void RocmBandwidthTest::ComputeCopyTime(async_trans_t& trans) {
...
@@ -281,7 +281,7 @@ void RocmBandwidthTest::ComputeCopyTime(async_trans_t& trans) {
double
avg_time
=
0
;
double
avg_time
=
0
;
double
min_time
=
0
;
double
min_time
=
0
;
uint32
_t
data_size
=
0
;
size
_t
data_size
=
0
;
double
avg_bandwidth
=
0
;
double
avg_bandwidth
=
0
;
double
peak_bandwidth
=
0
;
double
peak_bandwidth
=
0
;
uint32_t
size_len
=
size_list_
.
size
();
uint32_t
size_len
=
size_list_
.
size
();
...
...
rocm_bandwidth_test_validate.cpp
View file @
a1a217aa
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
#include <cctype>
#include <cctype>
#include <sstream>
#include <sstream>
bool
RocmBandwidthTest
::
PoolIsPresent
(
vector
<
uint32
_t
>&
in_list
)
{
bool
RocmBandwidthTest
::
PoolIsPresent
(
vector
<
size
_t
>&
in_list
)
{
bool
is_present
;
bool
is_present
;
uint32_t
idx1
=
0
;
uint32_t
idx1
=
0
;
...
@@ -72,7 +72,7 @@ bool RocmBandwidthTest::PoolIsPresent(vector<uint32_t>& in_list) {
...
@@ -72,7 +72,7 @@ bool RocmBandwidthTest::PoolIsPresent(vector<uint32_t>& in_list) {
return
true
;
return
true
;
}
}
bool
RocmBandwidthTest
::
PoolIsDuplicated
(
vector
<
uint32
_t
>&
in_list
)
{
bool
RocmBandwidthTest
::
PoolIsDuplicated
(
vector
<
size
_t
>&
in_list
)
{
uint32_t
idx1
=
0
;
uint32_t
idx1
=
0
;
uint32_t
idx2
=
0
;
uint32_t
idx2
=
0
;
...
@@ -87,7 +87,7 @@ bool RocmBandwidthTest::PoolIsDuplicated(vector<uint32_t>& in_list) {
...
@@ -87,7 +87,7 @@ bool RocmBandwidthTest::PoolIsDuplicated(vector<uint32_t>& in_list) {
return
true
;
return
true
;
}
}
bool
RocmBandwidthTest
::
ValidateReadOrWriteReq
(
vector
<
uint32
_t
>&
in_list
)
{
bool
RocmBandwidthTest
::
ValidateReadOrWriteReq
(
vector
<
size
_t
>&
in_list
)
{
// Determine read / write request is even
// Determine read / write request is even
// Request is specified as a list of memory
// Request is specified as a list of memory
...
@@ -120,7 +120,7 @@ bool RocmBandwidthTest::ValidateWriteReq() {
...
@@ -120,7 +120,7 @@ bool RocmBandwidthTest::ValidateWriteReq() {
return
ValidateReadOrWriteReq
(
write_list_
);
return
ValidateReadOrWriteReq
(
write_list_
);
}
}
bool
RocmBandwidthTest
::
ValidateCopyReq
(
vector
<
uint32
_t
>&
in_list
)
{
bool
RocmBandwidthTest
::
ValidateCopyReq
(
vector
<
size
_t
>&
in_list
)
{
// Determine pool list length is valid
// Determine pool list length is valid
uint32_t
count
=
in_list
.
size
();
uint32_t
count
=
in_list
.
size
();
...
...
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