目录
zhaozeyu

npu-matrix,npu-test: Support mixed-type GEMM and add operator CI (#16)

Summary

Extend Ztt matrix multiplication to support mixed A/B datatypes and add PR CI coverage for the existing operator examples.

The following combinations are supported in both A/B input orders:

Input A Input B Accumulator
Int8 Int4 Int32
OCP_E4M3 OCP_E5M2 FP32
Int8 Uint8 Int32
Int8 Uint4 Int32

These combinations apply to all six matrix multiply-accumulate instructions, including the transpose and negated-product variants.

Changes

  • Centralize matrix datatype compatibility checks and interpret each integer operand according to its own signedness.
  • Add gemm_mixed_source_types with 17 regression groups covering both input orders, 4-bit packing, rounding modes, floating-point special values and flags, unsupported tuples, and register-span boundaries.
  • Extend the existing self-hosted Ztt job to run the mixed-input regression.
  • Add a GitHub-hosted Ubuntu 24.04 job for the nine existing examples: gemm_fp32, gemm_int8, gemm_mixed, gelu, softmax, mha, ffn, rope, and rmsnorm.
  • Upload test reports and logs, and include the operator job in the required CI summary.

Local validation

  • Full pre-commit checks passed, including gem5 style and clang-format.
  • make -C example/gemm_mixed_source_types test passed all 17 regression groups, with matching Host C and gem5 MinorCPU results and a passing instruction audit
13天前24222次提交

AME_gem5: AME Instruction Set Extension for gem5

AME_gem5 is an open-source simulation and validation environment built upon the gem5 system-level simulator, specifically designed to provide comprehensive support for the Attached Matrix Extension (AME) instruction set. It is our expectation that this gem5 simulator will provide support for AME functional verification, performance modeling, and analysis. We actively encourage contributions from the broader community to collaboratively develop and refine this simulator, and thereby advance the optimization and architectural design of the AME extension.

AME_gem5 system overview

Key Features

  • AME Ztt v0.6 Instruction type supported

    • Resource Management
    • Datatype Management
    • Elementwise Arithmetic
    • Bitwise
    • Compare and Predication
    • Permutation
    • Register move / data conversion
    • Elementwise Math Functions
    • Memory
    • State Management
    • Matrix Multiply
    • Reduction
  • Large Language Model (LLM) Inference Operators

    • Matrix multiplication: FP32 GEMM, INT8 GEMM, mixed-precision GEMM
    • Normalization and activation: RMSNorm, GELU, Softmax
    • Transformer components: RoPE, MHA, FFN

See the community release of spec Ztt v0.6 for details.

Quick Start

Prerequisites

  • A C++ compiler, Python 3, SCons, and the other gem5 dependencies. See the gem5 build documentation.
  • A RISC-V GNU toolchain with binutils and libgcc.a.
  • An LLVM-based RISC-V toolchain with AME Ztt v0.6 support.

Build gem5

In the AME_gem5 root directory:

scons build/RISCV/gem5.opt -j$(nproc)

Then, install the toolchain:

./scripts/build_toolchain.sh

Or, to build the AME LLVM toolchain from source, use:

./scripts/build_toolchain.sh --src

Run examples and tests

Build and test an operator example:

make -C example gemm_fp32

Build and test all operators:

make -C example test

On Ubuntu 24.04.3 LTS, instruction, operator, and function-level tests pass.

License

New AME_gem5 code is distributed under the BSD three-clause license in LICENSE. The original gem5 code and its existing per-file copyrights remain covered by COPYING and the notices in each file. Third-party components retain their own LICENSE, COPYING, or NOTICE terms.

关于

gem5

235.1 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号