Last active
October 5, 2023 08:46
-
-
Save matthias-springer/81748fe1e530974dd5ff6b3ad57e3eeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RUN: mlir-opt %s -test-transform-dialect-interpreter="debug-payload-root-tag=payload" | |
module attributes {transform.target_tag="payload"} { | |
func.func @test(%f0: f32, %f1: f32, %idx: index, %idx2: index) | |
-> (f32, tensor<3xf32>) { | |
// Create a new tensor with [%f0, %f0, %f0]. | |
%0 = tensor.from_elements %f0, %f0, %f0 : tensor<3xf32> | |
// Insert something into the new tensor. | |
%1 = tensor.insert %f1 into %0[%idx] : tensor<3xf32> | |
// Read from the old tensor. | |
%r = tensor.extract %0[%idx2] : tensor<3xf32> | |
// Return the extracted value and the result of the insertion. | |
func.return %r, %1 : f32, tensor<3xf32> | |
} | |
} | |
transform.sequence failures(propagate) { | |
^bb0(%module1: !transform.any_op): | |
// Bufferize | |
// test_analysis_only = true | |
// print_conflicts = true | |
// dump_alias_sets = true | |
%module2 = transform.bufferization.one_shot_bufferize %module1 | |
{bufferize_function_boundaries = true} | |
: (!transform.any_op) -> !transform.any_op | |
// Canonicalize + CSE | |
transform.apply_patterns to %module2 { | |
transform.apply_patterns.canonicalization | |
} {apply_cse} : !transform.any_op | |
// Deallocate buffers | |
%module3 = transform.apply_registered_pass | |
"buffer-deallocation-pipeline" to %module2 | |
: (!transform.any_op) -> !transform.any_op | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment