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

[RFC/WIP] Intrinsics for NTuple{N, VecElement} #18470

Closed
wants to merge 6 commits into from
Closed

[RFC/WIP] Intrinsics for NTuple{N, VecElement} #18470

wants to merge 6 commits into from

Conversation

vchuravy
Copy link
Member

@vchuravy vchuravy commented Sep 13, 2016

This fixes #18445 by handling NTuple{N, VecElement} in the lowering of our intrinsics. This should make it easier to implement the fundamentals of SIMD.jl without llvmcall and maybe in the long-term enable us to have SIMD types in base julia.

Todo:

  • Runtime intrinsics (right now they return nonsense.)
  • Floats handling
  • in jl_is_vec_type check that VecElement contains a jl_is_bitstype

If needed I can separate out b2f6b1b and fb12337 into a separate PR.

cc @eschnett

@@ -936,6 +937,24 @@ STATIC_INLINE int jl_is_vecelement_type(jl_value_t* t)
((jl_datatype_t*)(t))->name == jl_vecelement_typename);
}

STATIC_INLINE int jl_is_vec_type(jl_value_t* t)
{
if (!jl_is_tuple_type(t))
Copy link
Contributor

Choose a reason for hiding this comment

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

4 space (also one case in the test)

@vchuravy
Copy link
Member Author

So the big show-stopper for this are our runtime intrinsics. I am slightly tempted to punt this down the road till somebody actually needs it and for now implement MethodsErrors for runtime intrinsics that don't support vector types.

@StefanKarpinski StefanKarpinski added kind:speculative Whether the change will be implemented is speculative performance Must go faster domain:broadcast Applying a function over a collection labels Sep 13, 2016
@StefanKarpinski StefanKarpinski added this to the 0.6.0 milestone Sep 13, 2016
jl_errorf("%s: type is not a bitstype", name);
if (!(jl_is_bitstype(aty) || jl_is_vec_type(aty)))
jl_errorf("%s: value is not a bitstype or vector type", name);
if (!(jl_is_bitstype(ty) || jl_is_vec_type(aty)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean ty instead of aty here?

* Use `jl_datatype_size` instead of `dt->size`.
  `jl_datatype_size` is always in bytes, whereas the underlying
  implementation of `dt->size` might change.

* do not use .size directly (that is just asking for trouble)

* Introduce `jl_datatype_nbits` that gives nbits
  Instead of calculating it per hand everywhere. This allows for
  interesting experiments (and eventually not restricting `bitstype` to
  multiplies of 8).
@StefanKarpinski
Copy link
Sponsor Member

How's this going?

@vchuravy
Copy link
Member Author

Stalled because it needs a big refactor of runtime-intrinsics. I started that, but I don't have time to finish it right now. My secret plan is to allow for the implementation of runtime intrinsics in Julia #18927, but that is also a massive work item.

@StefanKarpinski
Copy link
Sponsor Member

Cool. You'll probably want to talk/collaborate with @vtjnash on any intrinsics work so you two aren't working across purposes.

@StefanKarpinski
Copy link
Sponsor Member

This doesn't look like it's going to be ready in time for 0.6.

@vchuravy
Copy link
Member Author

vchuravy commented Jan 6, 2017

No this won't be ready in time and is somewhat dependent on the runtime-library julep.

@JeffBezanson JeffBezanson modified the milestones: 1.x, 1.0 Jul 13, 2017
@JeffBezanson
Copy link
Sponsor Member

Seems like a feature that can be post-1.0.

@vchuravy vchuravy closed this Mar 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:broadcast Applying a function over a collection kind:speculative Whether the change will be implemented is speculative performance Must go faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lowering of NTuple{4, VecElement{UInt8}}
7 participants