Skip to content

Commit

Permalink
ADE version 0.1.1b (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardcode84 authored Sep 24, 2018
1 parent 72bb15f commit e3725de
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions sources/ade/include/ade/communication/comm_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class DataBufferView final
Span ret = span + m_span.origin();
for (auto i: util::iota(m_span.dims_count()))
{
ADE_UNUSED(i);
ADE_ASSERT(ret[i].begin >= m_span[i].begin);
ADE_ASSERT(ret[i].end <= m_span[i].end);
}
Expand Down
5 changes: 5 additions & 0 deletions sources/ade/include/ade/util/assert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ namespace details
/// @param str String description.
#define ADE_UNREACHABLE(str) ADE_ASSERT_STRONG(!str)

/// Mark variable UNUSED, suitable if it is used only in ADE_ASSERT
///
/// @param x Variable to mark
#define ADE_UNUSED(x) (void)(x)

namespace ade
{
/// Convenient function for exception throwing.
Expand Down
1 change: 1 addition & 0 deletions sources/ade/include/ade/util/checked_cast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ struct CheckedCastDefHandler final
template<typename T>
void operator()(bool valid, T&& /*value*/) const
{
ADE_UNUSED(valid);
ADE_ASSERT(valid);
}
};
Expand Down
1 change: 1 addition & 0 deletions sources/ade/include/ade/util/md_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ struct DynMdView final
ADE_ASSERT(span.dims_count() == count());
for (auto i: util::iota(count()))
{
ADE_UNUSED(i);
ADE_ASSERT(span[i].begin <= span[i].end);
ADE_ASSERT(span[i].begin >= 0 && span[i].end <= dimensions[i].length);
}
Expand Down
2 changes: 2 additions & 0 deletions sources/ade/source/memory_descriptor_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,12 @@ bool operator!=(const MemoryDescriptorView& ref, std::nullptr_t)

void MemoryDescriptorView::checkSpans(MemoryDescriptor& descriptor) const
{
ADE_UNUSED(descriptor);
ADE_ASSERT(descriptor.dimensions().dims_count() == m_span.dims_count());
for (auto i: util::iota(m_span.dims_count()))
{
auto& val = m_span[i];
ADE_UNUSED(val);
ADE_ASSERT(val.begin >= 0);
ADE_ASSERT(val.end <= descriptor.dimensions()[i]);
}
Expand Down
2 changes: 2 additions & 0 deletions sources/ade/source/passes/communications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,15 @@ ade::IDataBuffer::MapId HostBufferImpl::map(const Span& span, Access /*access*/)
ADE_ASSERT(nullptr != view);
ADE_ASSERT(span.dims_count() == m_size.dims_count());
auto accessCount = ++m_accessCount;
ADE_UNUSED(accessCount);
ADE_ASSERT(accessCount > 0);
return MapId{view.slice(span), 0};
}

void HostBufferImpl::unmap(const MapId& /*id*/)
{
auto accessCount = --m_accessCount;
ADE_UNUSED(accessCount);
ADE_ASSERT(accessCount >= 0);
}

Expand Down

0 comments on commit e3725de

Please sign in to comment.