From c63efe2abb038ef1df171907b26eef6d5864b0c4 Mon Sep 17 00:00:00 2001 From: mshahid Date: Mon, 17 Feb 2025 21:47:28 -0800 Subject: [PATCH] -Adds tpp-opt -default-pipeline compilation test for amx-bf16 feature. -Removes the fragile test from integration. --- .../tpp-run-amx-feature-initialization.mlir | 22 ------------------ .../DefaultPipeline/amx-initialization.mlir | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 22 deletions(-) delete mode 100644 test/Integration/tpp-run-amx-feature-initialization.mlir create mode 100644 test/Passes/DefaultPipeline/amx-initialization.mlir diff --git a/test/Integration/tpp-run-amx-feature-initialization.mlir b/test/Integration/tpp-run-amx-feature-initialization.mlir deleted file mode 100644 index 3735cebd4..000000000 --- a/test/Integration/tpp-run-amx-feature-initialization.mlir +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: not --crash env LIBXSMM_TARGET=spr tpp-run %s -e entry -entry-point-result=void -mattr=-amx-bf16 2>&1 | FileCheck %s --check-prefix=CHECK-AMX-BF16 -// RUN: not --crash env LIBXSMM_TARGET=spr tpp-run %s -e entry -entry-point-result=void -mattr=amx-bf16 2>&1 | FileCheck %s --check-prefix=CHECK-AMX-BF16-SETUP - -//Tests for unsuccessfull compilation in absence of 'amx-bf16' feature -// CHECK-AMX-BF16: LLVM ERROR: Cannot select: intrinsic %llvm.x86.tdpbf16ps.internal - -//Tests for successfull compilation in presence of 'amx-bf16' but fails to run due to unsupported instruction. -// CHECK-AMX-BF16-SETUP-NOT: LLVM ERROR: Cannot select: intrinsic %llvm.x86.tdpbf16ps.internal -// CHECK-AMX-BF16-SETUP: Illegal instruction - - -func.func @entry(%arg0: memref<16x32xbf16>, - %arg1: memref<16x32xbf16>, - %arg2: memref<16x16xf32>) { - %0 = arith.constant 0 : index - %1 = amx.tile_load %arg0[%0, %0] : memref<16x32xbf16> into !amx.tile<16x32xbf16> - %2 = amx.tile_load %arg1[%0, %0] : memref<16x32xbf16> into !amx.tile<16x32xbf16> - %3 = amx.tile_zero : !amx.tile<16x16xf32> - %4 = amx.tile_mulf %1, %2, %3 : !amx.tile<16x32xbf16>, !amx.tile<16x32xbf16>, !amx.tile<16x16xf32> - amx.tile_store %arg2[%0, %0], %4 : memref<16x16xf32>, !amx.tile<16x16xf32> - return -} \ No newline at end of file diff --git a/test/Passes/DefaultPipeline/amx-initialization.mlir b/test/Passes/DefaultPipeline/amx-initialization.mlir new file mode 100644 index 000000000..1ecad3853 --- /dev/null +++ b/test/Passes/DefaultPipeline/amx-initialization.mlir @@ -0,0 +1,23 @@ +// RUN: tpp-opt --default-pipeline %s | FileCheck %s +// RUN: LIBXSMM_TARGET=spr tpp-opt --default-pipeline %s | FileCheck %s --check-prefix=CHECK-AMX-BF16 + +// CHECK-LABEL: llvm.func @entry +// CHECK: builtin.unrealized_conversion_cast +// CHECK: amx.tile_mulf +// CHECK-NOT: amx.tilestored64 + +// CHECK-AMX-BF16-LABEL: llvm.func @entry +// CHECK-AMX-BF16: amx.tileloadd64 +// CHECK-AMX-BF16: amx.tdpbf16ps +// CHECK-AMX-BF16: amx.tilestored64 +func.func @entry(%arg0: memref<16x32xbf16>, + %arg1: memref<16x32xbf16>, + %arg2: memref<16x16xf32>) { + %0 = arith.constant 0 : index + %1 = amx.tile_load %arg0[%0, %0] : memref<16x32xbf16> into !amx.tile<16x32xbf16> + %2 = amx.tile_load %arg1[%0, %0] : memref<16x32xbf16> into !amx.tile<16x32xbf16> + %3 = amx.tile_zero : !amx.tile<16x16xf32> + %4 = amx.tile_mulf %1, %2, %3 : !amx.tile<16x32xbf16>, !amx.tile<16x32xbf16>, !amx.tile<16x16xf32> + amx.tile_store %arg2[%0, %0], %4 : memref<16x16xf32>, !amx.tile<16x16xf32> + return +}