Skip to content

Commit 062e214

Browse files
authored
Get lvalue observed bounds: update test (#116)
* Use dynamic bounds casts with count(0) to update observed bounds before from_count is modified * Change the type of the node_t::from_count field from int to unsigned int, and remove dynamic bounds casts for other_node->from_node and other_node->coeffs Since the type of from_count is now unsigned int, other_node->from_count now has an original value of other_node->from_count - 1 in the increment ++other_node->from_count. This means that the value of other_node->from_count is not lost, so the observed bounds of other_node->from_node and other_node->coeffs are no longer bounds(unknown) after the increment. Therefore, we no longer need dynamic bounds casts here.
1 parent e261b7d commit 062e214

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

MultiSource/Benchmarks/Olden/em3d/em3d.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef struct node_t {
3939
array_ptr<ptr<struct node_t>> to_nodes : count(degree); /* array of nodes pointed to */
4040
array_ptr<ptr<double>> from_values : count(from_count); /* array of ptrs to vals where data comes from */
4141
array_ptr<double> coeffs : count(from_count); /* array of coeffs on edges */
42-
int from_count;
42+
unsigned int from_count;
4343
int from_length;
4444
int degree;
4545
} node_t;

MultiSource/Benchmarks/Olden/em3d/make_graph.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ void fill_table(array_ptr<ptr<node_t>> node_table : count(size), array_ptr<doubl
4242
node_table[0] = prev_node;
4343
*values = gen_uniform_double();
4444
_Unchecked { prev_node->value = values++; }
45-
prev_node->from_count = 0,
46-
prev_node->from_values = _Dynamic_bounds_cast<array_ptr<ptr<double>>>(prev_node->from_values, count(prev_node->from_count)),
47-
prev_node->coeffs = _Dynamic_bounds_cast<array_ptr<double>>(prev_node->coeffs, count(prev_node->from_count));
45+
prev_node->from_values = _Dynamic_bounds_cast<array_ptr<ptr<double>>>(prev_node->from_values, count(0)),
46+
prev_node->coeffs = _Dynamic_bounds_cast<array_ptr<double>>(prev_node->coeffs, count(0)),
47+
prev_node->from_count = 0;
4848

4949
/* Now we fill the node_table with allocated nodes */
5050
for (i=1; i<size; i++) {
5151
cur_node = calloc<node_t>(1, sizeof(node_t));
5252
*values = gen_uniform_double();
5353
_Unchecked { cur_node->value = values++; }
54-
cur_node->from_count = 0,
55-
cur_node->from_values = _Dynamic_bounds_cast<array_ptr<ptr<double>>>(cur_node->from_values, count(cur_node->from_count)),
56-
cur_node->coeffs = _Dynamic_bounds_cast<array_ptr<double>>(cur_node->coeffs, count(cur_node->from_count));
54+
cur_node->from_values = _Dynamic_bounds_cast<array_ptr<ptr<double>>>(cur_node->from_values, count(0)),
55+
cur_node->coeffs = _Dynamic_bounds_cast<array_ptr<double>>(cur_node->coeffs, count(0)),
56+
cur_node->from_count = 0;
5757
node_table[i] = cur_node;
5858
prev_node->next = cur_node;
5959
prev_node = cur_node;
@@ -123,9 +123,7 @@ void make_neighbors(ptr<node_t> nodelist, array_ptr<table_arr_t> table : count(P
123123
if ((((unsigned long long) other_node) >> 7) < 2048)
124124
chatting("post other_node = 0x%x\n",other_node);
125125
#endif
126-
++other_node->from_count, /* <----- 12% load miss penalty */
127-
other_node->from_values = _Dynamic_bounds_cast<array_ptr<ptr<double>>>(other_node->from_values, count(other_node->from_count)),
128-
other_node->coeffs = _Dynamic_bounds_cast<array_ptr<double>>(other_node->coeffs, count(other_node->from_count));
126+
++other_node->from_count; /* <----- 12% load miss penalty */
129127
}
130128
}
131129
}

0 commit comments

Comments
 (0)