Skip to content

Commit 64fb75d

Browse files
committed
Remove acl_device_program_info_t backpointer from acl_device_def_t
1 parent 71d91e4 commit 64fb75d

File tree

4 files changed

+23
-27
lines changed

4 files changed

+23
-27
lines changed

include/acl.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -593,20 +593,19 @@ typedef struct acl_device_def_autodiscovery_t {
593593
} acl_device_def_autodiscovery_t;
594594

595595
typedef struct acl_device_def_t {
596-
// Back pointer. This is only valid if this def is owned by a dev_prog. In
597-
// tests, this is not the case.
598-
acl_device_program_info dev_prog;
599-
unsigned int physical_device_id; /* The ID of the physical device that the we
600-
need to "talk" to */
596+
// Information obtained from MMD when acl_hal_mmd tries the device
597+
unsigned int physical_device_id; // The ID of the physical device that the we
598+
// need to "talk" to
601599
unsigned int concurrent_reads; // # of reads that can happen at one time
602600
unsigned int concurrent_writes; // # of writes that can happen at one time
603-
unsigned int
604-
max_inflight_mem_ops; // max # of memory ops that can happen concurrently
601+
unsigned int max_inflight_mem_ops; // max # of memory ops that can happen
602+
// concurrently
605603
unsigned int host_capabilities;
606604
unsigned int shared_capabilities;
607605
unsigned int device_capabilities;
608606
size_t min_host_mem_alignment;
609607

608+
// autodiscovery information that changes every reprogram
610609
acl_device_def_autodiscovery_t autodiscovery_def;
611610
} acl_device_def_t;
612611

include/acl_types.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,9 +1264,12 @@ typedef struct _cl_device_id {
12641264
cl_uint vendor_id;
12651265
const char *version;
12661266
const char *driver_version;
1267-
acl_device_def_t def;
12681267
size_t min_local_mem_size; // min size of all local mems for accelerators in
12691268
// this device.
1269+
unsigned int address_bits; // cache address bits to avoid GetDeviceInfo calls
1270+
1271+
// MMD and autodiscovery information
1272+
acl_device_def_t def;
12701273

12711274
// Indicates the number of contexts in which the device is currently opened.
12721275
int opened_count;
@@ -1280,8 +1283,6 @@ typedef struct _cl_device_id {
12801283
// this device are released)
12811284
context_mode_lock mode_lock;
12821285

1283-
unsigned int address_bits; // cache address bits to avoid GetDeviceInfo calls
1284-
12851286
int present; // Is the device present in the host system?
12861287

12871288
// Error notification callback.
@@ -1296,15 +1297,19 @@ typedef struct _cl_device_id {
12961297
// In non-embedded mode, we can reprogram the device during runtime of
12971298
// the host program.
12981299
// A device can only be programmed with one cl_program at a time.
1300+
// Two operations that can trigger device reprogram are
1301+
// 1. Eager reprogram of the first binary to clCreateProgram*
1302+
// 2. Kernel launch that use a different binary than the one on device
12991303
//
13001304
// These two fields keep track of what is programmed on the device:
13011305
//
13021306
// loaded_bin: What acl_device_binary_t is loaded *right now*.
1307+
// (updated in acl_program_device)
13031308
//
13041309
// last_bin: What acl_device_binary_t will be loaded on the device
1305-
// after
1306-
// after the last operation on the device op queue
1307-
// has completed?
1310+
// after the last operation on the device op queue has
1311+
// completed? (updated when submitting command for the
1312+
// above-mentioned reprogram operations)
13081313
//
13091314
const acl_device_binary_t *loaded_bin = nullptr;
13101315
const acl_device_binary_t *last_bin = nullptr;

src/acl_device_program_info.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ static std::string l_get_hashed_kernel_name(const std::string &kernel_name) {
2424

2525
acl_device_program_info_t::acl_device_program_info_t() {
2626
device_binary.set_dev_prog(this);
27-
device_binary.get_devdef().dev_prog = this;
2827
}
2928

3029
acl_device_program_info_t::~acl_device_program_info_t() {
@@ -53,7 +52,6 @@ acl_device_program_info_t::add_split_binary(const std::string &hashed_name) {
5352

5453
auto &dev_bin = m_split_device_binaries[hashed_name];
5554
dev_bin.set_dev_prog(this);
56-
dev_bin.get_devdef().dev_prog = this;
5755
return dev_bin;
5856
}
5957

test/acl_globals_test.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ static acl_system_def_t acltest_simple_system = {
149149

150150
// Device definitions.
151151
1,
152-
{{nullptr,
153-
0,
152+
{{0,
154153
1,
155154
1,
156155
1, /* half duplex memory transfers */
@@ -556,8 +555,7 @@ static acl_system_def_t acltest_complex_system = {
556555
/* num_devices */ 5,
557556
{// All of these have kernels 0 and 2 in common. This is used for
558557
// testing clCreateKernels
559-
{nullptr,
560-
0,
558+
{0,
561559
1,
562560
1,
563561
1, /* half duplex memory transfers */
@@ -591,8 +589,7 @@ static acl_system_def_t acltest_complex_system = {
591589
0}},
592590
},
593591
}},
594-
{nullptr,
595-
1,
592+
{1,
596593
1,
597594
1,
598595
2, /* full duplex memory transfers */
@@ -626,8 +623,7 @@ static acl_system_def_t acltest_complex_system = {
626623
0}},
627624
},
628625
}},
629-
{nullptr,
630-
2,
626+
{2,
631627
1,
632628
1,
633629
2, /* full duplex memory transfers */
@@ -651,8 +647,7 @@ static acl_system_def_t acltest_complex_system = {
651647
/* burst_interleaved */ 1,
652648
},
653649
}}},
654-
{nullptr,
655-
3,
650+
{3,
656651
1,
657652
1,
658653
1, /* half duplex memory transfers */
@@ -676,8 +671,7 @@ static acl_system_def_t acltest_complex_system = {
676671
/* burst_interleaved */ 1,
677672
},
678673
}}},
679-
{nullptr,
680-
4,
674+
{4,
681675
1,
682676
1,
683677
1, /* half duplex memory transfers */

0 commit comments

Comments
 (0)