Skip to content

Commit 03fce64

Browse files
Merge branch 'master' into fix_fixed_clusters_issue
2 parents 3d9ebdc + 44e7f02 commit 03fce64

File tree

115 files changed

+9119
-756
lines changed

Some content is hidden

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

115 files changed

+9119
-756
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ jobs:
197197
params: '-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVPR_USE_EZGL=off',
198198
suite: 'vtr_reg_basic'
199199
},
200+
{
201+
name: 'Basic with CAPNPROTO disabled',
202+
params: '-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_CAPNPROTO=off',
203+
suite: 'vtr_reg_basic'
204+
},
200205
{
201206
name: 'Basic with VTR_ENABLE_DEBUG_LOGGING',
202207
params: '-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_DEBUG_LOGGING=on',
@@ -297,7 +302,13 @@ jobs:
297302
CMAKE_PARAMS: ${{ matrix.params }}
298303
BUILD_TYPE: debug
299304
LSAN_OPTIONS: 'exitcode=42' #Use a non-standard exit code to ensure LSAN errors are detected
305+
# In Ubuntu 20240310.1.0, the entropy of ASLR has increased (28 -> 32). LLVM 14 in this
306+
# image is not compatible with this increased ASLR entropy. Apparently, memory sanitizer
307+
# depends on LLVM and all CI tests where VTR_ENABLE_SANITIZE is enabled fail. For a temporary
308+
# fix, we manually reduce the entropy. This quick fix should be removed in the future
309+
# when github deploys a more stable Ubuntu image.
300310
run: |
311+
sudo sysctl -w vm.mmap_rnd_bits=28
301312
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
302313
./.github/scripts/build.sh
303314
# We skip QoR since we are only checking for errors in sanitizer runs
@@ -349,6 +360,7 @@ jobs:
349360
CMAKE_PARAMS: '-DVTR_ASSERT_LEVEL=3 -DVTR_ENABLE_SANITIZE=on -DVTR_IPO_BUILD=off -DWITH_BLIFEXPLORER=on -DWITH_PARMYS=OFF -DWITH_ODIN=on'
350361
BUILD_TYPE: debug
351362
run: |
363+
sudo sysctl -w vm.mmap_rnd_bits=28
352364
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
353365
./.github/scripts/build.sh
354366
./run_reg_test.py odin_reg_basic -show_failures -j2

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set(VTR_IPO_BUILD "auto" CACHE STRING "Should VTR be compiled with interprocedur
2323
set_property(CACHE VTR_IPO_BUILD PROPERTY STRINGS auto on off)
2424

2525
#Allow the user to configure how much assertion checking should occur
26-
set(VTR_ASSERT_LEVEL "2" CACHE STRING "VTR assertion checking level. 0: no assertions, 1: fast assertions, 2: regular assertions, 3: additional assertions with noticable run-time overhead, 4: all assertions (including those with significant run-time cost)")
26+
set(VTR_ASSERT_LEVEL "2" CACHE STRING "VTR assertion checking level. 0: no assertions, 1: fast assertions, 2: regular assertions, 3: additional assertions with noticeable run-time overhead, 4: all assertions (including those with significant run-time cost)")
2727
set_property(CACHE VTR_ASSERT_LEVEL PROPERTY STRINGS 0 1 2 3 4)
2828

2929
option(VTR_ENABLE_STRICT_COMPILE "Specifies whether compiler warnings should be treated as errors (e.g. -Werror)" OFF)

libs/EXTERNAL/libargparse/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ libargparse
22
===========
33
This is (yet another) simple command-line parser for C++ applications, inspired by Python's agparse module.
44

5-
It requires only a C++11 compiler, and has no external dependancies.
5+
It requires only a C++11 compiler, and has no external dependencies.
66

77
One of the advantages of libargparse is that all conversions from command-line strings to program types (bool, int etc.) are performed when the command line is parsed (and not when the options are accessed).
88
This avoids command-line related errors from showing up deep in the program execution, which can be problematic for long-running programs.

libs/EXTERNAL/libargparse/src/argparse.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include <algorithm>
2-
#include <array>
32
#include <list>
43
#include <cassert>
54
#include <string>
65
#include <set>
76
#include <limits>
7+
#include <utility>
88

99
#include "argparse.hpp"
1010
#include "argparse_util.hpp"
@@ -16,16 +16,16 @@ namespace argparse {
1616
* ArgumentParser
1717
*/
1818

19-
ArgumentParser::ArgumentParser(std::string prog_name, std::string description_str, std::ostream& os)
20-
: description_(description_str)
19+
ArgumentParser::ArgumentParser(const std::string& prog_name, std::string description_str, std::ostream& os)
20+
: description_(std::move(description_str))
2121
, formatter_(new DefaultFormatter())
2222
, os_(os)
2323
{
2424
prog(prog_name);
2525
argument_groups_.push_back(ArgumentGroup("arguments"));
2626
}
2727

28-
ArgumentParser& ArgumentParser::prog(std::string prog_name, bool basename_only) {
28+
ArgumentParser& ArgumentParser::prog(const std::string& prog_name, bool basename_only) {
2929
if (basename_only) {
3030
prog_ = basename(prog_name);
3131
} else {
@@ -35,17 +35,17 @@ namespace argparse {
3535
}
3636

3737
ArgumentParser& ArgumentParser::version(std::string version_str) {
38-
version_ = version_str;
38+
version_ = std::move(version_str);
3939
return *this;
4040
}
4141

4242
ArgumentParser& ArgumentParser::epilog(std::string epilog_str) {
43-
epilog_ = epilog_str;
43+
epilog_ = std::move(epilog_str);
4444
return *this;
4545
}
4646

4747
ArgumentGroup& ArgumentParser::add_argument_group(std::string description_str) {
48-
argument_groups_.push_back(ArgumentGroup(description_str));
48+
argument_groups_.push_back(ArgumentGroup(std::move(description_str)));
4949
return argument_groups_[argument_groups_.size() - 1];
5050
}
5151

@@ -72,7 +72,7 @@ namespace argparse {
7272
void ArgumentParser::parse_args_throw(int argc, const char* const* argv) {
7373
std::vector<std::string> arg_strs;
7474
for (int i = 1; i < argc; ++i) {
75-
arg_strs.push_back(argv[i]);
75+
arg_strs.emplace_back(argv[i]);
7676
}
7777

7878
parse_args_throw(arg_strs);
@@ -241,7 +241,7 @@ namespace argparse {
241241
} else if (arg->nargs() == '+' || arg->nargs() == '*') {
242242
if (arg->nargs() == '+') {
243243
assert(nargs_read >= 1);
244-
assert(values.size() >= 1);
244+
assert(!values.empty());
245245
}
246246

247247
for (const auto& value : values) {
@@ -410,11 +410,11 @@ namespace argparse {
410410
* ArgumentGroup
411411
*/
412412
ArgumentGroup::ArgumentGroup(std::string name_str)
413-
: name_(name_str)
413+
: name_(std::move(name_str))
414414
{}
415415

416416
ArgumentGroup& ArgumentGroup::epilog(std::string str) {
417-
epilog_ = str;
417+
epilog_ = std::move(str);
418418
return *this;
419419
}
420420
std::string ArgumentGroup::name() const { return name_; }
@@ -425,10 +425,10 @@ namespace argparse {
425425
* Argument
426426
*/
427427
Argument::Argument(std::string long_opt, std::string short_opt)
428-
: long_opt_(long_opt)
429-
, short_opt_(short_opt) {
428+
: long_opt_(std::move(long_opt))
429+
, short_opt_(std::move(short_opt)) {
430430

431-
if (long_opt_.size() < 1) {
431+
if (long_opt_.empty()) {
432432
throw ArgParseError("Argument must be at least one character long");
433433
}
434434

@@ -445,7 +445,7 @@ namespace argparse {
445445
}
446446

447447
Argument& Argument::help(std::string help_str) {
448-
help_ = help_str;
448+
help_ = std::move(help_str);
449449
return *this;
450450
}
451451

@@ -476,12 +476,12 @@ namespace argparse {
476476
}
477477

478478
Argument& Argument::metavar(std::string metavar_str) {
479-
metavar_ = metavar_str;
479+
metavar_ = std::move(metavar_str);
480480
return *this;
481481
}
482482

483483
Argument& Argument::choices(std::vector<std::string> choice_values) {
484-
choices_ = choice_values;
484+
choices_ = std::move(choice_values);
485485
return *this;
486486
}
487487

@@ -536,7 +536,7 @@ namespace argparse {
536536
}
537537

538538
Argument& Argument::group_name(std::string grp) {
539-
group_name_ = grp;
539+
group_name_ = std::move(grp);
540540
return *this;
541541
}
542542

libs/EXTERNAL/libargparse/src/argparse.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ namespace argparse {
3434
class ArgumentParser {
3535
public:
3636
//Initializes an argument parser
37-
ArgumentParser(std::string prog_name, std::string description_str=std::string(), std::ostream& os=std::cout);
37+
ArgumentParser(const std::string& prog_name, std::string description_str=std::string(), std::ostream& os=std::cout);
3838

3939
//Overrides the program name
40-
ArgumentParser& prog(std::string prog, bool basename_only=true);
40+
ArgumentParser& prog(const std::string& prog, bool basename_only=true);
4141

4242
//Sets the program version
4343
ArgumentParser& version(std::string version);

libs/EXTERNAL/libcatch2

Submodule libcatch2 updated 110 files

libs/libarchfpga/CMakeLists.txt

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,38 @@ target_include_directories(libarchfpga PUBLIC ${LIB_INCLUDE_DIRS})
1717

1818
set_target_properties(libarchfpga PROPERTIES PREFIX "") #Avoid extra 'lib' prefix
1919

20-
#Specify link-time dependancies
20+
#Specify link-time dependencies
2121
target_link_libraries(libarchfpga
2222
libvtrutil
2323
libpugixml
2424
libpugiutil
25-
libvtrcapnproto
2625
)
2726

27+
if(${VTR_ENABLE_CAPNPROTO})
28+
target_link_libraries(libarchfpga libvtrcapnproto)
29+
target_compile_definitions(libarchfpga PRIVATE VTR_ENABLE_CAPNPROTO)
30+
endif()
31+
32+
# Using filesystem library requires additional compiler/linker options for GNU implementation prior to 9.1
33+
# and LLVM implementation prior to LLVM 9.0;
34+
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
35+
# Get the compiler version string
36+
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE _gcc_output)
37+
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" _gcc_version ${_gcc_output})
38+
39+
if(_gcc_version VERSION_LESS "9.1")
40+
target_link_libraries(libarchfpga stdc++fs)
41+
endif()
42+
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
43+
# Get the compiler version string
44+
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE _clang_output)
45+
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" _clang_version ${_clang_output})
46+
47+
if(_clang_version VERSION_LESS "9.0")
48+
target_link_libraries(libarchfpga c++fs)
49+
endif()
50+
endif()
51+
2852
target_compile_definitions(libarchfpga PUBLIC ${INTERCHANGE_SCHEMA_HEADERS})
2953

3054
#Create the test executable

libs/libarchfpga/src/read_fpga_interchange_arch.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2+
3+
#include "read_fpga_interchange_arch.h"
4+
#include "vtr_error.h"
5+
6+
#ifdef VTR_ENABLE_CAPNPROTO
7+
18
#include <algorithm>
29
#include <kj/std/iostream.h>
310
#include <limits>
@@ -21,7 +28,6 @@
2128
#include "arch_util.h"
2229
#include "arch_types.h"
2330

24-
#include "read_fpga_interchange_arch.h"
2531

2632
/*
2733
* FPGA Interchange Device frontend
@@ -2497,11 +2503,14 @@ struct ArchReader {
24972503
}
24982504
};
24992505

2506+
#endif // VTR_ENABLE_CAPNPROTO
2507+
25002508
void FPGAInterchangeReadArch(const char* FPGAInterchangeDeviceFile,
25012509
const bool /*timing_enabled*/,
25022510
t_arch* arch,
25032511
std::vector<t_physical_tile_type>& PhysicalTileTypes,
25042512
std::vector<t_logical_block_type>& LogicalBlockTypes) {
2513+
#ifdef VTR_ENABLE_CAPNPROTO
25052514
// Decompress GZipped capnproto device file
25062515
gzFile file = gzopen(FPGAInterchangeDeviceFile, "r");
25072516
VTR_ASSERT(file != Z_NULL);
@@ -2542,4 +2551,12 @@ void FPGAInterchangeReadArch(const char* FPGAInterchangeDeviceFile,
25422551

25432552
ArchReader reader(arch, device_reader, FPGAInterchangeDeviceFile, PhysicalTileTypes, LogicalBlockTypes);
25442553
reader.read_arch();
2554+
#else // VTR_ENABLE_CAPNPROTO
2555+
// If CAPNPROTO is disabled, throw an error.
2556+
(void)FPGAInterchangeDeviceFile;
2557+
(void)arch;
2558+
(void)PhysicalTileTypes;
2559+
(void)LogicalBlockTypes;
2560+
throw vtr::VtrError("Unable to read FPGA interchange if CAPNPROTO is not enabled", __FILE__, __LINE__);
2561+
#endif // VTR_ENABLE_CAPNPROTO
25452562
}

libs/libarchfpga/src/read_fpga_interchange_arch.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33

44
#include "arch_types.h"
55

6+
#ifdef VTR_ENABLE_CAPNPROTO
7+
68
#include "DeviceResources.capnp.h"
79
#include "LogicalNetlist.capnp.h"
810
#include "capnp/serialize.h"
911
#include "capnp/serialize-packed.h"
1012
#include <fcntl.h>
1113
#include <unistd.h>
1214

15+
#endif // VTR_ENABLE_CAPNPROTO
16+
1317
#ifdef __cplusplus
1418
extern "C" {
1519
#endif

libs/librrgraph/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ target_include_directories(librrgraph PUBLIC ${LIB_INCLUDE_DIRS})
2121

2222
set_target_properties(librrgraph PROPERTIES PREFIX "") #Avoid extra 'lib' prefix
2323

24-
#Specify link-time dependancies
24+
#Specify link-time dependencies
2525
target_link_libraries(librrgraph
2626
libvtrutil
2727
libarchfpga

libs/librrgraph/src/base/rr_graph_storage.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ class edge_sort_iterator {
155155
using pointer = edge_swapper*;
156156
using difference_type = ssize_t;
157157

158+
// In order for this class to be used as an iterator within the std library,
159+
// it needs to "act" like a pointer. One thing that it should do is that a
160+
// const variable of this type should be de-referenceable. Therefore, this
161+
// method should be const method; however, this requires modifying the class
162+
// and may yield worst performance. For now the std::stable_sort allows this
163+
// but in the future it may not. If this breaks, this is why.
164+
// See issue #2517 and PR #2522
158165
edge_swapper& operator*() {
159166
return this->swapper_;
160167
}
@@ -419,7 +426,7 @@ size_t t_rr_graph_storage::count_rr_switches(
419426
// values.
420427
//
421428
// This sort is safe to do because partition_edges() has not been invoked yet.
422-
std::sort(
429+
std::stable_sort(
423430
edge_sort_iterator(this, 0),
424431
edge_sort_iterator(this, edge_dest_node_.size()),
425432
edge_compare_dest_node());
@@ -527,7 +534,7 @@ void t_rr_graph_storage::partition_edges(const vtr::vector<RRSwitchId, t_rr_swit
527534
// by assign_first_edges()
528535
// - Edges within a source node have the configurable edges before the
529536
// non-configurable edges.
530-
std::sort(
537+
std::stable_sort(
531538
edge_sort_iterator(this, 0),
532539
edge_sort_iterator(this, edge_src_node_.size()),
533540
edge_compare_src_node_and_configurable_first(rr_switches));

libs/librrgraph/src/base/rr_graph_storage.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,11 @@ class t_rr_graph_storage {
336336
return ret;
337337
}
338338

339+
/** @brief Get the source node for the specified edge. */
340+
RRNodeId edge_src_node(const RREdgeId& edge) const {
341+
return edge_src_node_[edge];
342+
}
343+
339344
/** @brief Get the destination node for the specified edge. */
340345
RRNodeId edge_sink_node(const RREdgeId& edge) const {
341346
return edge_dest_node_[edge];

libs/librrgraph/src/base/rr_graph_view.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,12 @@ class RRGraphView {
321321
inline short edge_switch(RRNodeId id, t_edge_size iedge) const {
322322
return node_storage_.edge_switch(id, iedge);
323323
}
324+
325+
/** @brief Get the source node for the specified edge. */
326+
inline RRNodeId edge_src_node(const RREdgeId edge_id) const {
327+
return node_storage_.edge_src_node(edge_id);
328+
}
329+
324330
/** @brief Get the destination node for the iedge'th edge from specified RRNodeId.
325331
* This method should generally not be used, and instead first_edge and
326332
* last_edge should be used.*/

0 commit comments

Comments
 (0)