Files
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

38 lines
1.6 KiB
MLIR

// RUN: mlir-opt %s -split-input-file -test-single-fold | FileCheck %s
// The tests in this file verify that fold() methods can handle complex
// optimization scenarios without requiring multiple folding iterations.
// This is important because:
//
// 1. OpBuilder::createOrFold() only calls fold() once, so operations must
// be fully optimized in that single call
// 2. Multiple rounds of folding would incur higher performance costs,
// so it's more efficient to complete all optimizations in one pass
//
// These tests ensure that folding implementations are robust and complete,
// avoiding situations where operations are left in intermediate states
// that could be further optimized.
// CHECK-LABEL: fold_extract_in_single_pass
// CHECK-SAME: (%{{.*}}: vector<4xf16>, %[[ARG1:.+]]: f16)
func.func @fold_extract_in_single_pass(%arg0: vector<4xf16>, %arg1: f16) -> f16 {
%0 = vector.insert %arg1, %arg0 [1] : f16 into vector<4xf16>
%c1 = arith.constant 1 : index
// Verify that the fold is finished in a single pass even if the index is dynamic.
%1 = vector.extract %0[%c1] : f16 from vector<4xf16>
// CHECK: return %[[ARG1]] : f16
return %1 : f16
}
// -----
// CHECK-LABEL: fold_insert_in_single_pass
func.func @fold_insert_in_single_pass() -> vector<2xf16> {
%cst = arith.constant dense<0.000000e+00> : vector<2xf16>
%c1 = arith.constant 1 : index
%c2 = arith.constant 2.5 : f16
// Verify that the fold is finished in a single pass even if the index is dynamic.
// CHECK: arith.constant dense<[0.000000e+00, 2.500000e+00]> : vector<2xf16>
%0 = vector.insert %c2, %cst [%c1] : f16 into vector<2xf16>
return %0 : vector<2xf16>
}