Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the Dromajo Platform #721

Open
wants to merge 70 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
3373921
compilation.mk
sripathi-muralitharan Apr 25, 2021
e0786eb
hardware.mk
sripathi-muralitharan Apr 25, 2021
3bd401b
execution.mk
sripathi-muralitharan Apr 25, 2021
a8dd554
library.mk
sripathi-muralitharan Apr 25, 2021
65adfb3
link.mk
sripathi-muralitharan Apr 25, 2021
d4c714f
hardware/dpi_top.sv
sripathi-muralitharan Apr 25, 2021
501d63a
bsg_manycore_platform.cpp
sripathi-muralitharan Apr 25, 2021
e26510e
bsg_manycore_simulator.cpp
sripathi-muralitharan Apr 25, 2021
01aa184
Adding a .gitignore file
sripathi-muralitharan Apr 25, 2021
d8d288b
Adding a dummy features.h and endian.h header files to point to newli…
sripathi-muralitharan Apr 25, 2021
d63b464
Include files for Dromajo
sripathi-muralitharan Apr 25, 2021
f078785
Implementations of file lock and unlock functions
sripathi-muralitharan Apr 25, 2021
050b138
Adding the argument parsing library
sripathi-muralitharan Apr 25, 2021
03f70e6
Adding BlackParrot specific files
sripathi-muralitharan Apr 25, 2021
0e49e39
libraries.mk
sripathi-muralitharan Apr 25, 2021
0aa312b
Moving manycore read and write functions to bp_utils
sripathi-muralitharan Apr 25, 2021
9db8fd7
Modifying start code to read arguments from the host
sripathi-muralitharan Apr 25, 2021
23e958b
Recompiling dromajo with -fPIC
sripathi-muralitharan Apr 29, 2021
0a8998a
Updates to argument parsing, accounting for increased FIFO elements, …
sripathi-muralitharan Apr 29, 2021
2016fe7
Adds manycore regression platform header, VCS C argument parser and m…
sripathi-muralitharan Apr 30, 2021
f7b456e
Gitignore updates
sripathi-muralitharan Apr 30, 2021
7d53d46
Aesthestics and adding cleans to target; Completing platform-level AP…
sripathi-muralitharan Apr 30, 2021
6e33293
Compiling DRAMSim3 and DMA memory libraries with the x86 simulator
sripathi-muralitharan Apr 30, 2021
b7f2542
Various fixes
sripathi-muralitharan May 3, 2021
f12564b
Implementing wait for reset platform call
sripathi-muralitharan May 3, 2021
401a9a7
Using dpi_top.sv from dromajo-vcs instead of bigblade-vcs
sripathi-muralitharan May 3, 2021
2de2c40
Specifies objects explicitly to link
sripathi-muralitharan May 6, 2021
3922ee0
Multiple fixes
sripathi-muralitharan May 6, 2021
cc1708e
Fixing review comments
sripathi-muralitharan May 6, 2021
de49f3d
Updates to the simulation flow
sripathi-muralitharan May 17, 2021
e8e37d4
Credit refactor
sripathi-muralitharan May 17, 2021
3cc0e00
Add comments
sripathi-muralitharan Jun 22, 2021
df98c71
Refactoring a lot of stuff
sripathi-muralitharan Jun 22, 2021
6669a15
Various Updates
sripathi-muralitharan Jun 23, 2021
25f0cf3
* Always inline argp_fmtstream functions (most of them atleast)
sripathi-muralitharan Jun 23, 2021
3007866
Bug fixes
sripathi-muralitharan Jun 24, 2021
fc34d6d
Switching from using basename to using the string itself
sripathi-muralitharan Jun 26, 2021
44d5db7
Making functions visible and static inline
sripathi-muralitharan Jun 26, 2021
e24ccec
Various updates
sripathi-muralitharan Jun 28, 2021
6338c07
Separating assigments and conditionals
sripathi-muralitharan Jul 8, 2021
8ff6a52
Removing newlines and whitespaces
sripathi-muralitharan Jul 8, 2021
91bad5e
Clean platform shared object files
sripathi-muralitharan Jul 8, 2021
6b6b0df
Add deprecation note to start code
sripathi-muralitharan Jul 8, 2021
7afde55
Clarify the use of these headers
sripathi-muralitharan Jul 8, 2021
2fb75a1
Add separate rules to generate lfs.cpp and compile it
sripathi-muralitharan Jul 8, 2021
e9b0123
Create README.md
sripathi-muralitharan Jul 9, 2021
24796f3
Add links to dependencies
sripathi-muralitharan Jul 9, 2021
a407e35
Add link to TRM
sripathi-muralitharan Jul 10, 2021
51ed941
Qualifying author comments from original comments in this copied libr…
sripathi-muralitharan Jul 13, 2021
d010cce
Refactor
sripathi-muralitharan Jul 13, 2021
157585c
Getting rid of git merge artifacts
sripathi-muralitharan Jul 13, 2021
5b7e038
Add BlackParrot coordinates
sripathi-muralitharan Jul 13, 2021
cbacfda
Addressing review comments
sripathi-muralitharan Jul 14, 2021
bab8785
Addressing more review comments
sripathi-muralitharan Jul 16, 2021
54ffd57
Fixing alloca to malloc inversion in argp library
sripathi-muralitharan Jul 17, 2021
3961bfd
Addressing review comments
sripathi-muralitharan Jul 17, 2021
3c0ac03
Some Aesthetics and Simulation updates
sripathi-muralitharan Jul 20, 2021
a00d456
Addressing review comments; Better error messages and reporting
sripathi-muralitharan Aug 1, 2021
6aa884b
Incomplete: Fixing argument retrieval
sripathi-muralitharan Aug 2, 2021
faae961
Various Updates
sripathi-muralitharan Aug 8, 2021
8c49a9e
Some more updates
sripathi-muralitharan Aug 9, 2021
a39f83b
Fix pattern rule in execution.mk
sripathi-muralitharan Aug 9, 2021
c9fe26d
Preparing for compiling for SPMD/CUDA-lite programs
sripathi-muralitharan Aug 19, 2021
e64201d
Various updates
sripathi-muralitharan Aug 20, 2021
9c6a5ba
Adding an assembly file to include the manycore binary; Incomplete
sripathi-muralitharan Aug 20, 2021
397cf4e
Validating existence of manycore binary in the appropriate locations
sripathi-muralitharan Aug 23, 2021
ee7687b
Put manycore in RODATA instead; Updates to linker and name modifications
sripathi-muralitharan Aug 29, 2021
274da73
Modifying loader to directly read the location of the binary
sripathi-muralitharan Sep 1, 2021
c326d16
Flow updates
sripathi-muralitharan Sep 1, 2021
5eed2eb
Cleaning up SPMD loader
sripathi-muralitharan Sep 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ ucli.key
*.saifgen
*.json
dramsim3.txt
*.riscv
*.elf

