XuanTie C908 Accelerates AI with Software and Hardware Fusion

简介: XuanTie C908 Accelerates AI with Software and Hardware Fusion

1. Introduction

XuanTie C908 is the latest RISC-V processor released by T-Head Semiconductor, It has a frequency of up to 2 GHz. which allows it to be widely used in visual AI, intelligent interaction, and other advanced technologies. This article focuses on an array of topics from processor micro-architecture, to convolution acceleration algorithm, to optimized operators for XuanTie C908. We are also showcasing the AI inference performance of XuanTie C908 by using the T-Head open source AI deployment kit for the first time.


2. AI acceleration of hardware and software integration

2.1 Processor micro-architecture

  • Support instruction fusion technology
  • Compliant with RISC-V vector extension 1.0
  • Support 128/256 configurable vector register bit width VLEN
  • The vector execution unit supports FP16/BFP16/FP32 floating point and INT8/INT32/INT64 integer operations
  • Support INT8/INT4 vector dot product operations.


2.2 Software algorithm optimization

Structure of Heterogeneous Library (SHL) is a set of neural network library APIs for XuanTie CPU platform. It abstracts common neural network operator interfaces. For the newly released XuanTie C908, SHL provides the inference acceleration of multiple data types (fp32/fp16/int8). Combined with the processor pipeline, instruction fusion, and high-speed cache technology, it offers deep assembly optimization for core operators in neural networks.


Convolution has been the most crucial operator in CNN models. Currently, im2col + GEMM and Winograd are supported in SHL to accelerate convolution calculations. The main steps of Winograd are:


  • Input padding
  • Input transformation
  • Input reordering
  • Batch GEMM operations
  • Output transformation
  • Output cropping


The core computing of the two algorithms is gemm. The following figure uses vlen128/fp16 as an example to show the calculation process of gemm.

image.png

Vector load (vle) is used for weight data, while scalar load (flh) for input data. This design takes 16*12 register blocks to improve computational efficiency by performing outer product matrix. We manually remove read-after-write and write-after-write data dependencies to adjust instruction flow. Last but not least, we have incorporated advanced instruction fusion technology to fully optimize performance of XuanTie C908. (The arrows in the figure indicate the arrangement order of the data in the memory.)


The list of optimized operators supported by SHL for XuanTie C908 is as follows:


  • conv2d
  • depthwiseconv2d
  • maxpool2d
  • avgpool2d
  • global_maxpool2d
  • global_avgpool2d
  • fullyconnected
  • relu
  • relu6
  • leaky_relu
  • prelu
  • sigmoid
  • softmax
  • concat
  • pad
  • elementwise_add
  • elementwise_mul
  • sum


2.3 Model deployment

Heterogenous Honey Badger (HHB) has been adapted to the latest XuanTie C908 processor. It supports weight symmetric, activation asymmetric int8 data type quantization and fp16 data type quantization. One only needs a simple command to generate the C code model file for inference on XuanTie C908. While calling on the SHL XuanTie C908 high-performance inference computing library, you can achieve the best performance experience of model inference on XuanTie C908.

hhb -C –calibrate-dataset ./cat.jpg –model-file ./mobilenetv1.prototxt ./mobilenetv1.caffemodel –data-scale 0.017 –data-mean ‘104 117 124’ –output . –board c908 –quantization-scheme=”int8_asym_w_sym” –pixel-format BGR –fuse-conv-relu –channel-quantization


3. Performance

We tested the AI inference performance of some common CNN models on XuanTie C908 using HHB and SHL. After adding the int8 vector dot product instruction, we improved XuanTie C908 performance by 3.35 times on mobilenet. This step enables us to expand the vector length to 256 results in a speedup ratio of 1.55 to 1.68. The AI performance provided by XuanTie C908 (@vlen128) has been increased by 3.75 to 4.57 times compared with that of the previous generation XuanTie C906 (@D1).

image.pngimage.pngimage.png

4. Conclusion

