Skip to content

Commit 6a9fa7d

Browse files
committed
auto_configure: parse streaming kernel control signal names
Signed-off-by: Peter Colberg <[email protected]>
1 parent 2342332 commit 6a9fa7d

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

include/acl.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ typedef struct {
199199
std::string format_string;
200200
} acl_printf_info_t;
201201

202+
// Signal names for streaming control kernel.
203+
struct acl_streaming_kernel_control_info {
204+
std::string start;
205+
std::string done;
206+
};
207+
202208
/* The definition of a single accelerator.
203209
* It can run a single kernel type.
204210
* We assume binary compilation only.
@@ -241,6 +247,7 @@ typedef struct {
241247
unsigned int is_sycl_compile; /* [1] SYCL compile; [0] OpenCL compile*/
242248

243249
bool streaming_control_info_available;
250+
acl_streaming_kernel_control_info streaming_control_info;
244251
} acl_accel_def_t;
245252

246253
/* An ACL system definition.

src/acl_auto_configure.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -663,15 +663,23 @@ static bool read_kernel_args(const std::string &config_str,
663663
return result;
664664
}
665665

666-
static bool
667-
read_streaming_kernel_control_info(const std::string &config_str,
668-
std::string::size_type &curr_pos,
669-
bool &streaming_control_info_available,
670-
std::vector<int> &counters) noexcept {
666+
static bool read_streaming_kernel_control_info(
667+
const std::string &config_str, std::string::size_type &curr_pos,
668+
bool &streaming_control_info_available,
669+
acl_streaming_kernel_control_info &streaming_control_info,
670+
std::vector<int> &counters) noexcept {
671671
unsigned int value = 0;
672672
bool result = read_uint_counters(config_str, curr_pos, value, counters);
673673
streaming_control_info_available = value;
674674

675+
if (result && streaming_control_info_available) {
676+
streaming_control_info = acl_streaming_kernel_control_info{};
677+
result = read_string_counters(config_str, curr_pos,
678+
streaming_control_info.start, counters);
679+
result = read_string_counters(config_str, curr_pos,
680+
streaming_control_info.done, counters);
681+
}
682+
675683
return result;
676684
}
677685

@@ -915,7 +923,7 @@ static bool read_accel_defs(const std::string &config_str,
915923
if (result && counters.back() > 0) {
916924
result = read_streaming_kernel_control_info(
917925
config_str, curr_pos, accel[i].streaming_control_info_available,
918-
counters);
926+
accel[i].streaming_control_info, counters);
919927
}
920928

921929
// forward compatibility: bypassing remaining fields at the end of kernel

test/acl_auto_configure_test.cpp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,11 +1232,12 @@ TEST(auto_configure, streaming) {
12321232
const std::string config_str{
12331233
"23 26 " RANDOM_HASH
12341234
" pac_a10 0 1 13 DDR 2 2 24 1 2 0 4294967296 4294967296 8589934592 0 - 0 "
1235-
"0 0 0 1 3 device_global_name 256 128 1 103 _ZTS3CRCILi0EE 0 256 1 0 0 1 "
1235+
"0 0 0 1 3 device_global_name 256 128 1 105 _ZTS3CRCILi0EE 0 256 1 0 0 1 "
12361236
"0 1 0 9 8 0 0 8 1 0 0 1 k0_ZTS3CRCILi0EE_arg0 8 2 1 8 1024 0 3 1 "
12371237
"k0_ZTS3CRCILi0EE_arg1 8 0 0 8 1 0 0 1 k0_ZTS3CRCILi0EE_arg2 7 0 0 8 1 0 "
12381238
"0 0 7 0 0 8 1 0 0 0 7 2 1 8 1024 0 2 0 7 0 0 8 1 0 0 0 7 0 0 8 1 0 0 0 "
1239-
"7 0 0 8 1 0 0 0 0 0 1 2 64 4096 1 1 1 3 1 1 1 3 1 0 1"};
1239+
"7 0 0 8 1 0 0 0 0 0 1 2 64 4096 1 1 1 3 1 1 1 3 1 0 1 "
1240+
"k0_ZTS3CRCILi0EE_streaming_start k0_ZTS3CRCILi0EE_streaming_done "};
12401241

12411242
acl_device_def_autodiscovery_t devdef;
12421243
{
@@ -1252,6 +1253,10 @@ TEST(auto_configure, streaming) {
12521253

12531254
CHECK(!devdef.accel[0].is_sycl_compile);
12541255
CHECK(devdef.accel[0].streaming_control_info_available);
1256+
CHECK("k0_ZTS3CRCILi0EE_streaming_start" ==
1257+
devdef.accel[0].streaming_control_info.start);
1258+
CHECK("k0_ZTS3CRCILi0EE_streaming_done" ==
1259+
devdef.accel[0].streaming_control_info.done);
12551260

12561261
const auto &args = devdef.accel[0].iface.args;
12571262
CHECK_EQUAL(9, args.size());
@@ -1274,13 +1279,14 @@ TEST(auto_configure, one_streaming_arg_and_streaming_kernel) {
12741279
const std::string config_str{
12751280
"23 27 531091a097f0d7096b21f349b4b283f9e206ebc0 pac_s10 0 1 17 DDR 2 4 "
12761281
"24 1 2 0 8589934592 8589934592 17179869184 17179869184 25769803776 "
1277-
"25769803776 34359738368 0 - 0 0 0 0 0 0 1 123 _ZTS15binomial_kernel 0 "
1282+
"25769803776 34359738368 0 - 0 0 0 0 0 0 1 125 _ZTS15binomial_kernel 0 "
12781283
"256 0 0 0 0 0 1 0 8 7 2 1 8 1024 0 2 0 8 0 0 8 1 0 0 1 "
12791284
"k0_ZTS15binomial_kernel_arg1 7 0 0 8 1 0 0 0 7 0 0 8 1 0 0 0 7 2 1 8 "
12801285
"1024 0 2 0 7 0 0 8 1 0 0 0 7 0 0 8 1 0 0 0 7 0 0 8 1 0 0 0 0 0 16 2 64 "
12811286
"8196 65 8196 66 8196 67 8196 68 8196 69 8196 70 8196 71 8196 72 8196 73 "
12821287
"8196 74 8196 75 8196 76 8196 77 8196 78 8196 79 8196 1 1 1 3 1 1 1 3 1 "
1283-
"1 1"};
1288+
"1 1 k0_ZTS15binomial_kernel_streaming_start "
1289+
"k0_ZTS15binomial_kernel_streaming_done "};
12841290

12851291
acl_device_def_autodiscovery_t devdef;
12861292
{
@@ -1295,6 +1301,10 @@ TEST(auto_configure, one_streaming_arg_and_streaming_kernel) {
12951301
CHECK_EQUAL(1, devdef.accel.size());
12961302

12971303
CHECK(devdef.accel[0].streaming_control_info_available);
1304+
CHECK("k0_ZTS15binomial_kernel_streaming_start" ==
1305+
devdef.accel[0].streaming_control_info.start);
1306+
CHECK("k0_ZTS15binomial_kernel_streaming_done" ==
1307+
devdef.accel[0].streaming_control_info.done);
12981308

12991309
const auto &args = devdef.accel[0].iface.args;
13001310
CHECK_EQUAL(8, args.size());
@@ -1314,13 +1324,14 @@ TEST(auto_configure, two_streaming_args_and_streaming_kernel) {
13141324
const std::string config_str{
13151325
"23 27 531091a097f0d7096b21f349b4b283f9e206ebc0 pac_s10 0 1 17 DDR 2 4 "
13161326
"24 1 2 0 8589934592 8589934592 17179869184 17179869184 25769803776 "
1317-
"25769803776 34359738368 0 - 0 0 0 0 0 0 1 124 _ZTS15binomial_kernel 0 "
1327+
"25769803776 34359738368 0 - 0 0 0 0 0 0 1 126 _ZTS15binomial_kernel 0 "
13181328
"256 0 0 0 0 0 1 0 8 8 2 1 8 1024 0 2 1 k0_ZTS15binomial_kernel_arg0 8 0 "
13191329
"0 8 1 0 0 1 k0_ZTS15binomial_kernel_arg1 7 0 0 8 1 0 0 0 7 0 0 8 1 0 0 "
13201330
"0 7 2 1 8 1024 0 2 0 7 0 0 8 1 0 0 0 7 0 0 8 1 0 0 0 7 0 0 8 1 0 0 0 0 "
13211331
"0 16 2 64 8196 65 8196 66 8196 67 8196 68 8196 69 8196 70 8196 71 8196 "
13221332
"72 8196 73 8196 74 8196 75 8196 76 8196 77 8196 78 8196 79 8196 1 1 1 3 "
1323-
"1 1 1 3 1 1 1"};
1333+
"1 1 1 3 1 1 1 k0_ZTS15binomial_kernel_streaming_start "
1334+
"k0_ZTS15binomial_kernel_streaming_done "};
13241335

13251336
acl_device_def_autodiscovery_t devdef;
13261337
{
@@ -1336,6 +1347,10 @@ TEST(auto_configure, two_streaming_args_and_streaming_kernel) {
13361347

13371348
CHECK(devdef.accel[0].is_sycl_compile);
13381349
CHECK(devdef.accel[0].streaming_control_info_available);
1350+
CHECK("k0_ZTS15binomial_kernel_streaming_start" ==
1351+
devdef.accel[0].streaming_control_info.start);
1352+
CHECK("k0_ZTS15binomial_kernel_streaming_done" ==
1353+
devdef.accel[0].streaming_control_info.done);
13391354

13401355
const auto &args = devdef.accel[0].iface.args;
13411356
CHECK_EQUAL(8, args.size());

0 commit comments

Comments
 (0)