Skip to content

Commit 2181194

Browse files
Merge branch 'master' into noc_turn_model_routing
2 parents b2ad5d9 + 5cfbaa0 commit 2181194

37 files changed

+191
-150
lines changed

.github/workflows/test.yml

+12
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

+1-1
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

+1-1
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/libarchfpga/CMakeLists.txt

+26-2
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

+18-1
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

+4
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

+1-1
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.h

+5
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

+6
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.*/

libs/libvtrutil/CMakeLists.txt

+21-1
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,30 @@ set_target_properties(libvtrutil PROPERTIES PREFIX "") #Avoid extra 'lib' prefix
100100
#Ensure version is always up to date by requiring version to be run first
101101
add_dependencies(libvtrutil version)
102102

103-
#Specify link-time dependancies
103+
#Specify link-time dependencies
104104
target_link_libraries(libvtrutil
105105
liblog)
106106

107+
# Using filesystem library requires additional compiler/linker options for GNU implementation prior to 9.1
108+
# and LLVM implementation prior to LLVM 9.0;
109+
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
110+
# Get the compiler version string
111+
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE _gcc_output)
112+
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" _gcc_version ${_gcc_output})
113+
114+
if(_gcc_version VERSION_LESS "9.1")
115+
target_link_libraries(libvtrutil stdc++fs)
116+
endif()
117+
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
118+
# Get the compiler version string
119+
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE _clang_output)
120+
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" _clang_version ${_clang_output})
121+
122+
if(_clang_version VERSION_LESS "9.0")
123+
target_link_libraries(libvtrutil c++fs)
124+
endif()
125+
endif()
126+
107127
install(TARGETS libvtrutil DESTINATION bin)
108128
install(FILES ${LIB_HEADERS} DESTINATION include/libvtrutil)
109129

libs/libvtrutil/cmake/modules/configure_version.cmake

+11-8
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
#Figure out the git revision
55
find_package(Git QUIET)
66
if(GIT_FOUND)
7-
exec_program(${GIT_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}
8-
ARGS describe --always --long --dirty
9-
OUTPUT_VARIABLE VTR_VCS_REVISION
10-
RETURN_VALUE GIT_DESCRIBE_RETURN_VALUE)
7+
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --long --dirty
8+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
9+
OUTPUT_VARIABLE VTR_VCS_REVISION
10+
OUTPUT_STRIP_TRAILING_WHITESPACE
11+
RESULT_VARIABLE GIT_DESCRIBE_RETURN_VALUE)
1112

1213
if(NOT GIT_DESCRIBE_RETURN_VALUE EQUAL 0)
1314
#Git describe failed, usually this means we
@@ -18,10 +19,12 @@ if(GIT_FOUND)
1819

1920
#Call again with exclude to get the revision excluding any tags
2021
#(i.e. just the commit ID and dirty flag)
21-
exec_program(${GIT_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}
22-
ARGS describe --always --long --dirty --exclude '*'
23-
OUTPUT_VARIABLE VTR_VCS_REVISION_SHORT
24-
RETURN_VALUE GIT_DESCRIBE_RETURN_VALUE)
22+
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --long --dirty --exclude '*'
23+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
24+
OUTPUT_VARIABLE VTR_VCS_REVISION_SHORT
25+
OUTPUT_STRIP_TRAILING_WHITESPACE
26+
RESULT_VARIABLE GIT_DESCRIBE_RETURN_VALUE)
27+
2528
if(NOT GIT_DESCRIBE_RETURN_VALUE EQUAL 0)
2629
#Git describe failed, usually this means we
2730
#aren't in a git repo -- so don't set a VCS

libs/libvtrutil/src/vtr_util.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ std::vector<std::string> split(const char* text, const std::string& delims) {
3131
std::string text_str(text);
3232
return split(text_str, delims);
3333
}
34-
return std::vector<std::string>();
34+
return {};
3535
}
3636

