This is an archive of the discontinued LLVM Phabricator instance.

[mlir][AVX512] Start an AVX512 dialect
AbandonedPublic

Authored by nicolasvasilache on Feb 5 2020, 8:13 AM.

Details

Summary

The [Vector Dialect]((https://mlir.llvm.org/docs/Dialects/Vector/)) implements a retargetable n-D vector abstraction.
One of the layer currently missing in OSS atm is the Hardware Vector Ops (HWV) level.

This revision introduces a AVX512-specific dialect for the purpose of implementing portions of XNNPack in MLIR and benchmarking them.
This lives under Dialect/Targets/AVX512 and will target useful intrinsics to implement XNNPack.
The first such function is xnn_math_f32_exp__avx512f_p5_scalef.

At the moment, MLIR relies too much on LLVM’s peephole optimizer to do a good job from small insertelement/extractelement/shufflevector.
Some intrinsics defined and used in the LLVMDialect but these are all “portable” intrinsics.
This revision starts defining layering the layering to attack the right instructions in avx512 directly.

Experience with avx512 is also expected to be useful for a future ARM SVE dialect.

Diff Detail

Event Timeline

Unit tests: unknown.

clang-tidy: pass.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

flaub added a subscriber: flaub.Feb 5 2020, 10:22 AM

To be consistent with LLVM proper, I suggest using Target instead of Targets for the directory name.

jsetoain accepted this revision.Feb 5 2020, 11:00 AM

Brilliant! Thanks, Nicholas. This will indeed be a helpful reference for "close-to-ISA" dialects in general :-)

This revision is now accepted and ready to land.Feb 5 2020, 11:00 AM
rriddle requested changes to this revision.Feb 5 2020, 11:04 AM

(Blocking for now to allow for time to look/discussion)

This revision now requires changes to proceed.Feb 5 2020, 11:04 AM
aartbik added inline comments.Feb 5 2020, 1:26 PM
mlir/include/mlir/Dialect/Targets/AVX512/AVX512Ops.td
28 ↗(On Diff #242630)

Bit new to this syntax, so please forgive this question ;-)

I see the 16xf32, but where is the 8xf64?

Move to Dialect/Target.

nicolasvasilache marked 2 inline comments as done.Feb 5 2020, 2:01 PM

@flaub thanks! addressed.

mlir/include/mlir/Dialect/Targets/AVX512/AVX512Ops.td
28 ↗(On Diff #242630)

Dropped it because XNNPack does not target that atm (in that function at least).
Once I have all the pieces connected end-to-end we can think about generalizing.

Unit tests: unknown.

clang-tidy: pass.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

nicolasvasilache abandoned this revision.Feb 6 2020, 8:41 AM
nicolasvasilache marked an inline comment as done.

The RFC in its current form has been abandoned.
I will start a separate lower level dialect following up on the comments and suggestions I received at a future time.