Skip to content

Commit

Permalink
[AP] Updated CI to Support Eigen
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreSinger committed Oct 5, 2024
1 parent 2bb707c commit fbfe638
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 30 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,57 +139,68 @@ jobs:
{
name: 'Basic',
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on',
suite: 'vtr_reg_basic'
suite: 'vtr_reg_basic',
extra_pkgs: ""
},
{
name: 'Basic with highest assertion level',
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=4 -DWITH_BLIFEXPLORER=on',
suite: 'vtr_reg_basic'
suite: 'vtr_reg_basic',
extra_pkgs: ""
},
{
name: 'Basic_odin',
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DWITH_PARMYS=OFF -DWITH_ODIN=on',
suite: 'vtr_reg_basic_odin'
suite: 'vtr_reg_basic_odin',
extra_pkgs: ""
},
{
name: 'Basic with NO_GRAPHICS',
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVPR_USE_EZGL=off',
suite: 'vtr_reg_basic'
suite: 'vtr_reg_basic',
extra_pkgs: ""
},
{
name: 'Basic with NO_SERVER',
params: '-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVPR_USE_EZGL=on -DVPR_USE_SERVER=off',
suite: 'vtr_reg_basic'
suite: 'vtr_reg_basic',
extra_pkgs: ""
},
{
name: 'Basic with CAPNPROTO disabled',
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_CAPNPROTO=off',
suite: 'vtr_reg_basic'
suite: 'vtr_reg_basic',
extra_pkgs: ""
},
{
name: 'Basic with VTR_ENABLE_DEBUG_LOGGING',
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_DEBUG_LOGGING=on',
suite: 'vtr_reg_basic'
suite: 'vtr_reg_basic',
extra_pkgs: ""
},
{
name: 'Basic_odin with VTR_ENABLE_DEBUG_LOGGING',
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DVTR_ENABLE_DEBUG_LOGGING=on -DWITH_PARMYS=OFF -DWITH_ODIN=on',
suite: 'vtr_reg_basic_odin'
suite: 'vtr_reg_basic_odin',
extra_pkgs: ""
},
{
name: 'Strong',
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on',
suite: 'vtr_reg_strong'
suite: 'vtr_reg_strong',
extra_pkgs: "libeigen3-dev"
},
{
name: 'Strong_odin',
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DWITH_PARMYS=OFF -DWITH_ODIN=on',
suite: 'vtr_reg_strong_odin'
suite: 'vtr_reg_strong_odin',
extra_pkgs: ""
},
{
name: 'Valgrind Memory',
params: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DWITH_ODIN=on',
suite: 'vtr_reg_valgrind_small'
suite: 'vtr_reg_valgrind_small',
extra_pkgs: ""
}
]
name: 'R: ${{ matrix.name }}'
Expand All @@ -198,10 +209,17 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: 3.10.10

- uses: actions/checkout@v4
with:
submodules: 'true'
- run: ./.github/scripts/install_dependencies.sh

- name: Install dependencies
run: ./.github/scripts/install_dependencies.sh

- name: Install external libraries
run: sudo apt install -y ${{ matrix.extra_pkgs }}
if: ${{ matrix.extra_pkgs }}

- uses: hendrikmuhs/[email protected]

