2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Scalable Matrix Extension (SME)Advent Calendar 2024

Day 7

SME日記その6 Streaming SVE modeでsvcntw()とsvcntsw()を実行してみる

Posted at

ようやくArmのScalable Matrix Extension (SME)を試すveclen.c相当のプログラムを実行できるようになったので報告します.

SMEシリーズ

プログラムコード

veclen.c
#include <stdint.h>
#include <stdio.h>
#include <arm_sme.h>

void streaming_fn(void)
{
  uint64_t cntw, cntsw;
  asm volatile ("smstart sm");
  cntw = svcntw();
  cntsw = svcntsw();
  asm volatile ("smstop sm");
  printf("Streaming mode: svcntw() = %llu, svcntsw() = %llu\n", cntw, cntsw);
}

int main(void)
{
  streaming_fn();
}

ポイントとしては,次の点です.

  • svcntw()svcntsw()についてはエラーにならない
  • __arm_locally_streaming__arm_has_sme()はリンクエラーになる
  • CNTWという命令は存在するが,CNTSWなる命令は存在しない
  • svcntsw()でどんなアセンブリコードを生成するのかは,調べても不明

コンパイル方法

clang -O2 -march=armv9-a+sme -o veclen veclen.c

実行の方法と結果

% ./veclen                                       
Streaming mode: svcntw() = 16, svcntsw() = 16

ここまで,長かった!

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?