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

Make broadcast extendable to user array wrapper. #1001

Merged
merged 4 commits into from
Mar 2, 2022

Conversation

N5N3
Copy link
Contributor

@N5N3 N5N3 commented Feb 22, 2022

This PR tries to make the current broadcast kernal reusable to more wrapped StaticArray.
For this goal, we need to get first_staticarray outside the @generated function to make sure the type match extendable. (Not sure the reason)
Our optimizer should be clever enough to make it zero cost at runtime.

This was discussed in JuliaArrays/StructArrays.jl#215, where we want to make

s = StructArray{ComplexF64}((SVector(1., 2., 3.), SVector(0., 0., 0.)))
log.(s)

return a SVector.

A simple test has been added.

@N5N3 N5N3 force-pushed the extendbroadcast branch 2 times, most recently from 685d0aa to b16e346 Compare February 22, 2022 07:53
Copy link
Collaborator

@mateuszbaran mateuszbaran left a comment

Choose a reason for hiding this comment

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

This looks fine, there should be as little code in generated functions as possible. Constant propagation will have a bit more work to do but it should manage I think.

1. Make `broadcast` extendable
2. Fix empty case.
@N5N3 N5N3 force-pushed the extendbroadcast branch from b16e346 to 1625719 Compare March 2, 2022 08:56
@N5N3 N5N3 force-pushed the extendbroadcast branch from 1625719 to f6aa9f5 Compare March 2, 2022 08:59
@mateuszbaran mateuszbaran merged commit ca50465 into JuliaArrays:master Mar 2, 2022
@N5N3 N5N3 deleted the extendbroadcast branch March 2, 2022 11:41
N5N3 added a commit to N5N3/StaticArrays.jl that referenced this pull request Mar 2, 2022
* Reviewed

1. Make `broadcast` extendable
2. Fix empty case.

* Add more test

* Bump release.

* Test fix
@N5N3 N5N3 mentioned this pull request Mar 16, 2022
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