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

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

libs/libvtrutil/CMakeLists.txt

Lines changed: 21 additions & 1 deletion
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

0 commit comments

Comments
 (0)