Skip to content

Commit

Permalink
Adding HOST_TYPE parameter to configuration rom
Browse files Browse the repository at this point in the history
  • Loading branch information
dpetrisko committed Nov 10, 2024
1 parent f5d6717 commit 66ccc82
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 5 deletions.
1 change: 1 addition & 0 deletions hardware/hardware.mk
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ $(BSG_MACHINE_PATH)/bsg_bladerunner_configuration.rom: $(BSG_MACHINE_PATH)/Makef
@echo $(call dec2bin,$(BSG_MACHINE_IO_EP_CREDITS)) >> $@.temp
@echo $(call dec2bin,0) >> $@.temp
@echo $(call hex2bin,$(CHIP_ID)) >> $@.temp
@echo $(call dec2bin,$(BSG_MACHINE_HOST_TYPE)) >> $@.temp
@cat $(BSG_MACHINE_PATH)/bsg_bladerunner_memsys.rom >> $@.temp
mv $@.temp $@

Expand Down
5 changes: 5 additions & 0 deletions libraries/bsg_manycore_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ int hb_mc_config_init(const hb_mc_config_raw_t raw[HB_MC_CONFIG_MAX],
CHECK_FIELD(HB_MC_CONFIG_IO_HOST_CREDITS_CAP, idx >= HB_MC_HOST_CREDITS_MIN && idx <= HB_MC_HOST_CREDITS_MAX);
config->io_host_credits_cap = idx;

// Host type
idx = raw[HB_MC_CONFIG_HOST_TYPE];
CHECK_FIELD(HB_MC_CONFIG_HOST_TYPE, idx >= HB_MC_HOST_TYPE_PC && idx <= HB_MC_HOST_TYPE_BLACKPARROT);
config->host_type = idx;

err = hb_mc_memsys_init(&raw[HB_MC_CONFIG_MEMSYS], &config->memsys);
if (err != HB_MC_SUCCESS) {
bsg_pr_err("%s: Failed to initialize memory system: %s\n",
Expand Down
8 changes: 7 additions & 1 deletion libraries/bsg_manycore_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ extern "C" {
#define HB_MC_HOST_CREDITS_MIN 1
#define HB_MC_HOST_CREDITS_MAX 32

// PC is off-die x86/ARM, BlackParrot is on-die host
#define HB_MC_HOST_TYPE_PC 0
#define HB_MC_HOST_TYPE_BLACKPARROT 1

typedef hb_mc_rom_word_t hb_mc_config_raw_t;

/* Compilation Metadata */
Expand Down Expand Up @@ -108,6 +112,7 @@ extern "C" {
uint32_t io_host_credits_cap;
uint32_t io_endpoint_max_out_credits;
uint32_t chip_id;
uint32_t host_type;
hb_mc_memsys_t memsys;
} hb_mc_config_t;

Expand Down Expand Up @@ -142,7 +147,8 @@ extern "C" {
HB_MC_CONFIG_IO_HOST_CREDITS_CAP = 26,
HB_MC_CONFIG_IO_EP_MAX_OUT_CREDITS = 27,
HB_MC_CONFIG_CHIP_ID = 28,
HB_MC_CONFIG_MEMSYS = 29,
HB_MC_CONFIG_HOST_TYPE = 29,
HB_MC_CONFIG_MEMSYS = 30,
HB_MC_CONFIG_MAX=HB_MC_CONFIG_MEMSYS + HB_MC_MEMSYS_ROM_IDX_MAX,
} hb_mc_config_id_t;

Expand Down
6 changes: 3 additions & 3 deletions libraries/bsg_manycore_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@ int hb_mc_device_pod_dma_to_device(hb_mc_device_t *device, hb_mc_pod_id_t pod_id
hb_mc_pod_t *pod = &device->pods[pod_id];

// flush cache
if (!device->mc->config.memsys.dma2cache) {
if (device->mc->config.host_type == HB_MC_HOST_TYPE_PC) {
err = hb_mc_manycore_pod_flush_vcache(device->mc, pod->pod_coord);
if (err != HB_MC_SUCCESS) {
bsg_pr_err("%s: failed to flush victim cache: %s\n",
Expand Down Expand Up @@ -2138,7 +2138,7 @@ int hb_mc_device_pod_dma_to_device(hb_mc_device_t *device, hb_mc_pod_id_t pod_id
}

// invalidate cache
if (!device->mc->config.memsys.dma2cache) {
if (device->mc->config.host_type == HB_MC_HOST_TYPE_PC) {
err = hb_mc_manycore_pod_invalidate_vcache(device->mc, pod->pod_coord);
if (err != HB_MC_SUCCESS) {
return err;
Expand All @@ -2159,7 +2159,7 @@ int hb_mc_device_pod_dma_to_host(hb_mc_device_t *device, hb_mc_pod_id_t pod_id,

// flush cache
hb_mc_pod_t *pod = &device->pods[pod_id];
if (!device->mc->config.memsys.dma2cache) {
if (device->mc->config.host_type == 0) {
err = hb_mc_manycore_pod_flush_vcache(device->mc, pod->pod_coord);
if (err != HB_MC_SUCCESS) {
bsg_pr_err("%s: failed to flush victim cache: %s\n",
Expand Down
1 change: 0 additions & 1 deletion libraries/bsg_manycore_memsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ int hb_mc_memsys_set_features(hb_mc_memsys_t *memsys)
memsys->feature_cache = 1;
memsys->feature_dma = 0;
}
memsys->dma2cache = 0;

return HB_MC_SUCCESS;
}
Expand Down
2 changes: 2 additions & 0 deletions libraries/platforms/hammerblade-vcs/execution.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ RISCV_DEFINES += -Dbsg_tiles_X=$(BSG_MACHINE_POD_TILES_X)
RISCV_DEFINES += -Dbsg_tiles_Y=$(BSG_MACHINE_POD_TILES_Y)
include $(BSG_F1_DIR)/examples/cuda/riscv.mk

# TODO: This will always dump waves. To not dump waves, pass TRACE=""
# We should do this automatically on exec.log (not debug.log)
%.log: ZYNQPARROT_EXECUTION_DIR ?= $(ZYNQPARROT_DIR)/cosim/hammerblade-example/vcs
%.log: loader.o clr.riscv
$(MAKE) -C $(ZYNQPARROT_EXECUTION_DIR) clean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 1

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
3 changes: 3 additions & 0 deletions machines/pod_X1Y1_ruche_X16Y8_hbm/Makefile.machine.include
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
3 changes: 3 additions & 0 deletions machines/pod_X1Y1_ruche_X8Y4_hbm/Makefile.machine.include
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
3 changes: 3 additions & 0 deletions machines/pod_X2Y2_ruche_X16Y8_hbm/Makefile.machine.include
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down
3 changes: 3 additions & 0 deletions machines/pod_X4Y4_ruche_X16Y8_hbm/Makefile.machine.include
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ BSG_MACHINE_IO_EP_CREDITS = 32
BSG_MACHINE_IO_HOST_CREDITS = $(BSG_MACHINE_IO_EP_CREDITS)
BSG_MACHINE_IO_REMOTE_LOAD_CAP = $(BSG_MACHINE_IO_EP_CREDITS)

# Host type 0 = off-chip 1 = BlackParrot
BSG_MACHINE_HOST_TYPE = 0

##################### Constants and Computations #####################

# Aliases required for memsys.mk, and others.
Expand Down

0 comments on commit 66ccc82

Please sign in to comment.