Skip to content

Commit

Permalink
Improve shapetype propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pencilcaseman committed Aug 20, 2023
1 parent 479d7c7 commit e4aeb73
Show file tree
Hide file tree
Showing 4 changed files with 321 additions and 281 deletions.
1 change: 1 addition & 0 deletions librapid/include/librapid/array/arrayContainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace librapid {
using Scalar = typename TypeInfo<StorageType_>::Scalar;
using Packet = std::false_type;
using Backend = typename TypeInfo<StorageType_>::Backend;
using ShapeType = ShapeType_;
static constexpr int64_t packetWidth = 1;
static constexpr bool supportsArithmetic = TypeInfo<Scalar>::supportsArithmetic;
static constexpr bool supportsLogical = TypeInfo<Scalar>::supportsLogical;
Expand Down
6 changes: 3 additions & 3 deletions librapid/include/librapid/array/assignOps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ namespace librapid {
using Function = detail::Function<descriptor::Trivial, Functor_, Args...>;
using Scalar =
typename array::ArrayContainer<ShapeType_, Storage<StorageScalar>>::Scalar;
constexpr int64_t packetWidth = typetraits::TypeInfo<Scalar>::packetWidth;
constexpr size_t packetWidth = typetraits::TypeInfo<Scalar>::packetWidth;

constexpr bool allowVectorisation =
typetraits::TypeInfo<
detail::Function<descriptor::Trivial, Functor_, Args...>>::allowVectorisation &&
Function::argsAreSameType;

const int64_t size = function.shape().size();
const int64_t vectorSize = size - (size % packetWidth);
const size_t size = function.shape().size();
const size_t vectorSize = size - (size % packetWidth);

LIBRAPID_ASSUME(vectorSize % packetWidth == 0);

Expand Down
Loading

0 comments on commit e4aeb73

Please sign in to comment.