Skip to content

Commit 89d17a2

Browse files
Merge branch 'master' into temp_place_macro_static
2 parents baa73fa + 7a2cf8d commit 89d17a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+804
-601
lines changed

.github/workflows/nightly_test.yml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@ on:
44
# We want to run the CI when anything is pushed to master.
55
# Since master is a protected branch this only happens when a PR is merged.
66
# This is a double check in case the PR was stale and had some issues.
7-
push:
8-
branches:
9-
- master
10-
paths-ignore: # Prevents from running if only docs are updated
11-
- 'doc/**'
12-
- '**/*README*'
13-
- '**.md'
14-
- '**.rst'
15-
pull_request:
16-
paths-ignore: # Prevents from running if only docs are updated
17-
- 'doc/**'
18-
- '**/*README*'
19-
- '**.md'
20-
- '**.rst'
7+
# NOTE: This was turned off in late October 2024 since the Nightly Tests were
8+
# no longer working on the self-hosted runners. Will turn this back on
9+
# once the issue is resolved.
10+
# push:
11+
# branches:
12+
# - master
13+
# paths-ignore: # Prevents from running if only docs are updated
14+
# - 'doc/**'
15+
# - '**/*README*'
16+
# - '**.md'
17+
# - '**.rst'
18+
# pull_request:
19+
# paths-ignore: # Prevents from running if only docs are updated
20+
# - 'doc/**'
21+
# - '**/*README*'
22+
# - '**.md'
23+
# - '**.rst'
2124
workflow_dispatch:
2225
schedule:
2326
- cron: '0 0 * * *' # daily

doc/src/vpr/command_line_usage.rst

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,12 +1074,16 @@ The following options are only used when FPGA device and netlist contain a NoC r
10741074

10751075
.. note:: noc_flows_file are required to specify if NoC optimization is turned on (--noc on).
10761076

1077-
.. option:: --noc_routing_algorithm {xy_routing | bfs_routing}
1077+
.. option:: --noc_routing_algorithm {xy_routing | bfs_routing | west_first_routing | north_last_routing | negative_first_routing | odd_even_routing}
10781078

10791079
Controls the algorithm used by the NoC to route packets.
10801080

10811081
* ``xy_routing`` Uses the direction oriented routing algorithm. This is recommended to be used with mesh NoC topologies.
1082-
* ``bfs_routing`` Uses the breadth first search algorithm. The objective is to find a route that uses a minimum number of links. This can be used with any NoC topology.
1082+
* ``bfs_routing`` Uses the breadth first search algorithm. The objective is to find a route that uses a minimum number of links. This algorithm is not guaranteed to generate deadlock-free traffic flow routes, but can be used with any NoC topology.
1083+
* ``west_first_routing`` Uses the west-first routing algorithm. This is recommended to be used with mesh NoC topologies.
1084+
* ``north_last_routing`` Uses the north-last routing algorithm. This is recommended to be used with mesh NoC topologies.
1085+
* ``negative_first_routing`` Uses the negative-first routing algorithm. This is recommended to be used with mesh NoC topologies.
1086+
* ``odd_even_routing`` Uses the odd-even routing algorithm. This is recommended to be used with mesh NoC topologies.
10831087

10841088
**Default:** ``bfs_routing``
10851089

@@ -1091,28 +1095,45 @@ The following options are only used when FPGA device and netlist contain a NoC r
10911095
* ``noc_placement_weighting = 1`` means noc placement is considered equal to timing and wirelength.
10921096
* ``noc_placement_weighting > 1`` means the placement is increasingly dominated by NoC parameters.
10931097

1094-
**Default:** ``0.6``
1098+
**Default:** ``5.0``
1099+
1100+
.. option:: --noc_aggregate_bandwidth_weighting <float>
1101+
1102+
Controls the importance of minimizing the NoC aggregate bandwidth. This value can be >=0, where 0 would mean the aggregate bandwidth has no relevance to placement.
1103+
Other positive numbers specify the importance of minimizing the NoC aggregate bandwidth compared to other NoC-related cost terms.
1104+
Weighting factors for NoC-related cost terms are normalized internally. Therefore, their absolute values are not important, and
1105+
only their relative ratios determine the importance of each cost term.
1106+
1107+
**Default:** ``0.38``
10951108

10961109
.. option:: --noc_latency_constraints_weighting <float>
10971110

