Skip to content

Dev/bypass - #57

Open
DiyouS wants to merge 3 commits into
mainfrom
dev/bypass
Open

DiyouS wants to merge 3 commits into
mainfrom
dev/bypass

Conversation

@DiyouS

@DiyouS DiyouS commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Add bypass path for Spatz and Snitch

Copilot AI balanced review requested due to automatic review settings October 22, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved correctness issues can compromise memory transactions, preserve neither cached data nor configuration compatibility, and hide test failures.

5 open issues
What changed in this PR

Adds a runtime-controlled L1 data-cache bypass path for Spatz and Snitch, connecting private-range accesses directly to DRAM through the existing refill infrastructure.

Changes:

  • Adds bypass control registers, routing metadata, and a dedicated single-beat AXI converter.
  • Exposes runtime controls and linker storage, with a directed test registered in both CI configurations.
  • Updates monitoring and refill-width defaults, and adds FFT stage synchronization for dual-scalar configurations.
File Description
software/​tests/​l1-bypass/​main.c Tests scalar/vector bypass accesses, visibility, and timing.
software/​tests/​CMakeLists.txt Registers the bypass test.
software/​snRuntime/​src/​l1cache.c Implements runtime bypass control.
software/​snRuntime/​link/​common.ld.in Adds the bypass memory region and section.
software/​snRuntime/​include/​l1cache.h Declares the bypass API and cache-maintenance contract.
software/​snRuntime/​include/​cachepool_peripheral.h Adds bypass register definitions and shifts crossbar offsets.
software/​kernels/​fp/​fft-32b/​kernel/​fft.c Fences intermediate FFT stages on dual-scalar configurations.
hardware/​tb/​tb_cachepool.sv Uses the expanded DRAM AXI user width.
hardware/​tb/​cachepool_monitor.sv Separates bypass traffic statistics from cache refills.
hardware/​src/​cachepool_tile.sv Connects bypass controls and metadata to cache controllers.
hardware/​src/​cachepool_reqrsp_to_axi.sv Adds single-beat AXI conversion with bypass payload handling.
hardware/​src/​cachepool_pkg.sv Defines bypass parameters, metadata, and widened AXI types.
hardware/​src/​cachepool_group.sv Forwards bypass control and updates request metadata.
hardware/​src/​cachepool_group_noc_wrapper.sv Registers and forwards bypass control.
hardware/​src/​cachepool_cluster.sv Integrates DRAM converters and bypass assertions.
hardware/​cachepool_peripheral/​cachepool_peripheral.sv Applies bypass configuration on commit.
hardware/​cachepool_peripheral/​cachepool_peripheral_reg.hjson.tmpl Defines the bypass control register.
hardware/​cachepool_peripheral/​cachepool_peripheral_reg_top.sv Implements register storage and decoding.
hardware/​cachepool_peripheral/​cachepool_peripheral_reg_pkg.sv Updates register types, offsets, and permissions.
config/​README.md Documents the full-line refill-width requirement.
config/​config.mk Defaults refill width to 512 bits and updates comments.
config/​cachepool_fpu_4g.mk Corrects the DRAM-selection comment only.
config/​cachepool_fpu_16g.mk Corrects the DRAM-selection comment only.
config/​cachepool_fpu_16g_tiny.mk Corrects the DRAM-selection comment only.
config/​cachepool_dual_fpu_4g.mk Corrects the DRAM-selection comment only.
config/​cachepool_dual_fpu_16g.mk Corrects the DRAM-selection comment only.
config/​cachepool_dual_4g.mk Corrects the DRAM-selection comment only.
config/​cachepool_4g.mk Corrects the DRAM-selection comment only.
Bender.yml Includes the new AXI converter source.
Bender.lock Updates the Insitu-Cache dependency revision.
.gitlab-ci.yml Adds bypass testing to standard and dual-scalar jobs.

Review effort: Balanced

// L1 bypass (built if L1BypassEn; enabled at runtime by L1D_BYPASS): the private range
// [L1D_ADDR, L1BypassEnd) goes around the L1 cache straight to DRAM. The fixed end keeps a
// stack overflowing the stack SPM cached.
localparam bit L1BypassEn = 1'b1;
Comment on lines +139 to +156
assign axi_req_o.ar.addr = reqrsp_req_i.q.addr;
assign axi_req_o.ar.len = '0;
assign axi_req_o.ar.size = {1'b0, reqrsp_req_i.q.size};
assign axi_req_o.ar.burst = axi_pkg::BURST_INCR;
assign axi_req_o.ar.lock = '0;
assign axi_req_o.ar.cache = axi_pkg::CACHE_MODIFIABLE;
assign axi_req_o.ar.prot = '0;
assign axi_req_o.ar.qos = '0;
assign axi_req_o.ar.region = '0;
assign axi_req_o.ar.user = q_axi_user;
assign axi_req_o.ar_valid = q_valid_read;
assign q_ready_read = axi_rsp_i.ar_ready;

// -------------
// Write Channel
// -------------
assign axi_req_o.aw.id = q_id;
assign axi_req_o.aw.addr = reqrsp_req_i.q.addr;
(uint32_t *)(_snrt_team_current->root->cluster_mem.end +
CACHEPOOL_PERIPHERAL_L1D_BYPASS_REG_OFFSET);
*cfg_bypass = en & 0x1u;
l1d_commit();
#define MAX_CORES 64u
#define MAX_SLICE_WORDS (BYP_WORDS / 16u)
static uint32_t vbuf[MAX_CORES][MAX_SLICE_WORDS] __attribute__((section(".data")));
static int error_cnt[MAX_CORES] __attribute__((section(".data")));
const uint32_t num_cores = snrt_cluster_vpu_num();
const uint32_t cid = snrt_cluster_vpu_idx();
const int is_primary = snrt_cluster_is_primary();
int num_fails = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants