Skip to content

Commit 3b9155c

Browse files
committed
Print warning when kernel argument has multiple buffer_location attributes
The auto-discovery string parsing of per kernel argument buffer_location intended to concatenate multiple attributes into a space-separated string, but in fact only retains the value of the last buffer_location attribute since read_string_counters() does not append but assign the string value. Since multiple buffer_location attributes are not supported, print a warning message, and select the last buffer_location attribute such that the functional behaviour of buffer_location parsing remains unchanged. Signed-off-by: Peter Colberg <[email protected]>
1 parent 5712d6d commit 3b9155c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/acl_auto_configure.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,6 @@ bool acl_load_device_def_from_str(const std::string &config_str,
685685
auto addr_space_type = 0U;
686686
auto category = 0U;
687687
auto size = 0U;
688-
auto num_buffer_locations = 0U;
689688
int total_fields_arguments = 0;
690689
if (result) {
691690
result =
@@ -706,16 +705,19 @@ bool acl_load_device_def_from_str(const std::string &config_str,
706705

707706
std::string buffer_location = "";
708707
if (result) {
708+
unsigned int num_buffer_locations = 0;
709709
result = result && read_uint_counters(config_str, curr_pos,
710710
num_buffer_locations, counters);
711-
for (auto k = 0U; result && (k < num_buffer_locations); k++) {
712-
if (j > 0) {
713-
buffer_location = buffer_location + " ";
714-
}
715-
711+
for (unsigned int k = 0; result && (k < num_buffer_locations); k++) {
716712
result = result && read_string_counters(config_str, curr_pos,
717713
buffer_location, counters);
718714
}
715+
if (result && num_buffer_locations > 1) {
716+
std::cerr
717+
<< "WARNING: kernel argument has multiple buffer_location "
718+
"attributes which is not supported.\nSelecting "
719+
<< buffer_location << " as buffer location.\n";
720+
}
719721
}
720722

721723
// Only local mem contains the following params

0 commit comments

Comments
 (0)