1098-
Controls the importance of meeting all the NoC traffic flow latency constraints.
1111+
Controls the importance of meeting all the NoC traffic flow latency constraints. This value can be >=0, where 0 would mean latency constraints have no relevance to placement.
1112+
Other positive numbers specify the importance of meeting latency constraints compared to other NoC-related cost terms.
1113+
Weighting factors for NoC-related cost terms are normalized internally. Therefore, their absolute values are not important, and
1114+
only their relative ratios determine the importance of each cost term.
10991115

1100-
* ``latency_constraints = 0`` means the latency constraints have no relevance to placement.
1101-
* ``0 < latency_constraints < 1`` means the latency constraints are weighted equally to the sum of other placement cost components.
1102-
* ``latency_constraints > 1`` means the placement is increasingly dominated by reducing the latency constraints of the traffic flows.
1103-
1104-
**Default:** ``1``
1116+
**Default:** ``0.6``
11051117

11061118
.. option:: --noc_latency_weighting <float>
11071119

11081120
Controls the importance of reducing the latencies of the NoC traffic flows.
1109-
This value can be >=0,
1121+
This value can be >=0, where 0 would mean the latencies have no relevance to placement
1122+
Other positive numbers specify the importance of minimizing aggregate latency compared to other NoC-related cost terms.
1123+
Weighting factors for NoC-related cost terms are normalized internally. Therefore, their absolute values are not important, and
1124+
only their relative ratios determine the importance of each cost term.
11101125

1111-
* ``latency = 0`` means the latencies have no relevance to placement.
1112-
* ``0 < latency < 1`` means the latencies are weighted equally to the sum of other placement cost components.
1113-
* ``latency > 1`` means the placement is increasingly dominated by reducing the latencies of the traffic flows.
1114-
1115-
**Default:** ``0.05``
1126+
**Default:** ``0.02``
1127+
1128+
.. option:: --noc_congestion_weighting <float>
1129+
1130+
Controls the importance of reducing the congestion of the NoC links.
1131+
This value can be >=0, where 0 would mean the congestion has no relevance to placement.
1132+
Other positive numbers specify the importance of minimizing congestion compared to other NoC-related cost terms.
1133+
Weighting factors for NoC-related cost terms are normalized internally. Therefore, their absolute values are not important, and
1134+
only their relative ratios determine the importance of each cost term.
1135+
1136+
**Default:** ``0.25``
11161137

11171138
.. option:: --noc_swap_percentage <float>
11181139

@@ -1122,7 +1143,7 @@ The following options are only used when FPGA device and netlist contain a NoC r
11221143
* ``0`` means NoC blocks will be moved at the same rate as other blocks.
11231144
* ``100`` means all swaps attempted by the placer are NoC router blocks.
11241145

1125-
**Default:** ``40``
1146+
**Default:** ``0``
11261147

11271148
.. option:: --noc_placement_file_name <file>
11281149

libs/libvtrutil/src/specrand.cpp

Lines changed: 43 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,15 @@
5252

5353
#include "specrand.h"
5454