2 changes: 1 addition & 1 deletion examples/library/test_manycore_packets/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,4 @@ int test_manycore_packets(int argc, char *argv[]) {
return HB_MC_SUCCESS;
}

declare_program_main(basename(__FILE__), test_manycore_packets);
declare_program_main("test_manycore_packets", test_manycore_packets);
6 changes: 5 additions & 1 deletion libraries/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
*.o
*.so
*.so.1
*.so.1.0
*.so.1.0
*.riscv
*.a
*.a.1
*.a.1.0
5 changes: 5 additions & 0 deletions libraries/bsg_manycore_epa.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ extern "C" {
#define HB_MC_GLOBAL_EPA_LOGSZ 16

#define HB_MC_HOST_EPA_FINISH 0xEAD0
#define HB_MC_HOST_EPA_TIME 0xEAD4
#define HB_MC_HOST_EPA_FAIL 0xEAD8
#define HB_MC_HOST_EPA_STDOUT 0xEADC
#define HB_MC_HOST_EPA_STDERR 0xEAE0
#define HB_MC_HOST_EPA_BRANCH_TRACE 0xEAE4
#define HB_MC_HOST_EPA_PRINT_STAT 0xEA0C
#define EPA_FROM_BASE_AND_OFFSET(base, offset) \
(((base)+(offset)))

Expand Down
2 changes: 2 additions & 0 deletions libraries/features/dma/noimpl/feature.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ $(DMA_FEATURE_OBJECTS): CXXFLAGS := -std=c++11 -fPIC -D_GNU_SOURCE -D_DEFAULT_SO

$(BSG_PLATFORM_PATH)/libbsg_manycore_runtime.so.1.0: $(DMA_FEATURE_OBJECTS)

$(BSG_PLATFORM_PATH)/libbsg_manycore_runtime.a: $(DMA_FEATURE_OBJECTS)

sripathi-muralitharan marked this conversation as resolved.
Show resolved Hide resolved
.PHONY: dma_feature.clean
dma_feature.clean:
rm -f $(DMA_FEATURE_OBJECTS)
Expand Down
1 change: 1 addition & 0 deletions libraries/features/dma/simulation/feature.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ $(DMA_FEATURE_OBJECTS): CXXFLAGS := -std=c++11 -fPIC $(INCLUDES) -D_GNU_SOURCE -

$(BSG_PLATFORM_PATH)/libbsg_manycore_runtime.so.1.0: $(DMA_FEATURE_OBJECTS)

$(BSG_PLATFORM_PATH)/libbsg_manycore_runtime.a: $(DMA_FEATURE_OBJECTS)

.PHONY: dma_feature.clean
dma_feature.clean:
Expand Down
2 changes: 1 addition & 1 deletion libraries/features/dma/simulation/libdmamem.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ dmamem.clean:
libraries.clean: dmamem.clean

# Rules for building Simulation "DMA library"
$(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so: CXXFLAGS += -std=c++11 -D_GNU_SOURCE -D_DEFAULT_SOURCE -Wall -fPIC -shared
$(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so: CXXFLAGS := -std=c++11 -D_GNU_SOURCE -D_DEFAULT_SOURCE -Wall -fPIC -shared
$(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so: CXXFLAGS += -I$(BASEJUMP_STL_DIR)/bsg_mem
$(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so: CXXFLAGS += -DBASEJUMP_STL_DIR="$(BASEJUMP_STL_DIR)"
$(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so: CXX=g++
Expand Down
26 changes: 24 additions & 2 deletions libraries/libraries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
ifndef __BSG_LIBRARIES_MK
__BSG_LIBRARIES_MK := 1

LIB_SSOURCES +=
LIB_CSOURCES +=
LIB_CSOURCES += $(LIBRARIES_PATH)/bsg_manycore_config_id_to_string.c
LIB_CSOURCES += $(LIBRARIES_PATH)/bsg_manycore_memsys.c
Expand Down Expand Up @@ -99,6 +100,7 @@ LIB_DEBUG_OBJECTS +=

LIB_OBJECTS += $(patsubst %cpp,%o,$(LIB_CXXSOURCES))
LIB_OBJECTS += $(patsubst %c,%o,$(LIB_CSOURCES))
LIB_OBJECTS += $(patsubst %S,%o,$(LIB_SSOURCES))

LIB_OBJECTS_CUDA_POD_REPL += $(patsubst %cpp,%o,$(LIB_CXXSOURCES_CUDA_POD_REPL))
LIB_OBJECTS_REGRESSION += $(patsubst %cpp,%o,$(LIB_CXXSOURCES_REGRESSION))
Expand All @@ -114,10 +116,14 @@ $(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): INCLUDES
$(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): INCLUDES += -I$(LIBRARIES_PATH)/xcl
$(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): INCLUDES += -I$(LIBRARIES_PATH)/features/dma
$(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): INCLUDES += -I$(LIBRARIES_PATH)/features/profiler
$(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): INCLUDES += -I$(LIBRARIES_PATH)/features/tracer
$(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): INCLUDES += -I$(BSG_PLATFORM_PATH)
# A way to add include paths for the platform; This can't be a part of the platform's library.mk because of the overriding
# definition of the variables in this flow.
$(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): INCLUDES += $(LIB_PLATFORM_INCLUDES)
sripathi-muralitharan marked this conversation as resolved.
Show resolved Hide resolved

$(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): CFLAGS += -std=c11 -fPIC $(INCLUDES) -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE
$(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): CXXFLAGS += -std=c++11 -fPIC $(INCLUDES) -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE
$(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): CFLAGS += -O3 -std=c11 -fPIC -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE
$(LIB_OBJECTS) $(LIB_OBJECTS_CUDA_POD_REPL) $(LIB_OBJECTS_REGRESSION): CXXFLAGS += -O3 -std=c++11 -fPIC -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE
# Need to move this, eventually
#$(LIB_OBJECTS) $(PLATFORM_OBJECTS): $(BSG_MACHINE_PATH)/bsg_manycore_machine.h

Expand All @@ -135,21 +141,37 @@ $(BSG_PLATFORM_PATH)/libbsg_manycore_runtime.so.1.0: $(LIB_OBJECTS)

$(BSG_PLATFORM_PATH)/libbsgmc_cuda_legacy_pod_repl.so.1.0: LDFLAGS :=
$(BSG_PLATFORM_PATH)/libbsgmc_cuda_legacy_pod_repl.so.1.0: INCLUDES :=

$(BSG_PLATFORM_PATH)/libbsgmc_cuda_legacy_pod_repl.so.1.0: LD = $(CXX)
$(BSG_PLATFORM_PATH)/libbsgmc_cuda_legacy_pod_repl.so.1.0: $(LIB_OBJECTS_CUDA_POD_REPL)
$(LD) -shared -Wl,-soname,$(basename $(notdir $@)) -o $@ $^ $(LDFLAGS)

$(BSG_PLATFORM_PATH)/libbsg_manycore_regression.so.1.0: LDFLAGS :=
$(BSG_PLATFORM_PATH)/libbsg_manycore_regression.so.1.0: INCLUDES :=

$(BSG_PLATFORM_PATH)/libbsg_manycore_regression.so.1.0: LD = $(CXX)
$(BSG_PLATFORM_PATH)/libbsg_manycore_regression.so.1.0: $(LIB_OBJECTS_REGRESSION)
$(LD) -shared -Wl,-soname,$(basename $(notdir $@)) -o $@ $^ $(LDFLAGS)

$(BSG_PLATFORM_PATH)/libbsg_manycore_runtime.a: $(LIB_OBJECTS)
$(AR) -rcs $@ $^

$(BSG_PLATFORM_PATH)/libbsgmc_cuda_legacy_pod_repl.a: $(LIB_OBJECTS_CUDA_POD_REPL)
$(AR) -rcs $@ $^

$(BSG_PLATFORM_PATH)/libbsg_manycore_regression.a: $(LIB_OBJECTS_REGRESSION)
$(AR) -rcs $@ $^

drichmond marked this conversation as resolved.
Show resolved Hide resolved
.PHONY: libraries.clean
libraries.clean:
rm -f $(LIB_OBJECTS)
rm -f $(LIB_OBJECTS_CUDA_POD_REPL)
rm -f $(LIB_OBJECTS_REGRESSION)
rm -f $(BSG_PLATFORM_PATH)/libbsg_manycore_runtime.so.1.0
rm -f $(BSG_PLATFORM_PATH)/libbsgmc_cuda_legacy_pod_repl.so.1.0
rm -f $(BSG_PLATFORM_PATH)/libbsg_manycore_regression.so.1.0
rm -f $(BSG_PLATFORM_PATH)/libbsg_manycore_runtime.a
rm -f $(BSG_PLATFORM_PATH)/libbsgmc_cuda_legacy_pod_repl.a
rm -f $(BSG_PLATFORM_PATH)/libbsg_manycore_regression.a

endif
1 change: 1 addition & 0 deletions libraries/platforms/dromajo-vcs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lfs.cpp
drichmond marked this conversation as resolved.
Show resolved Hide resolved
76 changes: 76 additions & 0 deletions libraries/platforms/dromajo-vcs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Dromajo HammerBlade Platform on VCS

## Introduction

The Dromajo-HammerBlade platform is a precursor to the BlackParrot-HammerBlade platform a.k.a HammerParrot. It builds on the traditional x86 setup and replaces x86 with Dromajo as the main host (except for a few operations) that executes the CUDA-lite program. Broadly speaking there are three main components to the entire system

- x86: It is the base platform on which the entire simulation infrastructure is built. In a traditional setup, the x86 core runs the CUDA-lite binary while simulating the manycore hardware. In this case, the x86 core instead runs the Dromajo emulator in addition to simulating the manycore hardware whilst performing some host-like operations and interacting with the hardware through DPI.
- Dromajo: A C++ based 64-bit RISC-V processor emulator developed by Esperanto Technologies with modifications to communicate with the HammerBlade manycore. All CUDA-lite host code is executed by a RISC-V processor emulated by Dromajo. Since, HammerParrot is the eventual goal, Dromajo has been modified to work like BlackParrot.
- HammerBlade hardware: Like all other platforms, the manycore hardware consists of the manycore with a specific machine configuration and is equipped with DPI FIFOs on the west side forming the manycore bridge.

## Dependencies

### BlackParrot SDK

The [BlackParrot SDK](https://github.com/black-parrot-sdk/black-parrot-sdk) contains multiple submodules
- [Dromajo](https://github.com/bsg-external/dromajo/tree/4cbf5d91b880e172f15e0658cc72d4d6426ddcaa), the 64-bit RISC-V emulator
- [Perch](https://github.com/black-parrot-sdk/perch/tree/f3a302b3a902e80952aa8b3b8649713398d1b749), the BlackParrot firmware
- [PanicRoom](https://github.com/bespoke-silicon-group/bsg_newlib_dramfs/tree/28b5ac5a75847f346b54a91d4b9b9f58a62b590e), a RISC-V Newlib compiler with support for some system calls and a minimal filesystem.

This directory must be placed at the same level as the replicant repository. It is recommended that users clone the Bladerunner meta repository which includes (or will include) the BlackParrot SDK as a submodule [(PR #66)](https://github.com/bespoke-silicon-group/bsg_bladerunner/pull/66) since this will set all the required environment variables correctly. Otherwise users must define the BLACKPARROT_SDK_DIR variable for the given execution environment.

## Technical Reference Manual

Click [here](https://docs.google.com/document/d/1kUtyD3SiXP2qvbUDhtpx_eFufegscQs2cWla3pcxA-Q/edit?usp=sharing) to access the technical reference manual.

## Using the Simulation Infrastructure

The simulation infrastructure can be used just like any other platform. An example is given below.

```
cd examples/library/test_coordinate
make main.exec.log
```

This will build the libraries and the platform binaries, compile and elaborate the hardware and run the test program. The example output for the above program should look as given below

```
BSG INFO: Regression Test: test_coordinate
INFO: Starting test foreach_coordinate
INFO: iteration 0: (0,0)
INFO: Starting test foreach_x_y
INFO: iteration 0: (0,0)
INFO: Starting test foreach_coordinate
INFO: iteration 0: (0,0)
INFO: iteration 1: (1,0)
INFO: Starting test foreach_x_y
INFO: iteration 0: (0,0)
INFO: iteration 1: (1,0)
INFO: Starting test foreach_coordinate
INFO: iteration 0: (0,0)
INFO: iteration 1: (0,1)
INFO: Starting test foreach_x_y
INFO: iteration 0: (0,0)
INFO: iteration 1: (0,1)
INFO: Starting test foreach_coordinate
INFO: iteration 0: (0,2)
INFO: iteration 1: (0,3)
INFO: iteration 2: (1,2)
INFO: iteration 3: (1,3)
INFO: Starting test foreach_x_y
INFO: iteration 0: (0,2)
INFO: iteration 1: (0,3)
INFO: iteration 2: (1,2)
INFO: iteration 3: (1,3)
BSG REGRESSION TEST PASSED
INFO: Core 0 successfully terminated
BSG REGRESSION TEST PASSED
BSG COSIM PASS: Test passed!
```

### Notes

- This infrastructure has only been tested with tests in `examples/library`. SPMD and CUDA-lite testing is still remaining.
- All testing has been carried out for a single pod configuration.
- Only the `exec` make target has been tested. The `saif` and `debug` targets still remain to be tested. However, since this pertains to gathering metrics with respect to the hardware being simulated, there is a fair amount of confidence that it will work right out of the box.
- The simulation takes a very long time even for some of the library tests. This can be attributed to the fact that Dromajo is used in co-simulation mode (one instruction per time step) with code executing on the x86 core controlling the notion of time for the whole system. Dromajo also has a standalone mode in which case it must become the driver of time for the whole system. While the reason mentioned here should be verified after an in-depth performance analysis of the system, it is still worthwhile to explore Dromajo in the standalone mode. This is one of major barriers to running CUDA-lite test programs and completing its execution in a reasonable time frame.
Loading