mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-05 04:35:46 +08:00
Fix compilation warnings and errors with clang in TensorBlockV2 code and tests
This commit is contained in:
parent
60ae24ee1a
commit
98bdd7252e
@ -418,7 +418,7 @@ class TensorMaterializedBlock {
|
|||||||
|
|
||||||
if (can_use_direct_access) {
|
if (can_use_direct_access) {
|
||||||
const Scalar* block_start = data + desc.offset();
|
const Scalar* block_start = data + desc.offset();
|
||||||
return TensorMaterializedBlock(TensorBlockKind::kView, block_start,
|
return TensorMaterializedBlock(internal::TensorBlockKind::kView, block_start,
|
||||||
desc.dimensions());
|
desc.dimensions());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -438,7 +438,7 @@ class TensorMaterializedBlock {
|
|||||||
|
|
||||||
TensorBlockIO::Copy(dst, src);
|
TensorBlockIO::Copy(dst, src);
|
||||||
|
|
||||||
return TensorMaterializedBlock(TensorBlockKind::kMaterializedInScratch,
|
return TensorMaterializedBlock(internal::TensorBlockKind::kMaterializedInScratch,
|
||||||
block_buffer, desc.dimensions());
|
block_buffer, desc.dimensions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,8 +295,8 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device
|
|||||||
// Initialize output block iterator state. Dimension in this array are
|
// Initialize output block iterator state. Dimension in this array are
|
||||||
// always in inner_most -> outer_most order (col major layout).
|
// always in inner_most -> outer_most order (col major layout).
|
||||||
array<BlockIteratorState, NumDims - 1> it;
|
array<BlockIteratorState, NumDims - 1> it;
|
||||||
for (Index i = 0; i < NumDims - 1; ++i) {
|
for (int i = 0; i < NumDims - 1; ++i) {
|
||||||
const Index dim = IsColMajor ? i + 1 : NumDims - i - 2;
|
const int dim = IsColMajor ? i + 1 : NumDims - i - 2;
|
||||||
it[i].count = 0;
|
it[i].count = 0;
|
||||||
it[i].size = desc.dimension(dim);
|
it[i].size = desc.dimension(dim);
|
||||||
|
|
||||||
|
@ -104,13 +104,13 @@ static TensorBlockParams<NumDims> FixedSizeBlock(DSizes<Index, NumDims> dims) {
|
|||||||
return {offsets, dims, TensorBlockDescriptor<NumDims, Index>(0, dims)};
|
return {offsets, dims, TensorBlockDescriptor<NumDims, Index>(0, dims)};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Eigen::IndexList<int, Eigen::type2index<1>> NByOne(int n) {
|
inline Eigen::IndexList<Index, Eigen::type2index<1>> NByOne(Index n) {
|
||||||
Eigen::IndexList<int, Eigen::type2index<1>> ret;
|
Eigen::IndexList<Index, Eigen::type2index<1>> ret;
|
||||||
ret.set(0, n);
|
ret.set(0, n);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
inline Eigen::IndexList<Eigen::type2index<1>, int> OneByM(int m) {
|
inline Eigen::IndexList<Eigen::type2index<1>, Index> OneByM(Index m) {
|
||||||
Eigen::IndexList<Eigen::type2index<1>, int> ret;
|
Eigen::IndexList<Eigen::type2index<1>, Index> ret;
|
||||||
ret.set(1, m);
|
ret.set(1, m);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -582,10 +582,11 @@ static void test_async_execute_unary_expr(Device d)
|
|||||||
Eigen::Barrier done(1);
|
Eigen::Barrier done(1);
|
||||||
auto on_done = [&done]() { done.Notify(); };
|
auto on_done = [&done]() { done.Notify(); };
|
||||||
|
|
||||||
|
static const bool TilingOn = Tiling == TiledEvaluation::Off ? false : true;
|
||||||
using Assign = TensorAssignOp<decltype(dst), const decltype(expr)>;
|
using Assign = TensorAssignOp<decltype(dst), const decltype(expr)>;
|
||||||
using DoneCallback = decltype(on_done);
|
using DoneCallback = decltype(on_done);
|
||||||
using Executor = internal::TensorAsyncExecutor<const Assign, Device, DoneCallback,
|
using Executor = internal::TensorAsyncExecutor<const Assign, Device, DoneCallback,
|
||||||
Vectorizable, Tiling>;
|
Vectorizable, TilingOn>;
|
||||||
|
|
||||||
Executor::runAsync(Assign(dst, expr), d, on_done);
|
Executor::runAsync(Assign(dst, expr), d, on_done);
|
||||||
done.Wait();
|
done.Wait();
|
||||||
@ -618,10 +619,11 @@ static void test_async_execute_binary_expr(Device d)
|
|||||||
Eigen::Barrier done(1);
|
Eigen::Barrier done(1);
|
||||||
auto on_done = [&done]() { done.Notify(); };
|
auto on_done = [&done]() { done.Notify(); };
|
||||||
|
|
||||||
|
static const bool TilingOn = Tiling == TiledEvaluation::Off ? false : true;
|
||||||
using Assign = TensorAssignOp<decltype(dst), const decltype(expr)>;
|
using Assign = TensorAssignOp<decltype(dst), const decltype(expr)>;
|
||||||
using DoneCallback = decltype(on_done);
|
using DoneCallback = decltype(on_done);
|
||||||
using Executor = internal::TensorAsyncExecutor<const Assign, Device, DoneCallback,
|
using Executor = internal::TensorAsyncExecutor<const Assign, Device, DoneCallback,
|
||||||
Vectorizable, Tiling>;
|
Vectorizable, TilingOn>;
|
||||||
|
|
||||||
Executor::runAsync(Assign(dst, expr), d, on_done);
|
Executor::runAsync(Assign(dst, expr), d, on_done);
|
||||||
done.Wait();
|
done.Wait();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user