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
107 lines
3.7 KiB
MLIR
107 lines
3.7 KiB
MLIR
// RUN: mlir-opt -drop-equivalent-buffer-results -split-input-file %s | FileCheck %s
|
|
// RUN: mlir-opt -drop-equivalent-buffer-results=modify-public-functions=1 -split-input-file %s | \
|
|
// RUN: FileCheck %s --check-prefix=MODIFY-PUBLIC
|
|
|
|
|
|
// CHECK-LABEL: func private @single_buffer_return({{.*}}) {
|
|
// CHECK: return
|
|
|
|
!type = memref<?xf32, strided<[?], offset: ?>>
|
|
func.func private @single_buffer_return(%buf: !type, %val: f32, %idx: index) -> !type {
|
|
memref.store %val, %buf[%idx] : !type
|
|
return %buf : !type
|
|
}
|
|
|
|
// CHECK-LABEL: func @caller(
|
|
// CHECK-SAME: %[[BUF:.+]]: memref<?xf32, strided<[?], offset: ?>>,
|
|
// CHECK: call @single_buffer_return(%[[BUF]]{{.*}}-> ()
|
|
// CHECK: %[[LOADED:.+]] = memref.load %[[BUF]]
|
|
// CHECK: return %[[LOADED]]
|
|
|
|
func.func @caller(%buf: !type, %val: f32, %idx: index) -> f32 {
|
|
%0 = call @single_buffer_return(%buf, %val, %idx) : (!type, f32, index) -> (!type)
|
|
%1 = memref.load %0[%idx] : !type
|
|
return %1 : f32
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: func private @multiple_buffer_returns({{.*}}) {
|
|
// CHECK: return
|
|
|
|
!type = memref<?xf32, strided<[?], offset: ?>>
|
|
!type1 = memref<?x?xf32>
|
|
func.func private @multiple_buffer_returns(
|
|
%buf: !type, %buf1: !type1, %val: f32, %idx: index) -> (!type1, !type) {
|
|
memref.store %val, %buf[%idx] : !type
|
|
memref.store %val, %buf1[%idx, %idx] : !type1
|
|
return %buf1, %buf : !type1, !type
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: func private @multiple_mixed_returns({{.*}}) -> i32 {
|
|
// CHECK: %[[CST:.+]] = arith.constant 1 : i32
|
|
// CHECK: return %[[CST]] : i32
|
|
|
|
!type = memref<?xf32, strided<[?], offset: ?>>
|
|
!type1 = memref<?x?xf32>
|
|
func.func private @multiple_mixed_returns(
|
|
%buf: !type, %buf1: !type1, %val: f32, %idx: index) -> (!type1, i32, !type) {
|
|
memref.store %val, %buf[%idx] : !type
|
|
memref.store %val, %buf1[%idx, %idx] : !type1
|
|
%cst = arith.constant 1 : i32
|
|
return %buf1, %cst, %buf : !type1, i32, !type
|
|
}
|
|
|
|
// -----
|
|
|
|
// Ensure public functions remain unchanged by default.
|
|
// CHECK-LABEL: func @public_function(
|
|
// CHECK-SAME: %[[BUF:.+]]: memref<?xf32, strided<[?], offset: ?>>,
|
|
// CHECK-SAME: ) -> memref<?xf32, strided<[?], offset: ?>> {
|
|
// CHECK: return %[[BUF]]
|
|
|
|
// When explicitly requested, public functions can be modified.
|
|
// MODIFY-PUBLIC-LABEL: func @public_function(
|
|
// MODIFY-PUBLIC-SAME: %[[BUF:.+]]: memref<?xf32, strided<[?], offset: ?>>,
|
|
// MODIFY-PUBLIC-SAME: ) {
|
|
// MODIFY-PUBLIC: return
|
|
|
|
!type = memref<?xf32, strided<[?], offset: ?>>
|
|
func.func @public_function(
|
|
%buf: !type, %val: f32, %idx: index) -> !type {
|
|
memref.store %val, %buf[%idx] : !type
|
|
return %buf : !type
|
|
}
|
|
|
|
// CHECK-LABEL: func @caller(
|
|
// CHECK-SAME: %[[IN_BUF:.+]]: memref<?xf32, strided<[?], offset: ?>>,
|
|
// CHECK: %[[RET_VAL:.+]] = call @public_function(%[[IN_BUF]]{{.*}}-> memref
|
|
// CHECK: %[[LOADED:.+]] = memref.load %[[RET_VAL]]
|
|
// CHECK: return %[[LOADED]]
|
|
|
|
// MODIFY-PUBLIC-LABEL: func @caller(
|
|
// MODIFY-PUBLIC-SAME: %[[IN_BUF:.+]]: memref<?xf32, strided<[?], offset: ?>>,
|
|
// MODIFY-PUBLIC: call @public_function(%[[IN_BUF]]{{.*}}-> ()
|
|
// MODIFY-PUBLIC: %[[LOADED:.*]] = memref.load %[[IN_BUF]]
|
|
// MODIFY-PUBLIC: return %[[LOADED]]
|
|
|
|
func.func @caller(%buf: !type, %val: f32, %idx: index) -> f32 {
|
|
%0 = call @public_function(%buf, %val, %idx) : (!type, f32, index) -> (!type)
|
|
%1 = memref.load %0[%idx] : !type
|
|
return %1 : f32
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: func private @negative_external_function(
|
|
// CHECK-SAME: -> memref<?xf32, strided<[?], offset: ?>>
|
|
|
|
// Ensure external function remains unchanged.
|
|
// MODIFY-PUBLIC-LABEL: func private @negative_external_function(
|
|
// MODIFY-PUBLIC-SAME: -> memref<?xf32, strided<[?], offset: ?>>
|
|
|
|
!type = memref<?xf32, strided<[?], offset: ?>>
|
|
func.func private @negative_external_function(%arg0: !type) -> !type
|