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

[TOSA] TOSA updates for LLVM hash a854c26 #4016

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

justin-ngo-arm
Copy link
Contributor

PR summary:

  • [TOSA] Update tosa.mul's shift as input
  • [TOSA] Update tosa.slice's start and size to !tosa.shape type
  • [TOSA] Refactor: Use tosaCastTensorToType() function to create tosa.cast
  • [TOSA] Update tosa.reshape's shape as a !tosa.shape input

* In TOSA v1.0, tosa.mul's `shift` is an input. This commit updates
  Torch to TOSA in alignment with that change.
* Update `tosa::createMulOpAndCast()` function to create a const shift
  TOSA tensor based on the provided shift value. This should be the API
  used to create tosa.mul from now on (instead of using
  `rewriter.create<tosa::MulOp>()`).
* Update `tosa::CreateOpAndInfer()` function to call
  `tosa::CreateOpAndInferShape()` function.
* Update LIT tests.

Signed-off-by: Justin Ngo <justin.ngo@arm.com>
Change-Id: I84aeccacbb33eee65e5923725ace86a78f877869
* In TOSA 1.0, tosa.slice's `start` and `size` are !tosa.shape types.
  Update tosa.slice in Torch to TOSA in alignment with that.
* Update LIT tests.

Signed-off-by: Justin Ngo <justin.ngo@arm.com>
Change-Id: Icf878ea4dc43ec1af3bd498b5ae96f514fe0f04a
* Previously, in Torch to TOSA, there are 3 ways to create tosa.cast op:
  - `rewriter.create<tosa::CastOp>()`
  - `tosa::promoteType()`
  - `tosa::tosaCastTensorToType()`
* This commit combines the three APIs above into
  `tosa::tosaCastTensorToType()` with the following features:
  - Checking whether source and destination element types are the same
    before casting. If they are same, skip the cast.
  - Custom float to integer cast behavior added from this PR:
    llvm#3946
    TLDR: PyTorch's and TOSA's float to integer casting behaviors are
    different (round to zero vs round to nearest, respectively), which
    requires a custom casting here.
  - Future `TODO`: add a --strict mode which includes
    `checkValidityOfCast()` to ensure that the casting pairs follow TOSA
    specifications.
* Update LIT tests.

Signed-off-by: Justin Ngo <justin.ngo@arm.com>
Change-Id: I2aef3c79d8f2d98b93e671d5b815b8eab33e697e
* Update tosa.reshape's `shape` attribute as an input with !tosa.shape
  type.
* Update LIT tests.

Signed-off-by: Justin Ngo <justin.ngo@arm.com>
Change-Id: I72a9989912356895029787ff1f91d382e1de368a
@vivekkhandelwal1
Copy link
Collaborator

Hi @justin-ngo-arm, I have just one small request for future reference. It would be slightly easier for me (or for others) if you could have one single commit comprising fixes corresponding to an LLVM hash.

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.

2 participants