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生态全貌的了解。
4203 0
RISC-V生态全景解析(五):Vector向量计算技术与SIMD技术的对比
|
机器学习/深度学习 人工智能 算法
|
存储 算法 调度
第六章 输入输出系统【操作系统】1
第六章 输入输出系统【操作系统】1
862 0
|
小程序 iOS开发
微信小程序下载文件和转发文件给好友总结
微信小程序下载文件和转发文件给好友总结
3022 0
微信小程序下载文件和转发文件给好友总结
|
UED 开发者 容器
鸿蒙next版开发:ArkTS组件通用属性(位置设置)
在HarmonyOS next中,ArkTS提供了align、direction、position、markAnchor、offset和alignRules等通用属性,用于精确控制组件在用户界面中的位置和布局。本文详细解读了这些属性,并提供了示例代码进行说明。通过这些属性,开发者可以实现精确布局、动态界面调整和提升用户体验。
2183 6
|
缓存
正在等待缓存锁:无法获得锁 /var/lib/dpkg/lock-frontend。锁正由进程 12836(unattended-upgr)持有
正在等待缓存锁:无法获得锁 /var/lib/dpkg/lock-frontend。锁正由进程 12836(unattended-upgr)持有
8952 0
正在等待缓存锁:无法获得锁 /var/lib/dpkg/lock-frontend。锁正由进程 12836(unattended-upgr)持有
|
存储 SQL 缓存
Perf Arm SPE介绍与使用
本次分享的主题是 Perf Arm-SPE 的介绍及使用,本次分享主要介绍如何在倚天 710 平台上利用 Arm-SPE 特性定位伪共享问题、分析内存访问、分析指令延时以及监控访存延时等功能。 1. 背景介绍 2. Arm SPE的原理 3. Arm SPE在倚天服务器上的应用 4. Arm SPE 更多特性与功能的探索
1718 0
|
存储 弹性计算 数据库
阿里云oss备份网站数据的详细步骤
该教程指导如何使用阿里云OSS备份网站数据。首先,注册阿里云账号并购买40GB的OSS存储空间。创建Bucket,选择与服务器相同的区域和私有权限。安装阿里云OSS插件,获取AccessKey信息。在宝塔面板中设置计划任务进行网站或数据库备份,选择内网域名以节省流量。备份完成后,通过文件管理器检查OSS中是否有备份文件。下载备份文件需点击文件名,然后打开文件URL。
1354 5
|
存储 异构计算
System Generator学习——使用 AXI 接口和 IP 集成器(三)
System Generator学习——使用 AXI 接口和 IP 集成器
386 3