Files
TheRock/compiler/amd-llvm/mlir/test/Dialect/MemRef/emulate-wide-int.mlir
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

96 lines
3.4 KiB
MLIR

// RUN: mlir-opt --memref-emulate-wide-int="widest-int-supported=32" %s \
// RUN: --split-input-file --verify-diagnostics | FileCheck %s
// Expect no conversions, i32 is supported.
// CHECK-LABEL: func @memref_i32
// CHECK: [[M:%.+]] = memref.alloc() : memref<4xi32, 1>
// CHECK-NEXT: [[V:%.+]] = memref.load [[M]][{{%.+}}] : memref<4xi32, 1>
// CHECK-NEXT: memref.store {{%.+}}, [[M]][{{%.+}}] : memref<4xi32, 1>
// CHECK-NEXT: return
func.func @memref_i32() {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : i32
%m = memref.alloc() : memref<4xi32, 1>
%v = memref.load %m[%c0] : memref<4xi32, 1>
memref.store %c1, %m[%c0] : memref<4xi32, 1>
return
}
// -----
// Expect no conversions, f64 is not an integer type.
// CHECK-LABEL: func @memref_f32
// CHECK: [[M:%.+]] = memref.alloc() : memref<4xf32, 1>
// CHECK-NEXT: [[V:%.+]] = memref.load [[M]][{{%.+}}] : memref<4xf32, 1>
// CHECK-NEXT: memref.store {{%.+}}, [[M]][{{%.+}}] : memref<4xf32, 1>
// CHECK-NEXT: return
func.func @memref_f32() {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1.0 : f32
%m = memref.alloc() : memref<4xf32, 1>
%v = memref.load %m[%c0] : memref<4xf32, 1>
memref.store %c1, %m[%c0] : memref<4xf32, 1>
return
}
// -----
// CHECK-LABEL: func @alloc_load_store_i64
// CHECK: [[C1:%.+]] = arith.constant dense<[1, 0]> : vector<2xi32>
// CHECK-NEXT: [[M:%.+]] = memref.alloc() : memref<4xvector<2xi32>, 1>
// CHECK-NEXT: [[V:%.+]] = memref.load [[M]][{{%.+}}] : memref<4xvector<2xi32>, 1>
// CHECK-NEXT: memref.store [[C1]], [[M]][{{%.+}}] : memref<4xvector<2xi32>, 1>
// CHECK-NEXT: return
func.func @alloc_load_store_i64() {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : i64
%m = memref.alloc() : memref<4xi64, 1>
%v = memref.load %m[%c0] : memref<4xi64, 1>
memref.store %c1, %m[%c0] : memref<4xi64, 1>
return
}
// -----
// CHECK-LABEL: func @alloc_load_store_i64_nontemporal
// CHECK: [[C1:%.+]] = arith.constant dense<[1, 0]> : vector<2xi32>
// CHECK-NEXT: [[M:%.+]] = memref.alloc() : memref<4xvector<2xi32>, 1>
// CHECK-NEXT: [[V:%.+]] = memref.load [[M]][{{%.+}}] {nontemporal = true} : memref<4xvector<2xi32>, 1>
// CHECK-NEXT: memref.store [[C1]], [[M]][{{%.+}}] {nontemporal = true} : memref<4xvector<2xi32>, 1>
// CHECK-NEXT: return
func.func @alloc_load_store_i64_nontemporal() {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : i64
%m = memref.alloc() : memref<4xi64, 1>
%v = memref.load %m[%c0] {nontemporal = true} : memref<4xi64, 1>
memref.store %c1, %m[%c0] {nontemporal = true} : memref<4xi64, 1>
return
}
// -----
// Make sure we do not crash on unsupported types.
func.func @alloc_i128() {
// expected-error@+1 {{failed to legalize operation 'memref.alloc' that was explicitly marked illegal}}
%m = memref.alloc() : memref<4xi128, 1>
return
}
// -----
func.func @load_i128(%m: memref<4xi128, 1>) {
%c0 = arith.constant 0 : index
// expected-error@+1 {{failed to legalize operation 'memref.load' that was explicitly marked illegal}}
%v = memref.load %m[%c0] : memref<4xi128, 1>
return
}
// -----
func.func @store_i128(%c1: i128, %m: memref<4xi128, 1>) {
%c0 = arith.constant 0 : index
// expected-error@+1 {{failed to legalize operation 'memref.store' that was explicitly marked illegal}}
memref.store %c1, %m[%c0] : memref<4xi128, 1>
return
}