3737
/**

libs/libvtrutil/test/test_array_view.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct test_tag;
88
using TestStrongId = vtr::StrongId<test_tag>;
99

1010
TEST_CASE("Array view", "[array_view/array_view]") {
11-
std::array<uint16_t, 10> arr;
11+
std::array<uint16_t, 10> arr = {0};
1212
vtr::array_view<uint16_t> arr_view(arr.data(), arr.size());
1313

1414
const vtr::array_view<uint16_t>& carr_view = arr_view;
@@ -56,7 +56,7 @@ TEST_CASE("Array view", "[array_view/array_view]") {
5656
}
5757

5858
TEST_CASE("Array view id", "[array_view/array_view_id]") {
59-
std::array<uint16_t, 10> arr;
59+
std::array<uint16_t, 10> arr = {0};
6060
vtr::array_view_id<TestStrongId, uint16_t> arr_view(arr.data(), arr.size());
6161

6262
const vtr::array_view_id<TestStrongId, uint16_t>& carr_view = arr_view;

utils/fasm/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if (GENFASM_USES_IPO)
3333
set_property(TARGET genfasm APPEND PROPERTY LINK_FLAGS ${IPO_LINK_WARN_SUPRESS_FLAGS})
3434
endif()
3535

36-
#Specify link-time dependancies
36+
#Specify link-time dependencies
3737
install(TARGETS genfasm DESTINATION bin)
3838

3939
#
@@ -49,7 +49,7 @@ set(TEST_SOURCES
4949
add_executable(test_fasm ${TEST_SOURCES})
5050
target_link_libraries(test_fasm fasm Catch2::Catch2WithMain)
5151

52-
#Supress IPO link warnings if IPO is enabled
52+
#Suppress IPO link warnings if IPO is enabled
5353
get_target_property(TEST_FASM_USES_IPO test_fasm INTERPROCEDURAL_OPTIMIZATION)
5454
if (TEST_FASM_USES_IPO)
5555
set_property(TARGET test_fasm APPEND PROPERTY LINK_FLAGS ${IPO_LINK_WARN_SUPRESS_FLAGS})

utils/vqm2blif/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ add_library(libvqm2blif STATIC
1515
target_include_directories(libvqm2blif PUBLIC ${LIB_INCLUDE_DIRS})
1616
set_target_properties(libvqm2blif PROPERTIES PREFIX "") #Avoid extra 'lib' prefix
1717

18-
#Specify link-time dependancies
18+
#Specify link-time dependencies
1919
target_link_libraries(libvqm2blif
2020
libarchfpga
2121
libvqm)

utils/vqm2blif/src/base/cleanup.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ void remove_one_lut_nodes ( busvec* buses, std::unordered_map<std::string, int>
297297
t_node_port_association* source_port;
298298
t_node_port_association* prev_port;
299299
netvec* prev_bus;
300-
t_net* prev_net;
300+
t_net* prev_net = nullptr;
301301

302302
netvec* vcc_bus = get_bus_from_hash (hash_table, const_cast<char*>("vcc"), buses);
303303
VTR_ASSERT(vcc_bus != NULL);
@@ -658,7 +658,7 @@ void verify_netlist ( t_node** nodes, int num_nodes, busvec* buses, std::unorder
658658
auto hash_entry = hash_table.find(ref_pin->name);
659659

660660
VTR_ASSERT(hash_entry != hash_table.end());
661-
VTR_ASSERT((unsigned int)hash_entry->second == i);
661+
VTR_ASSERT((unsigned int)hash_entry->second == (unsigned int)i);
662662

663663
for (int j = 0; (unsigned int)j < temp_bus->size(); j++){
664664
temp_net = &(temp_bus->at(j));
@@ -903,4 +903,4 @@ void reorganize_module_node_list(t_module* module)
903903
}
904904

905905
//============================================================================================
906-
//============================================================================================
906+
//============================================================================================

vpr/CMakeLists.txt

+4-7
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ file(GLOB_RECURSE LIB_SOURCES src/*/*.cpp)
4343
file(GLOB_RECURSE LIB_HEADERS src/*/*.h)
4444
files_to_dirs(LIB_HEADERS LIB_INCLUDE_DIRS)
4545

46-
if(${VTR_ENABLE_CAPNPROTO})
47-
add_definitions("-DVTR_ENABLE_CAPNPROTO")
48-
endif()
49-
5046
if(${VPR_DEBUG_PARTITION_TREE})
5147
message(STATUS "VPR: Partition tree debug logs: enabled")
5248
add_definitions("-DVPR_DEBUG_PARTITION_TREE")
@@ -61,7 +57,7 @@ add_library(libvpr STATIC
6157

6258
target_include_directories(libvpr PUBLIC ${LIB_INCLUDE_DIRS})
6359

64-
#VPR_ANALYTIC_PLACE is inisitalized in the root CMakeLists
60+
#VPR_ANALYTIC_PLACE is initialized in the root CMakeLists
6561
#Check Eigen dependency
6662
if(${VPR_ANALYTIC_PLACE})
6763
message(STATUS "VPR Analytic Placement: Requested")
@@ -79,7 +75,7 @@ endif()
7975

8076
set_target_properties(libvpr PROPERTIES PREFIX "") #Avoid extra 'lib' prefix
8177

82-
#Specify link-time dependancies
78+
#Specify link-time dependencies
8379
target_link_libraries(libvpr
8480
libvtrutil
8581
libarchfpga
@@ -131,6 +127,7 @@ target_compile_definitions(libvpr PUBLIC ${GRAPHICS_DEFINES})
131127

132128
if(${VTR_ENABLE_CAPNPROTO})
133129
target_link_libraries(libvpr libvtrcapnproto)
130+
target_compile_definitions(libvpr PRIVATE VTR_ENABLE_CAPNPROTO)
134131
endif()
135132

136133
add_executable(vpr ${EXEC_SOURCES})
@@ -249,7 +246,7 @@ endif()
249246
# Signal handler configuration
250247
#
251248
if (VPR_USE_SIGNAL_HANDLER)
252-
#Check wheter VPR can use sigaction to handle signals (only supported by POSIX)
249+
#Check whether VPR can use sigaction to handle signals (only supported by POSIX)
253250
CHECK_CXX_SYMBOL_EXISTS(sigaction csignal HAVE_SIGACTION)
254251
if(HAVE_SIGACTION)
255252
target_compile_definitions(libvpr PRIVATE VPR_USE_SIGACTION)

0 commit comments

Comments
 (0)