Merge branch 'main' into amifix-for-main

This commit is contained in:
Abraham Gonzalez 2022-09-01 10:51:17 -07:00 committed by GitHub
commit 049a349675
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 43 additions and 91 deletions

6
.gitmodules vendored
View File

@ -19,9 +19,3 @@
[submodule "utils/FlameGraph"]
path = utils/fireperf/FlameGraph
url = https://github.com/brendangregg/FlameGraph.git
[submodule "sim/firesim-lib/src/main/cc/lib/elfutils"]
path = sim/firesim-lib/src/main/cc/lib/elfutils
url = https://sourceware.org/git/elfutils.git
[submodule "sim/firesim-lib/src/main/cc/lib/libdwarf"]
path = sim/firesim-lib/src/main/cc/lib/libdwarf
url = https://github.com/davea42/libdwarf-code

View File

@ -255,14 +255,6 @@ if wget -T 1 -t 3 -O /dev/null http://169.254.169.254/; then
fi
# Per-repository dependencies are installed under this sysroot
firesim_local_sysroot=$RDIR/sim/lib-install
cd $RDIR
mkdir -p $firesim_local_sysroot
./scripts/build-libelf.sh $firesim_local_sysroot
./scripts/build-libdwarf.sh $firesim_local_sysroot
env_append "export LD_LIBRARY_PATH=$firesim_local_sysroot/lib\${LD_LIBRARY_PATH:+\":\${LD_LIBRARY_PATH}\"}"
cd $RDIR
set +e
./gen-tags.sh

View File