XuanTie C908 greatly improves AI computing power and performance. We have followed the standard RISC-V vector extension 1.0 and supported int8/int4 vector dot product extensions. Thus, we have provided 256-bit wide vector register configurable options for Xuantie C908. This article describes the specific steps of integration with micro-architecture and instruction characteristics of the XuanTie C908 processor. By doing so, we are able to accelerate the convolution operator in CNN and introduces the SHL high-performance computing library GEMM optimization ideas and the list of optimized operators. Moreover, we have compared the AI performance of XuanTie C908 and the previous generation XuanTie C906, further highlighting the potential and advantages of the RISIC-V processor architecture in the field of AIOT through software and hardware joint optimization.




相关文章
|
并行计算 安全 开发者
RISC-V生态全景解析(五):Vector向量计算技术与SIMD技术的对比
芯片开放社区(OCC)面向开发者推出RISC-V系列内容,通过多角度、全方位解读RISC-V,系统性梳理总结相关理论知识,构建RISC-V知识图谱,促进开发者对RISC-V生态全貌的了解。
4297 0
RISC-V生态全景解析(五):Vector向量计算技术与SIMD技术的对比
|
存储 边缘计算 固态存储
玄铁RISC-V处理器入门与实战-平头哥玄铁CPU IP-面向高性能领域CPU
玄铁RISC-V处理器入门与实战-平头哥玄铁CPU IP-
3056 1
|
机器学习/深度学习 人工智能 算法
ZYNQ-AXI总线的信号接口要求以及时序关系
ZYNQ-AXI总线的信号接口要求以及时序关系
3059 0
ZYNQ-AXI总线的信号接口要求以及时序关系
|
4月前
|
人工智能 监控 数据库
贷前尽调AI助手:7步流水线实战
对公客户尽职调查智能化:从7天到7分钟的企业风险扫描 开源Skill:due-diligence | 企业风险画像 | 舆情监控 | 担��链分析 痛点:对公开户的"马拉松" 银行对公客户经理最怕什么?新开户尽调。 传统流程: 1. 收集企业资料(营业执照、财报、征信)→ 1天 2. 工商信息查询 → 1天 3. 舆情风险搜索 → 2天 4. 关联企业排查 → 2天 5. 撰写尽调报告
|
存储 数据可视化 数据安全/隐私保护
【赵渝强老师】Docker的图形化管理工具
本文介绍了三种主流的Docker图形化管理工具:Docker UI、Portainer和Shipyard。Docker UI(现名UI for Docker)适合初学者,支持容器管理并可显示容器关系图;Portainer轻量级且功能全面,支持单机与集群管理;Shipyard专注于多主机集群管理,提供镜像、容器及节点管理功能,并包含engine和rethinkdb两个核心组件。文中还通过图文结合的方式展示了各工具的安装与使用方法。
1385 5
【赵渝强老师】Docker的图形化管理工具
|
Web App开发 JavaScript 测试技术
Playwright 极速入门:1 小时搞定环境搭建与首个测试脚本
本文带你1小时快速入门Playwright,完成环境搭建并编写首个测试脚本。Playwright是微软推出的现代化Web自动化测试工具,支持Chromium、Firefox和WebKit三大浏览器引擎,具备跨平台、多语言(Python/JS/Java/C#)特性。其核心优势包括:智能自动等待机制减少失败率、内置录制工具实时生成脚本、多语言灵活选择,以及真移动端设备模拟能力,显著提升测试效率和可靠性。
|
Swift
DeepSeek开源Janus-Pro多模态理解生成模型,魔搭社区推理、微调最佳实践
Janus-Pro是DeepSeek最新开源的多模态模型,是一种新颖的自回归框架,统一了多模态理解和生成。
1483 19
DeepSeek开源Janus-Pro多模态理解生成模型,魔搭社区推理、微调最佳实践
|
机器学习/深度学习 数据可视化 Python
Python实用记录(三):通过netron可视化模型
使用Netron工具在Python中可视化神经网络模型,包括安装Netron、创建文件和运行文件的步骤。
575 2
Python实用记录(三):通过netron可视化模型