diff --git a/hardware/hardware.mk b/hardware/hardware.mk index d6db059be..cf4304cfc 100644 --- a/hardware/hardware.mk +++ b/hardware/hardware.mk @@ -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 $@ diff --git a/libraries/bsg_manycore_config.cpp b/libraries/bsg_manycore_config.cpp index b7298eca3..d2f391045 100644 --- a/libraries/bsg_manycore_config.cpp +++ b/libraries/bsg_manycore_config.cpp @@ -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", diff --git a/libraries/bsg_manycore_config.h b/libraries/bsg_manycore_config.h index 0956dfaa4..db2b5814f 100644 --- a/libraries/bsg_manycore_config.h +++ b/libraries/bsg_manycore_config.h @@ -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 */ @@ -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; @@ -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; diff --git a/libraries/bsg_manycore_cuda.cpp b/libraries/bsg_manycore_cuda.cpp index 6df811f60..f1a2e0df4 100644 --- a/libraries/bsg_manycore_cuda.cpp +++ b/libraries/bsg_manycore_cuda.cpp @@ -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", @@ -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; @@ -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", diff --git a/libraries/bsg_manycore_memsys.c b/libraries/bsg_manycore_memsys.c index 45eabfad7..6d574918a 100644 --- a/libraries/bsg_manycore_memsys.c +++ b/libraries/bsg_manycore_memsys.c @@ -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; } diff --git a/libraries/platforms/hammerblade-vcs/execution.mk b/libraries/platforms/hammerblade-vcs/execution.mk index 60159bb3d..c21177cc6 100644 --- a/libraries/platforms/hammerblade-vcs/execution.mk +++ b/libraries/platforms/hammerblade-vcs/execution.mk @@ -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 diff --git a/machines/pod_X1Y1_mesh_X2Y2_hbm_one_pseudo_channel/Makefile.machine.include b/machines/pod_X1Y1_mesh_X2Y2_hbm_one_pseudo_channel/Makefile.machine.include index 7a07fd896..e6da7862b 100644 --- a/machines/pod_X1Y1_mesh_X2Y2_hbm_one_pseudo_channel/Makefile.machine.include +++ b/machines/pod_X1Y1_mesh_X2Y2_hbm_one_pseudo_channel/Makefile.machine.include @@ -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. diff --git a/machines/pod_X1Y1_mesh_X2Y2_hbm_one_pseudo_channel_blackparrot/Makefile.machine.include b/machines/pod_X1Y1_mesh_X2Y2_hbm_one_pseudo_channel_blackparrot/Makefile.machine.include index 3bc780903..11d46f773 100644 --- a/machines/pod_X1Y1_mesh_X2Y2_hbm_one_pseudo_channel_blackparrot/Makefile.machine.include +++ b/machines/pod_X1Y1_mesh_X2Y2_hbm_one_pseudo_channel_blackparrot/Makefile.machine.include @@ -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. diff --git a/machines/pod_X1Y1_ruche_X16Y16_hbm_one_pseudo_channel/Makefile.machine.include b/machines/pod_X1Y1_ruche_X16Y16_hbm_one_pseudo_channel/Makefile.machine.include index d8b18272b..38dd7f849 100644 --- a/machines/pod_X1Y1_ruche_X16Y16_hbm_one_pseudo_channel/Makefile.machine.include +++ b/machines/pod_X1Y1_ruche_X16Y16_hbm_one_pseudo_channel/Makefile.machine.include @@ -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. diff --git a/machines/pod_X1Y1_ruche_X16Y8_hbm/Makefile.machine.include b/machines/pod_X1Y1_ruche_X16Y8_hbm/Makefile.machine.include index 3d94119e5..91acfa0fa 100644 --- a/machines/pod_X1Y1_ruche_X16Y8_hbm/Makefile.machine.include +++ b/machines/pod_X1Y1_ruche_X16Y8_hbm/Makefile.machine.include @@ -106,6 +106,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. diff --git a/machines/pod_X1Y1_ruche_X16Y8_hbm_one_pseudo_channel/Makefile.machine.include b/machines/pod_X1Y1_ruche_X16Y8_hbm_one_pseudo_channel/Makefile.machine.include index 98c0e03fb..e9fcbf3ef 100644 --- a/machines/pod_X1Y1_ruche_X16Y8_hbm_one_pseudo_channel/Makefile.machine.include +++ b/machines/pod_X1Y1_ruche_X16Y8_hbm_one_pseudo_channel/Makefile.machine.include @@ -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. diff --git a/machines/pod_X1Y1_ruche_X32Y16_hbm_one_pseudo_channel/Makefile.machine.include b/machines/pod_X1Y1_ruche_X32Y16_hbm_one_pseudo_channel/Makefile.machine.include index d1dbf1b79..652abc767 100644 --- a/machines/pod_X1Y1_ruche_X32Y16_hbm_one_pseudo_channel/Makefile.machine.include +++ b/machines/pod_X1Y1_ruche_X32Y16_hbm_one_pseudo_channel/Makefile.machine.include @@ -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. diff --git a/machines/pod_X1Y1_ruche_X4Y2_hbm_one_pseudo_channel/Makefile.machine.include b/machines/pod_X1Y1_ruche_X4Y2_hbm_one_pseudo_channel/Makefile.machine.include index 3169b30ff..64bebf6e2 100644 --- a/machines/pod_X1Y1_ruche_X4Y2_hbm_one_pseudo_channel/Makefile.machine.include +++ b/machines/pod_X1Y1_ruche_X4Y2_hbm_one_pseudo_channel/Makefile.machine.include @@ -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. diff --git a/machines/pod_X1Y1_ruche_X4Y4_hbm_one_pseudo_channel/Makefile.machine.include b/machines/pod_X1Y1_ruche_X4Y4_hbm_one_pseudo_channel/Makefile.machine.include index eee03dda2..f978616a7 100644 --- a/machines/pod_X1Y1_ruche_X4Y4_hbm_one_pseudo_channel/Makefile.machine.include +++ b/machines/pod_X1Y1_ruche_X4Y4_hbm_one_pseudo_channel/Makefile.machine.include @@ -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. diff --git a/machines/pod_X1Y1_ruche_X8Y4_hbm/Makefile.machine.include b/machines/pod_X1Y1_ruche_X8Y4_hbm/Makefile.machine.include index d846b81b3..44e9e7051 100644 --- a/machines/pod_X1Y1_ruche_X8Y4_hbm/Makefile.machine.include +++ b/machines/pod_X1Y1_ruche_X8Y4_hbm/Makefile.machine.include @@ -106,6 +106,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. diff --git a/machines/pod_X1Y1_ruche_X8Y4_hbm_one_pseudo_channel/Makefile.machine.include b/machines/pod_X1Y1_ruche_X8Y4_hbm_one_pseudo_channel/Makefile.machine.include index a512bdefb..317af2809 100644 --- a/machines/pod_X1Y1_ruche_X8Y4_hbm_one_pseudo_channel/Makefile.machine.include +++ b/machines/pod_X1Y1_ruche_X8Y4_hbm_one_pseudo_channel/Makefile.machine.include @@ -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 = 0 + ##################### Constants and Computations ##################### # Aliases required for memsys.mk, and others. diff --git a/machines/pod_X1Y1_ruche_X8Y8_hbm_one_pseudo_channel/Makefile.machine.include b/machines/pod_X1Y1_ruche_X8Y8_hbm_one_pseudo_channel/Makefile.machine.include index 35f50a67d..64d536fc4 100644 --- a/machines/pod_X1Y1_ruche_X8Y8_hbm_one_pseudo_channel/Makefile.machine.include +++ b/machines/pod_X1Y1_ruche_X8Y8_hbm_one_pseudo_channel/Makefile.machine.include @@ -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. diff --git a/machines/pod_X2Y2_ruche_X16Y8_hbm/Makefile.machine.include b/machines/pod_X2Y2_ruche_X16Y8_hbm/Makefile.machine.include index 766260693..a5b823f96 100644 --- a/machines/pod_X2Y2_ruche_X16Y8_hbm/Makefile.machine.include +++ b/machines/pod_X2Y2_ruche_X16Y8_hbm/Makefile.machine.include @@ -106,6 +106,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. diff --git a/machines/pod_X4Y4_ruche_X16Y8_hbm/Makefile.machine.include b/machines/pod_X4Y4_ruche_X16Y8_hbm/Makefile.machine.include index 494149808..5788a35a0 100644 --- a/machines/pod_X4Y4_ruche_X16Y8_hbm/Makefile.machine.include +++ b/machines/pod_X4Y4_ruche_X16Y8_hbm/Makefile.machine.include @@ -106,6 +106,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.