Skip to content
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

Bump SHARK-TestSuite commit to include npy->bin output comparison. #17281

Merged
merged 2 commits into from
May 4, 2024

Conversation

ScottTodd
Copy link
Member

@ScottTodd ScottTodd commented May 3, 2024

This fixes #16674 by switching from comparing against .npy files to comparing against .bin files thanks to nod-ai/SHARK-TestSuite#212.

For example with https://github.com/nod-ai/SHARK-TestSuite/tree/main/iree_tests/onnx/node/generated/test_add_uint8:

  • model.mlir:

    module {
      func.func @test_add_uint8(%arg0: !torch.vtensor<[3,4,5],ui8>, %arg1: !torch.vtensor<[3,4,5],ui8>) -> !torch.vtensor<[3,4,5],ui8> attributes {torch.onnx_meta.ir_version = 7 : si64, torch.onnx_meta.opset_version = 17 : si64, torch.onnx_meta.producer_name = "backend-test", torch.onnx_meta.producer_version = ""} {
        %none = torch.constant.none
        %0 = torch.operator "onnx.Add"(%arg0, %arg1) : (!torch.vtensor<[3,4,5],ui8>, !torch.vtensor<[3,4,5],ui8>) -> !torch.vtensor<[3,4,5],ui8> 
        return %0 : !torch.vtensor<[3,4,5],ui8>
      }
    }
  • test_data_flags.txt before:

    --input=@input_0.npy
    --input=@input_1.npy
    --expected_output=@output_0.npy
    

    with these errors:

    [FAILED] result[0]: metadata is 3x4x5xi8; expected that the view matches 3x4x5xui8; expected that the view is equal to contents of a view of 3x4x5xui8
    
      expected:
    
    3x4x5xui8=[[18 24 22 22 20][14 38 44 14 27][30 14 20 12 20][36 25 31 6 8]][[28 30 19 7 18][26 33 23 34 19][29 39 14 32 44][26 25 18 28 24]][[24 36 16 28 25][16 23 22 20 39][27 20 34 19 26][16 17 8 16 11]]
    
      actual:
    
    3x4x5xi8=[[18 24 22 22 20][14 38 44 14 27][30 14 20 12 20][36 25 31 6 8]][[28 30 19 7 18][26 33 23 34 19][29 39 14 32 44][26 25 18 28 24]][[24 36 16 28 25][16 23 22 20 39][27 20 34 19 26][16 17 8 16 11]]
    
  • test_data_flags.txt after:

    --input=3x4x5xui8=@input_0.bin
    --input=3x4x5xui8=@input_1.bin
    --expected_output=3x4x5xi8=@output_0.bin
    

    (that still seems a bit mismatched? it does pass the test though)

Comment on lines +628 to +629
"test_clip_default_int8_inbounds",
"test_clip_default_int8_inbounds_expanded",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like they were passing before but are now failing. Interesting...

__ IREE compile and run: test_clip_default_int8_inbounds::cpu_llvm_sync_test ___
[gw56] linux -- Python 3.11.9 /home/esaimana/actions-runner/_work/iree/iree/venv/bin/python
Error invoking iree-run-module
Error code: 1
Stderr diagnostics:

Stdout diagnostics:
EXEC @test_clip_default_int8_inbounds
[FAILED] result[0]: metadata is 3xsi8; expected that the view matches 3xi8; expected that the view is equal to contents of a view of 3xi8
  expected:
3xi8=-1 0 1
  actual:
3xsi8=-1 0 1

Compiled with:
  cd /home/esaimana/actions-runner/_work/iree/iree/SHARK-TestSuite/iree_tests/onnx/node/generated/test_clip_default_int8_inbounds && iree-compile model.mlir --iree-hal-target-backends=llvm-cpu -o model_cpu_llvm_sync_test.vmfb

Run with:
  cd /home/esaimana/actions-runner/_work/iree/iree/SHARK-TestSuite/iree_tests/onnx/node/generated/test_clip_default_int8_inbounds && iree-run-module --module=model_cpu_llvm_sync_test.vmfb --device=local-sync --flagfile=test_data_flags.txt

@ScottTodd ScottTodd marked this pull request as ready for review May 3, 2024 23:12
@ScottTodd ScottTodd requested a review from saienduri May 3, 2024 23:13
Copy link
Collaborator

@saienduri saienduri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks

@ScottTodd ScottTodd merged commit 47693b5 into iree-org:main May 4, 2024
55 checks passed
@ScottTodd ScottTodd deleted the tests-npy-bin branch May 4, 2024 00:05
bangtianliu pushed a commit to bangtianliu/iree that referenced this pull request Jun 5, 2024
…ree-org#17281)

This fixes iree-org#16674 by switching
from comparing against .npy files to comparing against .bin files thanks
to nod-ai/SHARK-TestSuite#212.

For example with
https://github.com/nod-ai/SHARK-TestSuite/tree/main/iree_tests/onnx/node/generated/test_add_uint8:

