From 2af207b148315ff5aa6eebae907f2b5b6ebb5169 Mon Sep 17 00:00:00 2001 From: Peter Colberg Date: Fri, 22 Apr 2022 14:46:26 -0400 Subject: [PATCH] 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 --- src/acl_auto_configure.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/acl_auto_configure.cpp b/src/acl_auto_configure.cpp index 33bc7068..3d69b6d8 100644 --- a/src/acl_auto_configure.cpp +++ b/src/acl_auto_configure.cpp @@ -685,7 +685,6 @@ bool acl_load_device_def_from_str(const std::string &config_str, auto addr_space_type = 0U; auto category = 0U; auto size = 0U; - auto num_buffer_locations = 0U; int total_fields_arguments = 0; if (result) { result = @@ -706,16 +705,19 @@ bool acl_load_device_def_from_str(const std::string &config_str, std::string buffer_location = ""; if (result) { + unsigned int num_buffer_locations = 0; result = result && read_uint_counters(config_str, curr_pos, num_buffer_locations, counters); - for (auto k = 0U; result && (k < num_buffer_locations); k++) { - if (j > 0) { - buffer_location = buffer_location + " "; - } - + for (unsigned int k = 0; result && (k < num_buffer_locations); k++) { result = result && read_string_counters(config_str, curr_pos, buffer_location, counters); } + if (result && num_buffer_locations > 1) { + std::cerr + << "WARNING: kernel argument has multiple buffer_location " + "attributes which is not supported.\nSelecting " + << buffer_location << " as buffer location.\n"; + } } // Only local mem contains the following params