Skip to content

Implement function.py return type coercion - #6832

Merged
KoolJBlack merged 2 commits into
iree-org:mainfrom
KoolJBlack:function-bool-coercion
Aug 25, 2021
Merged

KoolJBlack merged 2 commits into
iree-org:mainfrom
KoolJBlack:function-bool-coercion

Conversation

@KoolJBlack

@KoolJBlack KoolJBlack commented Aug 23, 2021 •

Copy link
Copy Markdown
Contributor

Update function.py to support ndarray type coercion on return (currently supported on input values). Tested for i8 to boolean conversion since the IREE runtime doesn't support boolean values internally.

@google-cla google-cla Bot added the cla: yes label Aug 23, 2021
@KoolJBlack
KoolJBlack force-pushed the function-bool-coercion branch from ecf55ee to 1b6f644 Compare August 23, 2021 23:03
@KoolJBlack
KoolJBlack requested a review from GMNGeoffrey August 23, 2021 23:33

@GMNGeoffrey GMNGeoffrey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So I've done my best to review this and it looks reasonable. I'm going to approve to unblock you and because I don't think this is going to break anything, but since I lack a lot of context on the function ABI and Python bindings, I'd appreciate @stellaraccident taking a look when she gets back

@stellaraccident stellaraccident left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

result = invoker(-1, a=1, b=2, c=3)

# TODO: Fill out all return types.
def testReturnTypeNdArrayBool(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You didn't create the testing deficit, but since you're here, would you mind stamping a variant of this out for all of the supported dtypes (probably except bf16 which no one knows what to do with)? Fine to say now... just trolling for test coverage :)

@KoolJBlack KoolJBlack Aug 24, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review! @stellaraccident

I actually asked on internal chat for clarification on this comment: I was wondering if the comment meant test type coercion from other ABI types specifically to i1 (say, doing an i32 to bool test), or type coercion from any DTYPE to any type in the ABI (i32 to i8)?

Also, there are some types listed in the VM_TO_PYTHON_CONVERTERS that are missing from the ABI_TYPE_TO_DTYPE, such at f16. Not sure how to handle this (or ignore it)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving this as a todo for now and will submit and address in followups when Stella returns.

@GMNGeoffrey

Copy link
Copy Markdown
Member

when she gets back 👀 😛

@KoolJBlack
KoolJBlack merged commit 7a1c579 into iree-org:main Aug 25, 2021
@KoolJBlack
KoolJBlack deleted the function-bool-coercion branch August 25, 2021 18:30
@hanhanW hanhanW mentioned this pull request Aug 25, 2021
copybara-service Bot pushed a commit that referenced this pull request Aug 25, 2021
* 30463f1 Adding #util.composite attribute. (#6854)
* 7a1c579 Implement function.py return type coercion (#6832)
* d90f0fc Remove PromoteTensorLoads pass, convert ExtractOp in TensorToFlow. (#6852)
* 7fa8c20 Update SwiftShader to 2021-08-25 (#6859)
* a328761 Rename Bazel repo iree_vulkan_headers to vulkan_headers (#6862)
* 7660e49 Merge pull request #6856 from google/benvanik-shared-target-backend
* ebc5eb5 Removing the pipeline caching during executable translation. (#6855)
* 2fb7a8d Reapply "Update TFLite concrete function conversion codes" (#6800)
* ce7b475 NFC: Merge ConvertToFlow passes into dedicated before/after passes. (#6850)
* 9fce2d6 Support f32 in the VM by default in the compiler. (#6744)
* b6baea9 Support global ref ops and fix passing of refs on function boundaries in the C..
* 4b5d2ed Bump flatcc version (#6853)
* c8a8f5d Add e2e tests for mhlo.bitcast_convert (#6846)

COPYBARA_INTEGRATE_REVIEW=#6865 from hanhanW:main-to-google 30463f1
PiperOrigin-RevId: 392952973
iree-github-actions-bot pushed a commit that referenced this pull request Aug 25, 2021
* 30463f1 Adding #util.composite attribute. (#6854)
* 7a1c579 Implement function.py return type coercion (#6832)
* d90f0fc Remove PromoteTensorLoads pass, convert ExtractOp in TensorToFlow. (#6852)
* 7fa8c20 Update SwiftShader to 2021-08-25 (#6859)
* a328761 Rename Bazel repo iree_vulkan_headers to vulkan_headers (#6862)
* 7660e49 Merge pull request #6856 from google/benvanik-shared-target-backend
* ebc5eb5 Removing the pipeline caching during executable translation. (#6855)
* 2fb7a8d Reapply "Update TFLite concrete function conversion codes" (#6800)
* ce7b475 NFC: Merge ConvertToFlow passes into dedicated before/after passes. (#6850)
* 9fce2d6 Support f32 in the VM by default in the compiler. (#6744)
* b6baea9 Support global ref ops and fix passing of refs on function boundaries in the C..
* 4b5d2ed Bump flatcc version (#6853)
* c8a8f5d Add e2e tests for mhlo.bitcast_convert (#6846)

PiperOrigin-RevId: 392952973
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.

3 participants