-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[mlir][tosa] Fix validation check on controlflow operators #159754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// RUN: mlir-opt %s -split-input-file -verify-diagnostics --tosa-validate="profile=pro_int,pro_fp extension=int16,int4,bf16,fp8e4m3,fp8e5m2,fft,variable,controlflow,doubleround,inexactround strict-op-spec-alignment" | FileCheck %s | ||
|
||
// ----- | ||
|
||
// CHECK-LABEL: test_cond_if_isolated_from_above | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what is the value in those CHECK-LABEL since there are no CHECK between them. Since these tests try to check the absence of an error, the mlir-opt line should be enough and FileCheck is not needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise in error_if_check.mlir by the way which doesn't even run FileCheck. Can you do a separate patch to remove the CHECK directives in that file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, you're more familiar with FileCheck/LIT so appreciate any suggestion. Without this fix, these tests still passed without FileCheck. I suspect it's because they were returning a silent failure? So I used FileCheck here to help make sure that something was returned from I think you're correct that I didn't need to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For checking the absence of an error you could just remove the --split-input-files and then mlir-opt should return an error if any of the test fail to compile. On the other hand having CHECK-LABEL means you'll get a more precise error of which test fail so maybe worth keeping. The CHECK-LABEL without a FileCheck invocation though is waiting for trouble because someone might add some tests thinking that FileCheck is being run and wrongly conclude that their test work. |
||
func.func @test_cond_if_isolated_from_above(%arg0: tensor<f32>, %arg1: tensor<f32>, %arg2: tensor<i1>) -> tensor<f32> { | ||
%0 = "tosa.cond_if"(%arg2, %arg0, %arg1) ({ | ||
^bb0(%arg3: tensor<f32>, %arg4: tensor<f32>): | ||
tosa.yield %arg3 : tensor<f32> | ||
}, { | ||
^bb0(%arg3: tensor<f32>, %arg4: tensor<f32>): | ||
tosa.yield %arg4 : tensor<f32> | ||
}) : (tensor<i1>, tensor<f32>, tensor<f32>) -> tensor<f32> | ||
return %0 : tensor<f32> | ||
} | ||
|
||
// ----- | ||
|
||
// CHECK-LABEL: test_while_loop_isolated_from_above | ||
func.func @test_while_loop_isolated_from_above(%arg0: tensor<f32>, %arg1: tensor<i32>) { | ||
%0 = "tosa.const"() {values = dense<0> : tensor<i32>} : () -> tensor<i32> | ||
%1:3 = "tosa.while_loop"(%0, %arg0, %arg1) ({ | ||
^bb0(%arg3: tensor<i32>, %arg4: tensor<f32>, %arg5: tensor<i32>): | ||
%2 = "tosa.greater_equal"(%arg3, %arg5) : (tensor<i32>, tensor<i32>) -> tensor<i1> | ||
%3 = "tosa.logical_not"(%2) : (tensor<i1>) -> tensor<i1> | ||
"tosa.yield"(%3) : (tensor<i1>) -> () | ||
}, { | ||
^bb0(%arg3: tensor<i32>, %arg4: tensor<f32>, %arg5: tensor<i32>): | ||
%2 = "tosa.const"() {values = dense<1> : tensor<i32>} : () -> tensor<i32> | ||
%3 = "tosa.add"(%arg3, %2) : (tensor<i32>, tensor<i32>) -> tensor<i32> | ||
"tosa.yield"(%3, %arg4, %arg5) : (tensor<i32>, tensor<f32>, tensor<i32>) -> () | ||
}) : (tensor<i32>, tensor<f32>, tensor<i32>) -> (tensor<i32>, tensor<f32>, tensor<i32>) | ||
return | ||
} |
Uh oh!
There was an error while loading. Please reload this page.