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
6a418db7
Unverified
Commit
6a418db7
authored
Oct 03, 2019
by
Ramesh Errabolu
Committed by
GitHub
Oct 03, 2019
Browse files
Merge pull request #50 from RadeonOpenCompute/optVerifySignal
Propagate validation error signal clearly
parents
ae50c093
a4e18b37
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
21 deletions
+43
-21
rocm_bandwidth_test.cpp
rocm_bandwidth_test.cpp
+17
-15
rocm_bandwidth_test.hpp
rocm_bandwidth_test.hpp
+3
-0
rocm_bandwidth_test_report.cpp
rocm_bandwidth_test_report.cpp
+1
-1
rocm_bandwidth_test_trans.cpp
rocm_bandwidth_test_trans.cpp
+22
-5
No files found.
rocm_bandwidth_test.cpp
View file @
6a418db7
...
@@ -117,20 +117,21 @@ void RocmBandwidthTest::InitializeSrcBuffer(size_t size, void* buf_cpy,
...
@@ -117,20 +117,21 @@ void RocmBandwidthTest::InitializeSrcBuffer(size_t size, void* buf_cpy,
ErrorCheck
(
err_
);
ErrorCheck
(
err_
);
}
}
// If
C
opy
device is a Gpu setup buffer access
// If
c
opy
ing agent is a CPU, use memcpy to initialize copy buffer
hsa_device_type_t
cpy_dev_type
=
agent_list_
[
cpy_dev_idx
].
device_type_
;
hsa_device_type_t
cpy_dev_type
=
agent_list_
[
cpy_dev_idx
].
device_type_
;
if
(
cpy_dev_type
==
HSA_DEVICE_TYPE_GPU
)
{
if
(
cpy_dev_type
==
HSA_DEVICE_TYPE_CPU
)
{
memcpy
(
buf_cpy
,
init_src_
,
size
);
return
;
}
// Copying device is a Gpu, setup buffer access
// before copying initialization buffer
AcquireAccess
(
cpy_agent
,
init_src_
);
AcquireAccess
(
cpy_agent
,
init_src_
);
hsa_signal_store_relaxed
(
init_signal_
,
1
);
hsa_signal_store_relaxed
(
init_signal_
,
1
);
copy_buffer
(
buf_cpy
,
cpy_agent
,
copy_buffer
(
buf_cpy
,
cpy_agent
,
init_src_
,
cpu_agent_
,
init_src_
,
cpu_agent_
,
size
,
init_signal_
);
size
,
init_signal_
);
return
;
return
;
}
// Copy initialization buffer into copy buffer
memcpy
(
buf_cpy
,
init_src_
,
size
);
return
;
}
}
bool
RocmBandwidthTest
::
ValidateDstBuffer
(
size_t
max_size
,
size_t
curr_size
,
void
*
buf_cpy
,
bool
RocmBandwidthTest
::
ValidateDstBuffer
(
size_t
max_size
,
size_t
curr_size
,
void
*
buf_cpy
,
...
@@ -158,7 +159,7 @@ bool RocmBandwidthTest::ValidateDstBuffer(size_t max_size, size_t curr_size, voi
...
@@ -158,7 +159,7 @@ bool RocmBandwidthTest::ValidateDstBuffer(size_t max_size, size_t curr_size, voi
memcpy
(
validate_dst_
,
buf_cpy
,
curr_size
);
memcpy
(
validate_dst_
,
buf_cpy
,
curr_size
);
}
}
// Co
py
initialization buffer
into copy
buffer
// Co
mpare
initialization buffer
with validation
buffer
err_
=
(
hsa_status_t
)
memcmp
(
init_src_
,
validate_dst_
,
curr_size
);
err_
=
(
hsa_status_t
)
memcmp
(
init_src_
,
validate_dst_
,
curr_size
);
if
(
err_
!=
HSA_STATUS_SUCCESS
)
{
if
(
err_
!=
HSA_STATUS_SUCCESS
)
{
exit_value_
=
err_
;
exit_value_
=
err_
;
...
@@ -637,16 +638,17 @@ void RocmBandwidthTest::RunCopyBenchmark(async_trans_t& trans) {
...
@@ -637,16 +638,17 @@ void RocmBandwidthTest::RunCopyBenchmark(async_trans_t& trans) {
}
}
}
}
// Get Cpu min copy time
// Get Cpu min and mean times for copy
// Push them into the Cpu time list
trans
.
cpu_min_time_
.
push_back
(
GetMinTime
(
cpu_time
));
trans
.
cpu_min_time_
.
push_back
(
GetMinTime
(
cpu_time
));
// Get Cpu mean copy time and store to the array
trans
.
cpu_avg_time_
.
push_back
(
GetMeanTime
(
cpu_time
));
trans
.
cpu_avg_time_
.
push_back
(
GetMeanTime
(
cpu_time
));
if
(
print_cpu_time_
==
false
)
{
if
(
print_cpu_time_
==
false
)
{
if
(
trans
.
copy
.
uses_gpu_
)
{
if
(
trans
.
copy
.
uses_gpu_
)
{
// Get Gpu min and mean copy times
// Get Gpu min and mean copy times
double
min_time
=
(
verify
)
?
GetMinTime
(
gpu_time
)
:
std
::
numeric_limits
<
double
>::
max
();
// Push them into the Gpu time list
double
mean_time
=
(
verify
)
?
GetMeanTime
(
gpu_time
)
:
std
::
numeric_limits
<
double
>::
max
();
double
min_time
=
(
verify
)
?
GetMinTime
(
gpu_time
)
:
VALIDATE_COPY_OP_FAILURE
;
double
mean_time
=
(
verify
)
?
GetMeanTime
(
gpu_time
)
:
VALIDATE_COPY_OP_FAILURE
;
trans
.
gpu_min_time_
.
push_back
(
min_time
);
trans
.
gpu_min_time_
.
push_back
(
min_time
);
trans
.
gpu_avg_time_
.
push_back
(
mean_time
);
trans
.
gpu_avg_time_
.
push_back
(
mean_time
);
}
}
...
@@ -791,7 +793,7 @@ RocmBandwidthTest::RocmBandwidthTest(int argc, char** argv) : BaseTest() {
...
@@ -791,7 +793,7 @@ RocmBandwidthTest::RocmBandwidthTest(int argc, char** argv) : BaseTest() {
// Initialize version of the test
// Initialize version of the test
version_
.
major_id
=
2
;
version_
.
major_id
=
2
;
version_
.
minor_id
=
3
;
version_
.
minor_id
=
3
;
version_
.
step_id
=
5
;
version_
.
step_id
=
6
;
version_
.
reserved
=
0
;
version_
.
reserved
=
0
;
bw_iter_cnt_
=
getenv
(
"ROCM_BW_ITER_CNT"
);
bw_iter_cnt_
=
getenv
(
"ROCM_BW_ITER_CNT"
);
...
...
rocm_bandwidth_test.hpp
View file @
6a418db7
...
@@ -473,6 +473,9 @@ class RocmBandwidthTest : public BaseTest {
...
@@ -473,6 +473,9 @@ class RocmBandwidthTest : public BaseTest {
static
const
uint32_t
LINK_PROP_WEIGHT
=
0x02
;
static
const
uint32_t
LINK_PROP_WEIGHT
=
0x02
;
static
const
uint32_t
LINK_PROP_ACCESS
=
0x03
;
static
const
uint32_t
LINK_PROP_ACCESS
=
0x03
;
// Encodes validation failure
static
const
double
VALIDATE_COPY_OP_FAILURE
=
0xFFFFFFFF
.
FFFFFFFFp0
;
// List used to store transactions per user request
// List used to store transactions per user request
vector
<
async_trans_t
>
trans_list_
;
vector
<
async_trans_t
>
trans_list_
;
...
...
rocm_bandwidth_test_report.cpp
View file @
6a418db7
...
@@ -318,7 +318,7 @@ void RocmBandwidthTest::PrintPerfMatrix(bool validate, bool peak, double* perf_m
...
@@ -318,7 +318,7 @@ void RocmBandwidthTest::PrintPerfMatrix(bool validate, bool peak, double* perf_m
if
(
validate
)
{
if
(
validate
)
{
if
(
value
==
0
)
{
if
(
value
==
0
)
{
std
::
cout
<<
"N/A"
;
std
::
cout
<<
"N/A"
;
}
else
if
(
value
<
1
)
{
}
else
if
(
value
==
VALIDATE_COPY_OP_FAILURE
)
{
std
::
cout
<<
"FAIL"
;
std
::
cout
<<
"FAIL"
;
}
else
{
}
else
{
std
::
cout
<<
"PASS"
;
std
::
cout
<<
"PASS"
;
...
...
rocm_bandwidth_test_trans.cpp
View file @
6a418db7
...
@@ -426,12 +426,12 @@ void RocmBandwidthTest::ComputeCopyTime(async_trans_t& trans) {
...
@@ -426,12 +426,12 @@ void RocmBandwidthTest::ComputeCopyTime(async_trans_t& trans) {
avg_bandwidth
=
(
double
)
data_size
/
avg_time
/
1000
/
1000
/
1000
;
avg_bandwidth
=
(
double
)
data_size
/
avg_time
/
1000
/
1000
/
1000
;
peak_bandwidth
=
(
double
)
data_size
/
min_time
/
1000
/
1000
/
1000
;
peak_bandwidth
=
(
double
)
data_size
/
min_time
/
1000
/
1000
/
1000
;
}
else
{
}
else
{
if
(
print_cpu_time_
==
false
)
{
if
(
print_cpu_time_
)
{
avg_time
=
trans
.
gpu_avg_time_
[
idx
]
/
sys_freq
;
min_time
=
trans
.
gpu_min_time_
[
idx
]
/
sys_freq
;
}
else
{
avg_time
=
trans
.
cpu_avg_time_
[
idx
];
avg_time
=
trans
.
cpu_avg_time_
[
idx
];
min_time
=
trans
.
cpu_min_time_
[
idx
];
min_time
=
trans
.
cpu_min_time_
[
idx
];
}
else
{
avg_time
=
trans
.
gpu_avg_time_
[
idx
]
/
sys_freq
;
min_time
=
trans
.
gpu_min_time_
[
idx
]
/
sys_freq
;
}
}
avg_bandwidth
=
(
double
)
data_size
/
avg_time
/
1000
/
1000
/
1000
;
avg_bandwidth
=
(
double
)
data_size
/
avg_time
/
1000
/
1000
/
1000
;
peak_bandwidth
=
(
double
)
data_size
/
min_time
/
1000
/
1000
/
1000
;
peak_bandwidth
=
(
double
)
data_size
/
min_time
/
1000
/
1000
/
1000
;
...
@@ -439,6 +439,23 @@ void RocmBandwidthTest::ComputeCopyTime(async_trans_t& trans) {
...
@@ -439,6 +439,23 @@ void RocmBandwidthTest::ComputeCopyTime(async_trans_t& trans) {
trans
.
min_time_
.
push_back
(
min_time
);
trans
.
min_time_
.
push_back
(
min_time
);
trans
.
avg_time_
.
push_back
(
avg_time
);
trans
.
avg_time_
.
push_back
(
avg_time
);
// Check validation failures as that signal is
// captured via Min and Avg time values. If there
// is a failure propagate that value as computed
// bandwidth
if
(
validate_
)
{
avg_time
=
trans
.
gpu_avg_time_
[
idx
];
min_time
=
trans
.
gpu_min_time_
[
idx
];
if
((
avg_time
==
VALIDATE_COPY_OP_FAILURE
)
&&
(
min_time
==
VALIDATE_COPY_OP_FAILURE
))
{
trans
.
avg_bandwidth_
.
push_back
(
avg_time
);
trans
.
peak_bandwidth_
.
push_back
(
min_time
);
continue
;
}
}
// Update computed bandwidth for the transaction
trans
.
avg_bandwidth_
.
push_back
(
avg_bandwidth
);
trans
.
avg_bandwidth_
.
push_back
(
avg_bandwidth
);
trans
.
peak_bandwidth_
.
push_back
(
peak_bandwidth
);
trans
.
peak_bandwidth_
.
push_back
(
peak_bandwidth
);
}
}
...
...
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