This is an archive of the discontinued LLVM Phabricator instance.

[X86][AMX] Add unit tests for AMX feature
ClosedPublic

Authored by yubing on Jan 29 2023, 9:27 AM.

Details

Summary

Currently, we only test compilation results of AMX cases.

Event Timeline

yubing created this revision.Jan 29 2023, 9:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2023, 9:27 AM
yubing requested review of this revision.Jan 29 2023, 9:27 AM
yubing edited the summary of this revision. (Show Details)Jan 29 2023, 9:30 AM
yubing added reviewers: LuoYuanke, pengfei.

Take notes for myself:
Once spr is supported in testing infra, llvm-test-suite/configure should be modified as well to check if the cpu support amx.

SingleSource/UnitTests/Vector/AMXINT8/CMakeLists.txt
3 ↗(On Diff #493105)

should place a FIXME here.

LuoYuanke added inline comments.Jan 29 2023, 11:32 PM
SingleSource/UnitTests/Vector/AMXINT8/CMakeLists.txt
5 ↗(On Diff #493105)

Should we create Matrix folder under UnitTests and put the AMX test case to Matrix folder?

SingleSource/UnitTests/Vector/AMXINT8/t_gemm_bf16.cpp
9 ↗(On Diff #493105)

Maybe format the function name and parameter following the LLVM coding style.

39 ↗(On Diff #493105)

__ is reserved by compiler. We may rename it to bfloat16_t?

149 ↗(On Diff #493105)

Check the err_num for inner_product.

SingleSource/UnitTests/Vector/AMXINT8/t_gemm_int8.cpp
129 ↗(On Diff #493105)

Check the err_num for inner_product.

yubing added inline comments.Jan 30 2023, 8:19 PM
SingleSource/UnitTests/Vector/AMXINT8/t_gemm_int8.cpp
129 ↗(On Diff #493105)

we don't need to check errnum here.
see line131: err_num = memcmp(gC, gD, sizeof(gC))?(1+err_num):err_num;

yubing added inline comments.Jan 30 2023, 8:26 PM
SingleSource/UnitTests/Vector/AMXINT8/t_gemm_bf16.cpp
9 ↗(On Diff #493105)

it is not necessary since other testcases don't follow LLVM coding style.

yubing updated this revision to Diff 493482.Jan 30 2023, 9:01 PM

move into Matrix dir

@craig.topper hi, can we use sapphirerapids server to run pre-CI during community review?

I think this is the patch that added the checks for AVX512 support. https://reviews.llvm.org/D38182

SingleSource/UnitTests/Matrix/AMXINT8/CMakeLists.txt
6

Matirx -> Matrix

SingleSource/UnitTests/Matrix/CMakeLists.txt
11

Matirx -> Matrix

SingleSource/UnitTests/Matrix/Makefile
2

Matirx -> Matrix

This comment was removed by yubing.
yubing updated this revision to Diff 493499.Jan 30 2023, 11:37 PM

Matirx -> Matrix

yubing marked 3 inline comments as done.Jan 30 2023, 11:37 PM
LuoYuanke added inline comments.Jan 31 2023, 12:07 AM
SingleSource/UnitTests/Matrix/Makefile
11

Maybe just check HAVE_X86_AVX512F_INSTRUCTIONS?

This revision is now accepted and ready to land.Jan 31 2023, 12:12 AM
yubing closed this revision.EditedJan 31 2023, 12:42 AM

https://github.com/llvm/llvm-test-suite/commit/afc7e6588b3b43351e49f697fe48283ec5056c11 has landed.
i use "arc land" to land it successfully, of course the commit carry "Differential Revision: https://reviews.llvm.org/D142845"

MatzeB added a subscriber: MatzeB.May 31 2023, 1:30 PM
MatzeB added inline comments.
SingleSource/UnitTests/Matrix/AMXINT8/t_gemm_bf16.reference_output
1

I just noticed this in the testsuite. This exit code indicates an "Illegal instruction". Is this test really supposed to run for people and do we really expect it to hit an illegal instruction? This feels silly...

MatzeB added inline comments.May 31 2023, 1:32 PM
SingleSource/UnitTests/Matrix/AMXINT8/t_gemm_bf16.reference_output
1

(I am trying to cleanup the test-suite tests to only ever exit with code 0 when working properly...)

LuoYuanke added inline comments.May 31 2023, 3:57 PM
SingleSource/UnitTests/Matrix/AMXINT8/t_gemm_bf16.reference_output
1

This test case would generate AMX instructions and is supposed to run on SPR machine. Since we have have SPR machine in buildbot, we just check it can be built by compiler.