Skip to content

Commit

Permalink
add k230d
Browse files Browse the repository at this point in the history
Signed-off-by: ArchFeh <archfeh@outlook.com>
  • Loading branch information
ArchFeh committed Jul 30, 2024
1 parent 7e516e5 commit 66ed9b8
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 9 deletions.
95 changes: 95 additions & 0 deletions blog/2024-07-30-k230d.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
title: "嘉楠勘智K230D: 首款基于新32位 RuyiSDK 的AIoT量产芯片"
authors: [ruyi]
---

import ReactPlayer from 'react-player'


在上期文章中,向大家介绍了《[玄铁团队与PLCT实验室联合发布:新32位产品级开源工具链及Linux内核](https://mp.weixin.qq.com/s/argIGP4_rUKDm9IRIB-YTg)》,本期为大家带来新32位(RV64ILP32)产品化的最新进展:嘉楠勘智K230D。去年,嘉楠推出 [K230](https://gitee.com/kendryte/k230_docs),它基于玄铁c908 打造,是世界上第一款带有 VECTOR 1.0 的 RISC-V 64位 AIOT 芯片。今年,嘉楠勘智推出更高集成度的 K230D AIoT 芯片,内存由原来外挂 256MB/512MB 改为内封 128MB。原先基于 LP64 ABI 的软件内存开销过大,不再适合 K230D,而新32位技术可同时提升内存与缓存的效率。PLCT实验室联合玄铁团队,一起为 K230D 打造基于新32位的 RuyiSDK,第一次实现新32位 AIoT 产品的落地。相比原先基于 LP64 ABI 的 SDK,新32位 SDK **内存开销下降 30%**,同时链表遍历**性能提升 20%**,兼顾成本和性能。

![616c6103a9a4656a2b24226e55425d62.png](/img/616c6103a9a4656a2b24226e55425d62.png)

# K230D RUYISDK 介绍

达摩院玄铁团队联手嘉楠科技和中科院软件所PLCT实验室,将新32位落地到Banana Pi开源社区的BPI-CANMV-K230D-Zero 开发板,并与PLCT实验室的 RuyiSDK 集成,一起为用户提供便捷的使用体验:

* 升级 Linux 内核至 6.6、升级工具链

* 新增32位根系统 和 LVGL

* 基于 VECTOR 的图形加速

* 支持 Linux + Nuttx 双系统,大小核任意切换

* 支持传统64位和新32位,两种系统配置


### 内核配置:

| | 传统64位(64LP64) | 新32位(64ILP32) |
| --- | --- | --- |
| 内核编译命令 | make ARCH=riscv k230\_defconfig all | make ARCH=riscv k230\_defconfig 64ilp32.config all |

默认配置差异仅2行:

CONFIG\_ARCH\_RV64ILP32=y

CONFIG\_32BIT=y

## 内存对比

下面的视频和图片展示了,传统64位(左)与新32位(右)对比 LVGL 的运行:
<ReactPlayer playing controls muted={true} url='/video/video_20240730_182451.mp4' />



![k230d_final.jpeg](/img/k230d_final.jpeg)

| **动态内存对比** | **传统64位 (RV64 LP64)** | **新32位 (RV64 ILP32)** |
| --- | --- | --- |
| **used** | **37MB** | **24MB** |

| 静态内存对比 | 传统64位 (RV64 LP64) | 新32位 (RV64 ILP32) |
| --- | --- | --- |
| kernel code | 10282KB | 10456KB |
| rwdata | 1126KB | 832KB |
| rodata | 5105KB | 4464KB |
| bss | 500KB | 376KB |

相比传统64位,新32位 RuyiSDK 大幅提升内存使用效率,避免了 K230D 产品化中的内存浪费。

## 性能对比

由于 LP64 的指针数据类型比 ILP32 大一倍,导致 LP64 的缓存利用率偏低。下面,基于 K230D 对比二者的双向链表遍历性能:

### 双向链表遍历 (链表节点为4000,遍历50000次结果)

| | 第一次执行时长 | 第二次执行时长 | 第三次执行时长 | 第四次执行时长 | 第五次执行时长 | **平均执行时长** |
| --- | --- | --- | --- | --- | --- | --- |
| | 单位:纳秒 | | | | | 单位:秒 |
| LP64 | 3872221628 | 3420261850 | 3774494961 | 3539484998 | 4034940590 | **3.728280805** |
| ILP32 | 2614749257 | 2261891517 | 2680216665 | 2894499368 | 2847282036 | **2.659727769** |

结果显示,ILP32 的链表遍历性能显著优于 LP64。

## 相关资料:

K230D RuyiSDK:[https://github.com/ruyisdk/k230\_linux\_sdk](https://github.com/ruyisdk/k230_linux_sdk)

(镜像构建详见文档https://github.com/ruyisdk/k230\_linux\_sdk/blob/dev/README\_zh.md )

K230D 使用说明:[https://ruyisdk.org/docs/k230d/intro](https://ruyisdk.org/docs/k230d/intro)

# 结束语

与过往的架构(ARM、x86、MIPS、Sparc)聚焦用户态的思路不同,当前新32位的方案是:基于 RVA20/22/23 Profiles **为 RV64 架构的特权态提供 ILP32 ABI** 能力,这是前人未曾走过的新路。自 2024 年 3 月推出新 32 位工具链和 Linux 内核以来,这次终于在 K230D 上实现了产品化,降低了 30% 的内存开销,大幅提升缓存性能,这些成果进一步揭示了新 32 位的产业化价值。我们热切期待开发者们积极参与新32位的开发和完善中,共同提出宝贵的建议和意见,推动新 32 位不断发展。我们致力于建立一个健康和活跃的开源社区,将持续投入资源和精力,确保新32位软件的稳定和可靠,并不断改进和完善其功能和性能。在此,我们也呼吁更多的硬件厂商加入我们的阵营,共同推动新32位嵌入式系统的发展和创新,为行业带来更多机遇。

## 关于我们

●   [RuyiSDK](https://ruyisdk.org/) 是一个由 [PLCT Lab](https://plctlab.org/zh/) 所启动的开源项目,该项目旨在为 RISC-V 开发者提供一个完整的、全家桶式的全功能开发环境,包含从编译、调试到仿真的全套工具,并计划支持市面上主流的 RISC-V 硬件。

●   达摩院玄铁团队持续深耕 RISC-V 技术研发及生态建设,并陆续推出了一系列玄铁处理器,可满足高中低全系列性能需求。玄铁积极拥抱开源,坚持开放创新,已逐渐构建起以 RISC-V 为核心的生态体系,与生态伙伴协同推动 RISC-V 芯片、开发工具、操作系统、应用解决方案等不同层面的软硬一体化发展。全力推动 RISC-V 软硬全栈技术多领域发展落地,加速实现智能时代的万物互联!

●   嘉楠科技(Canaan Inc.)(纳斯达克股票代码:CAN)是一家领先的高性能ASIC芯片设计公司,以“区块链+AI”为多元化经营战略,业务范围涵盖高性能ASIC计算芯片及设备研发、AI芯片及产品开发。作为一家纳斯达克上市公司,嘉楠科技是全球“区块链第一股”,也是第一家在美国上市的中国自主知识产权AI芯片公司。公司愿景:提升社会运行效率,改善人类生活方式。

6 changes: 6 additions & 0 deletions blog/authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ arch:
title: RuyiSDK 社区经理
url: https://github.com/ArchFeh
image_url: https://avatars.githubusercontent.com/u/16155165?v=4

ruyi:
name: RuyiSDK
title: RuyiSDK 团队
url: https://github.com/ruyisdk
image_url: https://avatars.githubusercontent.com/u/119776687?s=200&v=4
16 changes: 8 additions & 8 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ const config = {
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// announcementBar: {
// id: "ruyi",
// content:
// 'k230D最新发布,<a target="_blank" rel="noopener noreferrer" href="#">点击查看</a>',
// backgroundColor: "#20232a",
// textColor: "#fff",
// isCloseable: true,
// },
announcementBar: {
id: "k230d",
content:
'嘉楠勘智K230D: 首款基于新32位 RuyiSDK 的AIoT量产芯片! <a target="_blank" rel="noopener noreferrer" href="/blog/2024/07/30/k230d">点击查看</a>',
backgroundColor: "#20232a",
textColor: "#fff",
isCloseable: true,
},
colorMode: {
defaultMode: "dark",
disableSwitch: true,
Expand Down
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-player": "^2.16.0",
"react-slideshow-image": "^4.3.1",
"sass": "^1.77.6",
"video.js": "^8.16.1"
Expand Down
7 changes: 7 additions & 0 deletions src/components/SlideNews/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import "react-slideshow-image/dist/styles.css";
import { Slide } from "react-slideshow-image";

const slideImages = [
{
title: <Translate>嘉楠勘智K230D</Translate>,
subtitle: <Translate>首款基于新32位 RuyiSDK 的AIoT量产芯片</Translate>,
Image: "https://images.unsplash.com/photo-1532883031962-d3574f99541b?q=80&w=3870&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
Links: "/blog/2024/07/30/k230d",
visibility: "secondaryButtonHide",
},
{
title: <Translate>RuyiSDK</Translate>,
subtitle: <Translate>面向RISC-V架构的一体化集成开发环境</Translate>,
Expand Down
2 changes: 1 addition & 1 deletion src/css/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
--ifm-font-size-base: 17px;
--ifm-spacing-horizontal: 16px;
--ifm-navbar-item-padding-horizontal: 18px;
--ifm-menu-link-padding-horizontal: 0;
--ifm-menu-link-padding-horizontal: 0.75rem;
--ifm-toc-padding-vertical: 6px;
--ifm-toc-link-color: var(--ifm-color-emphasis-700);
--ifm-code-font-size: 90%;
Expand Down
Binary file added static/img/616c6103a9a4656a2b24226e55425d62.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/k230d_final.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed static/img/video.mp4
Binary file not shown.
Binary file added static/video/video_20240730_182451.mp4
Binary file not shown.

0 comments on commit 66ed9b8

Please sign in to comment.