55-
/* Period parameters */
56-
#define N 624
57-
#define M 397
58-
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
59-
#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
60-
#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
61-
62-
static unsigned long mt[N]; /* the array for the state vector */
63-
static int mti = N + 1; /* mti==N+1 means mt[N] is not initialized */
64-
65-
void spec_srand(int seed) {
66-
spec_init_genrand((unsigned long)seed);
55+
double SpecRandomNumberGenerator::spec_rand_() {
56+
return spec_genrand_int32_() * (1.0 / 4294967296.0);
6757
}
6858

69-
/* Just a copy of spec_genrand_real2() */
70-
double spec_rand() {
71-
return spec_genrand_int32() * (1.0 / 4294967296.0);
59+
long SpecRandomNumberGenerator::spec_lrand48_() {
60+
return (long)(spec_genrand_int32_() >> 1);
7261
}
7362

74-
/* Just a copy of spec_genrand_int31() */
75-
long spec_lrand48() {
76-
return (long)(spec_genrand_int32() >> 1);
77-
}
78-
79-
/* initializes mt[N] with a seed */
80-
void spec_init_genrand(unsigned long s) {
63+
void SpecRandomNumberGenerator::spec_init_genrand_(unsigned long s) {
8164
mt[0] = s & 0xffffffffUL;
8265
for (mti = 1; mti < N; mti++) {
8366
mt[mti] = (1812433253UL * (mt[mti - 1] ^ (mt[mti - 1] >> 30)) + mti);
@@ -90,16 +73,11 @@ void spec_init_genrand(unsigned long s) {
9073
}
9174
}
9275

93-
/* initialize by an array with array-length */
94-
/* init_key is the array for initializing keys */
95-
/* key_length is its length */
96-
/* slight change for C++, 2004/2/26 */
97-
void spec_init_by_array(unsigned long init_key[], int key_length) {
98-
int i, j, k;
99-
spec_init_genrand(19650218UL);
100-
i = 1;
101-
j = 0;
102-
k = (N > key_length ? N : key_length);
76+
void SpecRandomNumberGenerator::spec_init_by_array_(const unsigned long init_key[], size_t key_length) {
77+
spec_init_genrand_(19650218UL);
78+
size_t i = 1;
79+
size_t j = 0;
80+
size_t k = (N > key_length ? N : key_length);
10381
for (; k; k--) {
10482
mt[i] = (mt[i] ^ ((mt[i - 1] ^ (mt[i - 1] >> 30)) * 1664525UL))
10583
+ init_key[j] + j; /* non linear */
@@ -127,22 +105,21 @@ void spec_init_by_array(unsigned long init_key[], int key_length) {
127105
}
128106

129107
/* generates a random number on [0,0xffffffff]-interval */
130-
unsigned long spec_genrand_int32() {
108+
unsigned long SpecRandomNumberGenerator::spec_genrand_int32_() {
131109
unsigned long y;
132110
static unsigned long mag01[2] = {0x0UL, MATRIX_A};
133111
/* mag01[x] = x * MATRIX_A for x=0,1 */
134112

135113
if (mti >= N) { /* generate N words at one time */
136-
int kk;
137114

138115
if (mti == N + 1) /* if init_genrand() has not been called, */
139-
spec_init_genrand(5489UL); /* a default initial seed is used */
116+
spec_init_genrand_(5489UL); /* a default initial seed is used */
140117

141-
for (kk = 0; kk < N - M; kk++) {
118+
for (size_t kk = 0; kk < N - M; kk++) {
142119
y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK);
143120
mt[kk] = mt[kk + M] ^ (y >> 1) ^ mag01[y & 0x1UL];
144121
}
145-
for (; kk < N - 1; kk++) {
122+
for (size_t kk; kk < N - 1; kk++) {
146123
y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK);
147124
mt[kk] = mt[kk + (M - N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
148125
}
@@ -163,32 +140,45 @@ unsigned long spec_genrand_int32() {
163140
return y;
164141
}
165142

166-
/* generates a random number on [0,0x7fffffff]-interval */
167-
long spec_genrand_int31() {
168-
return (long)(spec_genrand_int32() >> 1);
143+
long SpecRandomNumberGenerator::spec_genrand_int31_() {
144+
return (long)(spec_genrand_int32_() >> 1);
169145
}
170146

171-
/* generates a random number on [0,1]-real-interval */
172-
double spec_genrand_real1() {
173-
return spec_genrand_int32() * (1.0 / 4294967295.0);
147+
double SpecRandomNumberGenerator::spec_genrand_real1_() {
148+
return spec_genrand_int32_() * (1.0 / 4294967295.0);
174149
/* divided by 2^32-1 */
175150
}
176151

177-
/* generates a random number on [0,1)-real-interval */
178-
double spec_genrand_real2() {
179-
return spec_genrand_int32() * (1.0 / 4294967296.0);
152+
double SpecRandomNumberGenerator::spec_genrand_real2_() {
153+
return spec_genrand_int32_() * (1.0 / 4294967296.0);
180154
/* divided by 2^32 */
181155
}
182156

183-
/* generates a random number on (0,1)-real-interval */
184-
double spec_genrand_real3() {
185-
return (((double)spec_genrand_int32()) + 0.5) * (1.0 / 4294967296.0);
157+
double SpecRandomNumberGenerator::spec_genrand_real3_() {
158+
return (((double)spec_genrand_int32_()) + 0.5) * (1.0 / 4294967296.0);
186159
/* divided by 2^32 */
187160
}
188161

189-
/* generates a random number on [0,1) with 53-bit resolution*/
190-
double spec_genrand_res53() {
191-
unsigned long a = spec_genrand_int32() >> 5, b = spec_genrand_int32() >> 6;
162+
double SpecRandomNumberGenerator::spec_genrand_res53_() {
163+
unsigned long a = spec_genrand_int32_() >> 5, b = spec_genrand_int32_() >> 6;
192164
return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);
193165
}
194-
/* These real versions are due to Isaku Wada, 2002/01/09 added */
166+
167+
void SpecRandomNumberGenerator::srandom(int seed) {
168+
spec_init_genrand_((unsigned long)seed);
169+
}
170+
171+
int SpecRandomNumberGenerator::irand(int imax) {
172+
return (int)(spec_genrand_int31_() % (imax + 1));
173+
}
174+
175+
float SpecRandomNumberGenerator::frand() {
176+
return (float)spec_genrand_real2_();
177+
}
178+
179+
SpecRandomNumberGenerator::SpecRandomNumberGenerator(int seed) {
180+
spec_init_genrand_((unsigned long)seed);
181+
}
182+
183+
SpecRandomNumberGenerator::SpecRandomNumberGenerator()
184+
: SpecRandomNumberGenerator(0) {}

libs/libvtrutil/src/specrand.h

Lines changed: 56 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,35 +52,69 @@
5252
/* Slightly modified for use in SPEC CPU by Cloyce D. Spradling (5 Nov 2009)
5353
*/
5454

55-
void spec_srand(int seed);
56-
double spec_rand();
57-
long spec_lrand48();
55+
#include "vtr_random.h"
5856

59-
/* initializes mt[N] with a seed */
60-
void spec_init_genrand(unsigned long s);
57+
class SpecRandomNumberGenerator : public vtr::RandomNumberGeneratorInterface {
58+
public:
59+
SpecRandomNumberGenerator(const SpecRandomNumberGenerator&) = delete;
60+
SpecRandomNumberGenerator& operator=(SpecRandomNumberGenerator& other) = delete;
6161

62-
/* initialize by an array with array-length */
63-
/* init_key is the array for initializing keys */
64-
/* key_length is its length */
65-
/* slight change for C++, 2004/2/26 */
66-
void spec_init_by_array(unsigned long init_key[], int key_length);
62+
SpecRandomNumberGenerator();
63+
explicit SpecRandomNumberGenerator(int seed);
6764

68-
/* generates a random number on [0,0xffffffff]-interval */
69-
unsigned long spec_genrand_int32();
65+
virtual void srandom(int seed) override;
66+
virtual int irand(int imax) override;
67+
virtual float frand() override;
7068

71-
/* generates a random number on [0,0x7fffffff]-interval */
72-
long spec_genrand_int31();
69+
private:
70+
/// @brief initializes mt[N] with a seed
71+
void spec_init_genrand_(unsigned long s);
7372

74-
/* generates a random number on [0,1]-real-interval */
75-
double spec_genrand_real1();
73+
/**
74+
* @brief initialize by an array with array-length
75+
* @param init_key the array for initializing keys
76+
* @param key_length the length of array
77+
*/
78+
void spec_init_by_array_(const unsigned long init_key[], size_t key_length);
7679

77-
/* generates a random number on [0,1)-real-interval */
78-
double spec_genrand_real2();
80+
/// @brief generates a random number on [0,0xffffffff]-interval
81+
unsigned long spec_genrand_int32_();
7982

80-
/* generates a random number on (0,1)-real-interval */
81-
double spec_genrand_real3();
83+
/// @brief Just a copy of spec_genrand_real2()
84+
double spec_rand_();
85+
/// @brief Just a copy of spec_genrand_int31()
86+
long spec_lrand48_();
8287

83-
/* generates a random number on [0,1) with 53-bit resolution*/
84-
double spec_genrand_res53();
88+
/// @brief generates a random number on [0,0x7fffffff]-interval */
89+
long spec_genrand_int31_();
90+
91+
/// @brief generates a random number on [0,1]-real-interval
92+
double spec_genrand_real1_();
93+
94+
/// @brief generates a random number on [0,1)-real-interval
95+
double spec_genrand_real2_();
96+
97+
/// @brief generates a random number on (0,1)-real-interval
98+
double spec_genrand_real3_();
99+
100+
/// @brief generates a random number on [0,1) with 53-bit resolution
101+
double spec_genrand_res53_();
102+
103+
private:
104+
/// Period parameters
105+
static constexpr size_t M = 397;
106+
static constexpr size_t N = 624;
107+
/// constant vector a
108+
static constexpr unsigned long MATRIX_A = 0x9908b0dfUL;
109+
/// most significant w-r bits
110+
static constexpr unsigned long UPPER_MASK = 0x80000000UL;
111+
/// least significant r bits
112+
static constexpr unsigned long LOWER_MASK = 0x7fffffffUL;
113+
/// mti==N+1 means mt[N] is not initialized
114+
size_t mti = N + 1;
115+
/// the array for the state vector
116+
unsigned long mt[N];
117+
118+
};
85119

86120
#endif

0 commit comments

Comments
 (0)