* model.mlir:
    ```mlir
    module {
func.func @test_add_uint8(%arg0: !torch.vtensor<[3,4,5],ui8>, %arg1:
!torch.vtensor<[3,4,5],ui8>) -> !torch.vtensor<[3,4,5],ui8> attributes
{torch.onnx_meta.ir_version = 7 : si64, torch.onnx_meta.opset_version =
17 : si64, torch.onnx_meta.producer_name = "backend-test",
torch.onnx_meta.producer_version = ""} {
        %none = torch.constant.none
%0 = torch.operator "onnx.Add"(%arg0, %arg1) :
(!torch.vtensor<[3,4,5],ui8>, !torch.vtensor<[3,4,5],ui8>) ->
!torch.vtensor<[3,4,5],ui8>
        return %0 : !torch.vtensor<[3,4,5],ui8>
      }
    }
    ```
* `test_data_flags.txt` before:
    ```
    --input=@input_0.npy
    --input=@input_1.npy
    --expected_output=@output_0.npy
    ```

    with these errors:
    ```
[FAILED] result[0]: metadata is 3x4x5xi8; expected that the view matches
3x4x5xui8; expected that the view is equal to contents of a view of
3x4x5xui8
    
      expected:
    
3x4x5xui8=[[18 24 22 22 20][14 38 44 14 27][30 14 20 12 20][36 25 31 6
8]][[28 30 19 7 18][26 33 23 34 19][29 39 14 32 44][26 25 18 28 24]][[24
36 16 28 25][16 23 22 20 39][27 20 34 19 26][16 17 8 16 11]]
    
      actual:
    
3x4x5xi8=[[18 24 22 22 20][14 38 44 14 27][30 14 20 12 20][36 25 31 6
8]][[28 30 19 7 18][26 33 23 34 19][29 39 14 32 44][26 25 18 28 24]][[24
36 16 28 25][16 23 22 20 39][27 20 34 19 26][16 17 8 16 11]]
    ```

* `test_data_flags.txt` after:
    ```
    --input=3x4x5xui8=@input_0.bin
    --input=3x4x5xui8=@input_1.bin
    --expected_output=3x4x5xi8=@output_0.bin
    ```
    (that still seems a bit mismatched? it does pass the test though)
LLITCHEV pushed a commit to LLITCHEV/iree that referenced this pull request Jul 30, 2024
…ree-org#17281)

This fixes iree-org#16674 by switching
from comparing against .npy files to comparing against .bin files thanks
to nod-ai/SHARK-TestSuite#212.

For example with
https://github.com/nod-ai/SHARK-TestSuite/tree/main/iree_tests/onnx/node/generated/test_add_uint8:

* model.mlir:
    ```mlir
    module {
func.func @test_add_uint8(%arg0: !torch.vtensor<[3,4,5],ui8>, %arg1:
!torch.vtensor<[3,4,5],ui8>) -> !torch.vtensor<[3,4,5],ui8> attributes
{torch.onnx_meta.ir_version = 7 : si64, torch.onnx_meta.opset_version =
17 : si64, torch.onnx_meta.producer_name = "backend-test",
torch.onnx_meta.producer_version = ""} {
        %none = torch.constant.none
%0 = torch.operator "onnx.Add"(%arg0, %arg1) :
(!torch.vtensor<[3,4,5],ui8>, !torch.vtensor<[3,4,5],ui8>) ->
!torch.vtensor<[3,4,5],ui8>
        return %0 : !torch.vtensor<[3,4,5],ui8>
      }
    }
    ```
* `test_data_flags.txt` before:
    ```
    --input=@input_0.npy
    --input=@input_1.npy
    --expected_output=@output_0.npy
    ```

    with these errors:
    ```
[FAILED] result[0]: metadata is 3x4x5xi8; expected that the view matches
3x4x5xui8; expected that the view is equal to contents of a view of
3x4x5xui8

      expected:

3x4x5xui8=[[18 24 22 22 20][14 38 44 14 27][30 14 20 12 20][36 25 31 6
8]][[28 30 19 7 18][26 33 23 34 19][29 39 14 32 44][26 25 18 28 24]][[24
36 16 28 25][16 23 22 20 39][27 20 34 19 26][16 17 8 16 11]]

      actual:

3x4x5xi8=[[18 24 22 22 20][14 38 44 14 27][30 14 20 12 20][36 25 31 6
8]][[28 30 19 7 18][26 33 23 34 19][29 39 14 32 44][26 25 18 28 24]][[24
36 16 28 25][16 23 22 20 39][27 20 34 19 26][16 17 8 16 11]]
    ```

* `test_data_flags.txt` after:
    ```
    --input=3x4x5xui8=@input_0.bin
    --input=3x4x5xui8=@input_1.bin
    --expected_output=3x4x5xi8=@output_0.bin
    ```
    (that still seems a bit mismatched? it does pass the test though)

Signed-off-by: Lubo Litchev <lubol@google.com>
@ScottTodd ScottTodd added the integrations/onnx ONNX integration work label Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrations/onnx ONNX integration work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test case failures in iree-run-module with signed/unsigned/signless types
2 participants