Expand Down
18 changes: 15 additions & 3 deletions vpr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,27 @@ add_library(libvpr STATIC

target_include_directories(libvpr PUBLIC ${LIB_INCLUDE_DIRS})


# Find if Eigen is installed. Eigen is used within the Analytical Solver of the
# Analytical Placement flow. If Eigen is not installed, certain solvers cannot
# be used.
find_package(Eigen3 3.3 NO_MODULE)
if (TARGET Eigen3::Eigen)
target_link_libraries (libvpr Eigen3::Eigen)
target_compile_definitions(libvpr PUBLIC -DEIGEN_INSTALLED)
message(STATUS "Eigen3: Found")
else ()
message(STATUS "Eigen3: Not Found. Some features may be disabled.")
endif (TARGET Eigen3::Eigen)

#VPR_ANALYTIC_PLACE is initialized in the root CMakeLists
#Check Eigen dependency
# NOTE: This is the cluster-level Analytical Placement which existed before the
# flat Analytical Placement flow.
if(${VPR_ANALYTIC_PLACE})
message(STATUS "VPR Analytic Placement: Requested")
find_package(Eigen3 3.3 NO_MODULE)
if (TARGET Eigen3::Eigen)
message(STATUS "VPR Analytic Placement dependency (Eigen3): Found")
message(STATUS "VPR Analytic Placement: Enabled")
target_link_libraries (libvpr Eigen3::Eigen)
target_compile_definitions(libvpr PUBLIC -DENABLE_ANALYTIC_PLACE)
else ()
message(STATUS "VPR Analytic Placement dependency (Eigen3): Not Found (Download manually with sudo apt install libeigen3-dev, and rebuild)")
Expand Down
24 changes: 19 additions & 5 deletions vpr/src/analytical_place/analytical_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
*/

#include "analytical_solver.h"
#include <Eigen/src/SparseCore/SparseMatrix.h>
#include <Eigen/SVD>
#include <Eigen/Sparse>
#include <Eigen/Eigenvalues>
#include <Eigen/IterativeLinearSolvers>
#include <cstddef>
#include <cstdio>
#include <memory>
Expand All @@ -23,12 +18,27 @@
#include "vtr_assert.h"
#include "vtr_vector.h"

#ifdef EIGEN_INSTALLED
#include <Eigen/src/SparseCore/SparseMatrix.h>
#include <Eigen/SVD>
#include <Eigen/Sparse>
#include <Eigen/Eigenvalues>
#include <Eigen/IterativeLinearSolvers>
#endif // EIGEN_INSTALLED

std::unique_ptr<AnalyticalSolver> make_analytical_solver(e_analytical_solver solver_type,
const APNetlist& netlist) {
// Based on the solver type passed in, build the solver.
switch (solver_type) {
case e_analytical_solver::QP_HYBRID:
#ifdef EIGEN_INSTALLED
return std::make_unique<QPHybridSolver>(netlist);
#else
(void)netlist;
VPR_FATAL_ERROR(VPR_ERROR_AP,
"QP Hybrid Solver requires the Eigen library");
break;
#endif // EIGEN_INSTALLED
default:
VPR_FATAL_ERROR(VPR_ERROR_AP,
"Unrecognized analytical solver type");
Expand Down Expand Up @@ -57,6 +67,8 @@ AnalyticalSolver::AnalyticalSolver(const APNetlist& netlist)
}
}

#ifdef EIGEN_INSTALLED

void QPHybridSolver::init_linear_system() {
// Count the number of star nodes that the netlist will have.
size_t num_star_nodes = 0;
Expand Down Expand Up @@ -248,3 +260,5 @@ void QPHybridSolver::solve(unsigned iteration, PartialPlacement &p_placement) {
}
}

#endif // EIGEN_INSTALLED

11 changes: 10 additions & 1 deletion vpr/src/analytical_place/analytical_solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
#pragma once

#include <memory>
#include "Eigen/Sparse"
#include "ap_netlist_fwd.h"
#include "vtr_strong_id.h"
#include "vtr_vector.h"

#ifdef EIGEN_INSTALLED
#include "Eigen/Sparse"
#endif // EIGEN_INSTALLED

// Forward declarations
class PartialPlacement;
class APNetlist;
Expand Down Expand Up @@ -105,6 +108,10 @@ class AnalyticalSolver {
std::unique_ptr<AnalyticalSolver> make_analytical_solver(e_analytical_solver solver_type,
const APNetlist &netlist);

// The Eigen library is used to solve matrix equations in the following solvers.
// The solver cannot be built if Eigen is not installed.
#ifdef EIGEN_INSTALLED

/**
* @brief An Analytical Solver which tries to minimize the quadratic HPWL
* objective:
Expand Down Expand Up @@ -203,3 +210,5 @@ class QPHybridSolver : public AnalyticalSolver {
void solve(unsigned iteration, PartialPlacement &p_placement) final;
};

#endif // EIGEN_INSTALLED

This file was deleted.

4 changes: 0 additions & 4 deletions vtr_flow/tasks/regression_tests/vtr_reg_basic/task_list.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
regression_tests/vtr_reg_basic/basic_ap/single_wire
regression_tests/vtr_reg_basic/basic_ap/single_ff
regression_tests/vtr_reg_basic/basic_ap/ch_intrinsics
regression_tests/vtr_reg_basic/basic_ap/diffeq1
regression_tests/vtr_reg_basic/basic_no_timing
regression_tests/vtr_reg_basic/basic_timing
regression_tests/vtr_reg_basic/basic_timing_no_sdc
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This extra task list is for running just the basic_ap tasks in isolation.
regression_tests/vtr_reg_strong/basic_ap/single_wire
regression_tests/vtr_reg_strong/basic_ap/single_ff
regression_tests/vtr_reg_strong/basic_ap/ch_intrinsics
regression_tests/vtr_reg_strong/basic_ap/diffeq1
4 changes: 4 additions & 0 deletions vtr_flow/tasks/regression_tests/vtr_reg_strong/task_list.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
regression_tests/vtr_reg_strong/basic_ap/single_wire
regression_tests/vtr_reg_strong/basic_ap/single_ff
regression_tests/vtr_reg_strong/basic_ap/ch_intrinsics
regression_tests/vtr_reg_strong/basic_ap/diffeq1
regression_tests/vtr_reg_strong/strong_absorb_buffers
regression_tests/vtr_reg_strong/strong_analysis_only
regression_tests/vtr_reg_strong/strong_analytic_placer
Expand Down

0 comments on commit fbfe638

Please sign in to comment.