Skip to content

Add tiled systolic-array matmul support for OS and WS#62

Merged
shirohasuki merged 11 commits into
DangoSys:mainfrom
nervestop2:systolic-array-os-ws-matmul
Jul 19, 2026
Merged

Add tiled systolic-array matmul support for OS and WS#62
shirohasuki merged 11 commits into
DangoSys:mainfrom
nervestop2:systolic-array-os-ws-matmul

Conversation

@nervestop2

Copy link
Copy Markdown
Contributor

修改内容:

  • 为脉动阵列增加 OS 和 WS 模式下的分块矩阵乘法支持
  • 支持沿 K 维对多个 4x4 tile 做累加执行
  • 增加并验证 4x8 x 8x4 的端到端测试

验证情况:

  • 测试目标:ctest_systolic_matmul_4x8_8x4
    日志说明指令4x8_8x4能顺利编译成2次执行,bfp_ws_first 和bfp_ws_last。测试结果也PASS
    [verilator sim] [instr 0] mvin_a_tile0 ptr=0x80003840 bank=0 depth=4 stride=1
    [verilator sim] [instr 1] mvin_b_tile0 ptr=0x800038c0 bank=1 depth=4 stride=1
    [verilator sim] [instr 2] bfp_ws_first op1_bank=0 op2_bank=1 wr_bank=2 iter=4 config[2:0]=0x3
    [verilator sim] [instr 3] mvin_a_tile1 ptr=0x80003880 bank=0 depth=4 stride=1
    [verilator sim] [instr 4] mvin_b_tile1 ptr=0x80003900 bank=1 depth=4 stride=1
    [verilator sim] [instr 5] bfp_ws_last op1_bank=0 op2_bank=1 wr_bank=2 iter=4 config[2:0]=0x7
    [verilator sim] [instr 6] mvout ptr=0x80003740 bank=2 depth=4 stride=1
    [verilator sim] [instr 7] fence
    [verilator sim] output_matrix =
    [verilator sim] 27252 22036 11089 27480
    [verilator sim] 34675 27701 29213 38586
    [verilator sim] 28397 27587 24762 39769
    [verilator sim] 27343 21374 14741 34213
    [verilator sim] expected_matrix =
    [verilator sim] 27252 22036 11089 27480
    [verilator sim] 34675 27701 29213 38586
    [verilator sim] 28397 27587 24762 39769
    [verilator sim] 27343 21374 14741 34213
    [verilator sim] systolic_matmul_4x8_8x4_ws PASSED

@shirohasuki
shirohasuki requested review from SJM946 and shirohasuki and removed request for SJM946 June 22, 2026 14:30
@shirohasuki

Copy link
Copy Markdown
Member

Thanks for your time! I will do a quick review.

@shirohasuki shirohasuki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you so, so much for your work. I think we might need a README to explain the implementation of ball (no AIGC). To be honest, all these variables are a bit overwhelming.

)
endfunction()

function(add_singlecore_objdump_target TEST_NAME)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What are these disassembly files used for? Are they necessary?

"$inBank $outBank $iter $scale attr-dict `:` type($inBank) type($outBank) type($iter) type($scale)";
}

#endif // BUCKYBALL_BANK_SSA

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please run pre-commit before committing.

// CHECK-DAG: %[[CFG_WS:.*]] = arith.constant 1 : i64
// CHECK: buckyball.bank_systolic {{.*}} %[[C4]] %[[CFG_OS]]
// CHECK: buckyball.bank_mvout {{.*}} %[[C4]]
// CHECK: buckyball.bank_systolic {{.*}} %[[C4]] %[[CFG_WS]]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have you do filecheck, these seem are not right.

@shirohasuki

Copy link
Copy Markdown
Member

Nice progress.

@shirohasuki shirohasuki added the enhancement New feature or request label Jul 5, 2026
@nervestop2
nervestop2 force-pushed the systolic-array-os-ws-matmul branch from 1e99306 to d6105de Compare July 17, 2026 08:43
@shirohasuki
shirohasuki force-pushed the systolic-array-os-ws-matmul branch from d6105de to 4da388e Compare July 18, 2026 17:08
@shirohasuki
shirohasuki force-pushed the systolic-array-os-ws-matmul branch from f78a87c to 1806d10 Compare July 19, 2026 09:18
@shirohasuki
shirohasuki force-pushed the systolic-array-os-ws-matmul branch from 16dc2a2 to 7846525 Compare July 19, 2026 11:16
@shirohasuki
shirohasuki force-pushed the systolic-array-os-ws-matmul branch from da080ec to 000820b Compare July 19, 2026 12:42
@shirohasuki
shirohasuki force-pushed the systolic-array-os-ws-matmul branch from 5fe99fc to 1d3fc20 Compare July 19, 2026 16:56
@shirohasuki
shirohasuki merged commit d5d0762 into DangoSys:main Jul 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants