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

Merge M0 ops #54

Merged
merged 148 commits into from
Aug 22, 2024
Merged

Merge M0 ops #54

merged 148 commits into from
Aug 22, 2024

Conversation

jdh8
Copy link
Collaborator

@jdh8 jdh8 commented Aug 12, 2024

There are still conflicts to resolve. I kept conflict markers for a clear history containing atomic commits. The following unchecked files still contain conflicts.

Files containing conflicts

  • .gitignore
  • README.md
  • tests/test_fall_back.py
  • tests/tools/test_stats.py
  • tools/generate_report.py
  • torch_ttnn/__init__.py
  • torch_ttnn/backend.py
  • torch_ttnn/fx_graphviz.py
  • torch_ttnn/passes/eliminate_coreops_pass.py
  • torch_ttnn/passes/graphviz_pass.py
  • torch_ttnn/passes/lowering/eliminate_data_move_pass.py

Refactor tests

models

  • test_real_world.py

lowering/eltwise

  • test_pointwise_binary.py
  • test_pointwise_trinary.py
  • test_pointwise_unary.py

lowering/matmul

  • test_matrix_multiplication.py
  • test_only_add_matmul.py

lowering/misc

  • test_cse.py
  • test_fall_back.py
  • test_if.py

lowering/normalization

  • test_norm.py
    • layer_norm

lowering/tensor_manipulation

  • test_datamove.py

swimdi and others added 30 commits February 1, 2024 17:14
Update tracer API

See merge request tenstorrent/torch-ttnn!22
- ttnn.open(0) -> ttnn.open_device(device_id=0)
- ttnn.close(d) -> ttnn.close_device(d)
Add conversion and unit test cases

- add
- eq
- gt
- logical_and
- logical_or
- logical_xor
- lt
- maximum
- minimum
- mul
- ne
- pow
- sub
- xlogy
- aten.abs
- aten.acos
- aten.acosh
- aten.asin
- aten.asinh
- aten.atan
- aten.atan2  # binary
- aten.atanh
- aten.clone
- aten.cos
- aten.cosh
- aten.erf
- aten.exp
- aten.expm1
- aten.gelu
- aten.hardtanh
- aten.isinf
- aten.isnan
- aten.leaky_relu
- aten.log
- aten.log10
- aten.log1p
- aten.log2
- aten.logical_not
- aten.neg
- aten.reciprocal
- aten.relu
- aten.rsqrt
- aten.sigmoid
- aten.sign
- aten.sin
- aten.sinh
- aten.sqrt
- aten.tan
- aten.tanh
- addcdiv
- addcmul
- where
Also use fx.subgraph_rewriter

- matmul
- linear
- ttnn.add(and other ops) don't have __name__, so torch.compile will fail. We hard patch the op with the __name__
- Now ttnn need a to_layout before computation
@jdh8
Copy link
Collaborator Author

jdh8 commented Aug 22, 2024