@ -15,9 +15,8 @@ from datetime import date
import warnings
from cryptography.utils import CryptographyDeprecationWarning
with warnings.catch_warnings():
if date.today() < date(2022, 9, 15):
# get rid of deprecation warnings until 2022-09-15
# hopefully paramiko-ng bumps before then
if date.today() < date(2023, 1, 1):
# Temporarily wave CryptographyDeprecationWarning while we wait on a paramiko-ng release
warnings.filterwarnings('ignore', category=CryptographyDeprecationWarning)
from fabric.api import local, hide, warn_only, env, execute, parallel # type: ignore

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
set -e
if [ $# -ne 1 ]; then
echo "$0 expects one argument, the installation prefix."
exit 1
fi
prefix=$1
# if there are assertions in libdwarf, leave them in
set CPPFLAGS="${CPPFLAGS/-DNDEBUG/}"
cd sim/firesim-lib/src/main/cc/lib/libdwarf
sh scripts/FIX-CONFIGURE-TIMES
mkdir -p build
cd build
# Get libelf from our local sysroot ($prefix)
../configure --prefix="${prefix}" --enable-shared --disable-static CFLAGS="$CFLAGS -g -I${prefix}/include " LDFLAGS="$LDFLAGS -L${prefix}/lib"
make
make install

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
set -e
if [ $# -ne 1 ]; then
echo "$0 expects one argument, the installation prefix."
exit 1
fi
prefix=$1
export CFLAGS+=" -Wno-unused-variable"
# leave the assertions in elfutils
export CPPFLAGS="${CPPFLAGS/-DNDEBUG/}"
cd sim/firesim-lib/src/main/cc/lib/elfutils
test -f configure || autoreconf -i -f
./configure --prefix="${prefix}" --enable-maintainer-mode
make
make install
# The build process modifies tracked sources. This to clean up after ourselves.
git reset --hard

View File

@ -166,13 +166,15 @@ set -o pipefail
# see https://conda-forge.org/docs/user/tipsandtricks.html#multiple-channels
# for more information on strict channel_priority
"${DRY_RUN_ECHO[@]}" $SUDO "$CONDA_EXE" config --system --set channel_priority strict
"${DRY_RUN_ECHO[@]}" $SUDO "$CONDA_EXE" config --system --set channel_priority flexible
# By default, don't mess with people's PS1, I personally find it annoying
"${DRY_RUN_ECHO[@]}" $SUDO "$CONDA_EXE" config --system --set changeps1 false
# don't automatically activate the 'base' environment when intializing shells
"${DRY_RUN_ECHO[@]}" $SUDO "$CONDA_EXE" config --system --set auto_activate_base false
# don't automatically update conda to avoid https://github.com/conda-forge/conda-libmamba-solver-feedstock/issues/2
"${DRY_RUN_ECHO[@]}" $SUDO "$CONDA_EXE" config --system --set auto_update_conda false
# automatically use the ucb-bar channel for specific packages https://anaconda.org/ucb-bar/repo
"${DRY_RUN_ECHO[@]}" $SUDO "$CONDA_EXE" config --system --add channels ucb-bar
# conda-build is a special case and must always be installed into the base environment
$SUDO "$CONDA_EXE" install $DRY_RUN_OPTION -y -n base conda-build
@ -280,6 +282,8 @@ set -o pipefail
dtc \
verilator==4.224 \
screen \
elfutils \
libdwarf-dev==0.0.0.20190110_28_ga81397fc4 \
)
# clang-format for driver coding style enforcement.
CONDA_PACKAGE_SPECS+=( clang-format clang-tools )

1
sim/.gitignore vendored
View File

@ -7,7 +7,6 @@ tags
AsyncResetReg.v
firrtl_black_box_resource_files.f
lib/firrtl.jar
lib-install/
*.swp
.bsp/

View File

@ -12,9 +12,7 @@
#include "dromajo_params.h"
// The maximum number of beats available in the FPGA-side FIFO
#define QUEUE_DEPTH 6144
// Size of PCI intf. in bytes
#define PCIE_SZ_B 64
#define STREAM_WIDTH_B BridgeConstants::STREAM_WIDTH_BYTES;
// Create bitmask macro
#define BIT_MASK(__TYPE__, __ONE_COUNT__) \
((__TYPE__)(-((__ONE_COUNT__) != 0))) & \
@ -229,9 +227,8 @@ int dromajo_t::invoke_dromajo(uint8_t *buf) {
* Read queue and co-simulate
*/
size_t dromajo_t::process_tokens(int num_beats, size_t minimum_batch_beats) {
auto beat_bytes = DMA_DATA_BITS / 8;
size_t maximum_batch_bytes = num_beats * beat_bytes;
size_t minimum_batch_bytes = minimum_batch_beats * beat_bytes;
size_t maximum_batch_bytes = num_beats * STREAM_WIDTH_B;
size_t minimum_batch_bytes = minimum_batch_beats * STREAM_WIDTH_B;
// TODO: as opt can mmap file and just load directly into it.
alignas(4096) char OUTBUF[maximum_batch_bytes];
auto bytes_received =
@ -241,7 +238,8 @@ size_t dromajo_t::process_tokens(int num_beats, size_t minimum_batch_beats) {
if (!this->dromajo_cosim)
return bytes_received;
for (uint32_t offset = 0; offset < bytes_received; offset += PCIE_SZ_B / 2) {
for (uint32_t offset = 0; offset < bytes_received;
offset += STREAM_WIDTH_B / 2) {
// invoke dromajo (requires that buffer is aligned properly)
int rval = this->invoke_dromajo(OUTBUF + offset);
if (rval) {
@ -253,21 +251,21 @@ size_t dromajo_t::process_tokens(int num_beats, size_t minimum_batch_beats) {
fprintf(stderr,
"C[%d] off(%d) token(",
this->_trace_idx,
offset / (PCIE_SZ_B / 2));
offset / (STREAM_WIDTH_B / 2));
for (int32_t i = PCIE_SZ_B - 1; i >= 0; --i) {
for (int32_t i = STREAM_WIDTH_B - 1; i >= 0; --i) {
fprintf(stderr, "%02x", (OUTBUF + offset)[i]);
if (i == PCIE_SZ_B / 2)
if (i == STREAM_WIDTH_B / 2)
fprintf(stderr, " ");
}
fprintf(stderr, ")\n");
fprintf(stderr, "get_next_token token(");
uint32_t next_off = offset += PCIE_SZ_B;
uint32_t next_off = offset += STREAM_WIDTH_B;
for (int32_t i = PCIE_SZ_B - 1; i >= 0; --i) {
for (int32_t i = STREAM_WIDTH_B - 1; i >= 0; --i) {
fprintf(stderr, "%02x", (OUTBUF + next_off)[i]);
if (i == PCIE_SZ_B / 2)
if (i == STREAM_WIDTH_B / 2)
fprintf(stderr, " ");
}
fprintf(stderr, ")\n");
@ -285,15 +283,15 @@ size_t dromajo_t::process_tokens(int num_beats, size_t minimum_batch_beats) {
this->saw_int_excp = false;
}
// add an extra PCIE_SZ_B if there is an odd amount of traces
// add an extra STREAM_WIDTH_B if there is an odd amount of traces
if (this->_trace_idx == 0 && (this->_num_traces % 2 == 1)) {
#ifdef DEBUG
fprintf(stderr,
"off(%d + 1) = %d\n",
offset / (PCIE_SZ_B / 2),
(offset + PCIE_SZ_B / 2) / (PCIE_SZ_B / 2));
offset / (STREAM_WIDTH_B / 2),
(offset + STREAM_WIDTH_B / 2) / (STREAM_WIDTH_B / 2));
#endif
offset += PCIE_SZ_B / 2;
offset += STREAM_WIDTH_B / 2;
}
}

View File

@ -19,7 +19,7 @@
#define SIMLATENCY_BT (this->LINKLATENCY / TOKENS_PER_BIGTOKEN)
#define BUFWIDTH (512 / 8)
#define BUFWIDTH BridgeConstants::STREAM_WIDTH_BYTES
#define BUFBYTES (SIMLATENCY_BT * BUFWIDTH)
#define EXTRABYTES 1

View File

@ -218,10 +218,12 @@ void tracerv_t::init() {
}
size_t tracerv_t::process_tokens(int num_beats, int minimum_batch_beats) {
size_t maximum_batch_bytes = num_beats * DMA_BEAT_BYTES;
size_t minimum_batch_bytes = minimum_batch_beats * DMA_BEAT_BYTES;
size_t maximum_batch_bytes = num_beats * BridgeConstants::STREAM_WIDTH_BYTES;
size_t minimum_batch_bytes =
minimum_batch_beats * BridgeConstants::STREAM_WIDTH_BYTES;
// TODO. as opt can mmap file and just load directly into it.
alignas(4096) uint64_t OUTBUF[this->stream_depth * DMA_BEAT_BYTES];
alignas(4096)
uint64_t OUTBUF[this->stream_depth * BridgeConstants::STREAM_WIDTH_BYTES];
auto bytes_received = pull(this->stream_idx,
(char *)OUTBUF,
maximum_batch_bytes,

@ -1 +0,0 @@
Subproject commit e8f8dc465a1fa496aa627a330886c0f70f98d4c0

@ -1 +0,0 @@
Subproject commit a81397fc41fa171a604235299242edd80f81a7fe

View File

@ -5,6 +5,18 @@
#include "simif.h"
namespace BridgeConstants {
/**
* @brief Logical byte width of Bridge streams
*
* Bridge streams are logically latency-insensitive FIFOs with a width of
* \c STREAM_WIDTH_BYTES.
* \note { The host-implementation may use a different width under-the-hood but
* this should not be exposed to bridge developers. }
*/
constexpr int STREAM_WIDTH_BYTES = 64;
} // namespace BridgeConstants
// DOC include start: Bridge Driver Interface
/**
* @brief Base class for Bridge Drivers

View File

@ -83,7 +83,7 @@ private:
const int printno;
// DMA batching parameters
const size_t beat_bytes = DMA_DATA_BITS / 8;
static constexpr size_t beat_bytes = BridgeConstants::STREAM_WIDTH_BYTES;
// The number of DMA beats to pull off the FPGA on each invocation of tick()
// This will be set based on the ratio of token_size : desired_batch_beats
size_t batch_beats;

View File

@ -102,11 +102,8 @@ DRIVER_CC = \
$(DROMAJO_LIB) \
$(TESTCHIPIP_CSRC_DIR)/testchip_tsi.cc
# Per-repository dependencies (e.g., libdwarf) are installed under this sysroot
firesim_local_sysroot = $(firesim_base_dir)/lib-install
TARGET_CXX_FLAGS += -g -I$(TESTCHIPIP_CSRC_DIR) -I$(firesim_lib_dir) -I$(firesim_local_sysroot)/include -I$(driver_dir)/firesim -I$(RISCV)/include -I$(DROMAJO_DIR) -I$(GENERATED_DIR)
TARGET_LD_FLAGS += -L$(RISCV)/lib -L$(firesim_local_sysroot)/lib -l:libdwarf.so -l:libelf.so -lz -L$(DROMAJO_DIR) -l$(DROMAJO_LIB_NAME)
TARGET_CXX_FLAGS += -g -I$(TESTCHIPIP_CSRC_DIR) -I$(firesim_lib_dir) -I$(CONDA_PREFIX)/include -I$(driver_dir)/firesim -I$(RISCV)/include -I$(DROMAJO_DIR) -I$(GENERATED_DIR)
TARGET_LD_FLAGS += -L$(RISCV)/lib -L$(CONDA_PREFIX)/lib -l:libdwarf.so -l:libelf.so -lz -L$(DROMAJO_DIR) -l$(DROMAJO_LIB_NAME)
# DOC include end: Bridge Build System Changes
#######################################