All the lowering tests now either (x)pass or xfail for me. All the xfailed tests have their corresponding issues (#64, tenstorrent/tt-metal#11925, #66, tenstorrent/tt-metal#12853) so that we can track them independently. There might still be 0-1 sporadic RNG-based numerical failure (when comparing inference results), but not about the graph (the identity, number, place, etc. of ops).

============================= test session starts ==============================
platform linux -- Python 3.8.10, pytest-7.2.2, pluggy-1.5.0
rootdir: /home/ubuntu/jdh8/pytorch2.0_ttnn
plugins: dash-2.15.0, split-0.8.2, timeout-2.2.0, anyio-4.4.0, xdist-3.6.1
collected 147 items                                                            

tests/lowering/creation/test_arange.py xxx                               [  2%]
tests/lowering/creation/test_clone.py ..                                 [  3%]
tests/lowering/creation/test_full.py .                                   [  4%]
tests/lowering/creation/test_ones.py .                                   [  4%]
tests/lowering/creation/test_to_copy.py xx                               [  6%]
tests/lowering/creation/test_zeros_like.py .                             [  6%]
tests/lowering/eltwise/binary/test_add.py ...x                           [  9%]
tests/lowering/eltwise/binary/test_atan2.py xxx                          [ 11%]
tests/lowering/eltwise/binary/test_div.py ...x..                         [ 15%]
tests/lowering/eltwise/binary/test_eq.py Xxxx.                           [ 19%]
tests/lowering/eltwise/binary/test_gt.py xxxx                            [ 21%]
tests/lowering/eltwise/binary/test_logical_and.py xxxx                   [ 24%]
tests/lowering/eltwise/binary/test_logical_or.py xxxx                    [ 27%]
tests/lowering/eltwise/binary/test_logical_xor.py xxxx                   [ 29%]
tests/lowering/eltwise/binary/test_lt.py xxxxx                           [ 33%]
tests/lowering/eltwise/binary/test_maximum.py ..xx                       [ 36%]
tests/lowering/eltwise/binary/test_minimum.py .x.x                       [ 38%]
tests/lowering/eltwise/binary/test_mul.py ...x                           [ 41%]
tests/lowering/eltwise/binary/test_ne.py xxxx                            [ 44%]
tests/lowering/eltwise/binary/test_sub.py .x.x..xx..                     [ 51%]
tests/lowering/eltwise/binary/test_xlogy.py ..x                          [ 53%]
tests/lowering/eltwise/unary/test_abs.py .                               [ 53%]
tests/lowering/eltwise/unary/test_acos.py .                              [ 54%]
tests/lowering/eltwise/unary/test_acosh.py .                             [ 55%]
tests/lowering/eltwise/unary/test_asin.py .                              [ 55%]
tests/lowering/eltwise/unary/test_asinh.py .                             [ 56%]
tests/lowering/eltwise/unary/test_atan.py .                              [ 57%]
tests/lowering/eltwise/unary/test_atanh.py .                             [ 57%]
tests/lowering/eltwise/unary/test_clamp.py .                             [ 58%]
tests/lowering/eltwise/unary/test_cos.py .                               [ 59%]
tests/lowering/eltwise/unary/test_cosh.py .                              [ 59%]
tests/lowering/eltwise/unary/test_erf.py .                               [ 60%]
tests/lowering/eltwise/unary/test_exp.py .                               [ 61%]
tests/lowering/eltwise/unary/test_expm1.py .                             [ 61%]
tests/lowering/eltwise/unary/test_gelu.py .                              [ 62%]
tests/lowering/eltwise/unary/test_hardtanh.py .                          [ 63%]
tests/lowering/eltwise/unary/test_isinf.py .                             [ 63%]
tests/lowering/eltwise/unary/test_isnan.py .                             [ 64%]
tests/lowering/eltwise/unary/test_leaky_relu.py .                        [ 65%]
tests/lowering/eltwise/unary/test_log.py .                               [ 65%]
tests/lowering/eltwise/unary/test_log10.py .                             [ 66%]
tests/lowering/eltwise/unary/test_log1p.py .                             [ 67%]
tests/lowering/eltwise/unary/test_log2.py .                              [ 68%]
tests/lowering/eltwise/unary/test_logical_not.py .                       [ 68%]
tests/lowering/eltwise/unary/test_neg.py .                               [ 69%]
tests/lowering/eltwise/unary/test_pow_scalar.py .                        [ 70%]
tests/lowering/eltwise/unary/test_reciprocal.py .                        [ 70%]
tests/lowering/eltwise/unary/test_relu.py .                              [ 71%]
tests/lowering/eltwise/unary/test_rsqrt.py .                             [ 72%]
tests/lowering/eltwise/unary/test_sigmoid.py .                           [ 72%]
tests/lowering/eltwise/unary/test_sign.py .                              [ 73%]
tests/lowering/eltwise/unary/test_silu.py .                              [ 74%]
tests/lowering/eltwise/unary/test_sin.py .                               [ 74%]
tests/lowering/eltwise/unary/test_sinh.py .                              [ 75%]
tests/lowering/eltwise/unary/test_sqrt.py .                              [ 76%]
tests/lowering/eltwise/unary/test_tan.py .                               [ 76%]
tests/lowering/eltwise/unary/test_tanh.py .                              [ 77%]
tests/lowering/eltwise/unary/test_tril.py .                              [ 78%]
tests/lowering/embedding/test_embedding.py x.                            [ 79%]
tests/lowering/matmul/test_addmm.py .                                    [ 80%]
tests/lowering/matmul/test_baddbmm.py .                                  [ 80%]
tests/lowering/matmul/test_linear.py x                                   [ 81%]
tests/lowering/matmul/test_matmul.py .                                   [ 82%]
tests/lowering/matmul/test_only_add_matmul.py ....                       [ 85%]
tests/lowering/misc/test_if.py .                                         [ 85%]
tests/lowering/normalization/test_layer_norm.py ..                       [ 87%]
tests/lowering/normalization/test_softmax.py .                           [ 87%]
tests/lowering/pool/test_avg_pool_2d.py .                                [ 88%]
tests/lowering/reduction/test_mean.py .                                  [ 89%]
tests/lowering/tensor_manipulation/test_aten_t.py ...                    [ 91%]
tests/lowering/tensor_manipulation/test_concat.py x                      [ 91%]
tests/lowering/tensor_manipulation/test_expand.py xxxx                   [ 94%]
tests/lowering/tensor_manipulation/test_permute.py .                     [ 95%]
tests/lowering/tensor_manipulation/test_repeat.py x                      [ 95%]
tests/lowering/tensor_manipulation/test_reshape.py x                     [ 96%]
tests/lowering/tensor_manipulation/test_squeeze.py .                     [ 97%]
tests/lowering/tensor_manipulation/test_transpose.py .                   [ 97%]
tests/lowering/tensor_manipulation/test_unsqueeze.py ...                 [100%]

================== 89 passed, 57 xfailed, 1 xpassed in 55.11s ==================

@ayerofieiev-tt ayerofieiev-tt added this pull request to the merge queue Aug 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 22, 2024
@jdh8
Copy link
Collaborator Author

jdh8 commented Aug 22, 2024

Is there a way to skip approval for running GitHub workflow/CI? That would let us spot errors without human intervention and fix things faster, especially with this time difference.

README.md Outdated Show resolved Hide resolved
@ayerofieiev-tt
Copy link
Member

@jdh8 this is due to the limitation for first time contributors using forks.
I sent an invite, you can start direct contribution to the repo w/o forking, it makes things nicer.
I also expect that once this PR is in that you will be able to start processes yourself w/o approval.

return self.call_function_prop_meta(ttnn.matmul, args, kwargs)

if target == torch.ops.aten.linear.default:
return self.call_function_prop_meta(ttnn.linear, args, kwargs)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(For #66)
The conversion for aten.linear is here, but it is somehow unused.

@ayerofieiev-tt ayerofieiev-tt added this pull request to the merge queue Aug 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 22, 2024
xlogy asserts the same size for inputs for now
@jdh8 jdh8 added this pull request to the merge queue Aug 22, 2024
Merged via the queue into tenstorrent:main with commit f87d7b3 Aug 22, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants