Skip to content

core: CV_STRONG_ALIGNMENT macro#16463

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
alalek:core_strong_ptr_alignment
Feb 8, 2020
Merged

core: CV_STRONG_ALIGNMENT macro#16463
opencv-pushbot merged 1 commit intoopencv:3.4from
alalek:core_strong_ptr_alignment

Conversation

@alalek
Copy link
Copy Markdown
Member

@alalek alalek commented Jan 29, 2020

Should be used to guard unsafe type casts of pointers.
Some platforms requires that.

relates #16373 #16152 #16139 #14281 #12961

Should be used to guard unsafe type casts of pointers
@vpisarev
Copy link
Copy Markdown
Contributor

vpisarev commented Feb 2, 2020

@alalek, we have v_load_aligned() to load from aligned addresses. v_load() must be able to handle unaligned data.

@alalek
Copy link
Copy Markdown
Member Author

alalek commented Feb 2, 2020

@vpisarev This is not about SIMD only - check #16139 and related issue.
Also there is no way to propagate alignment requirements through template.

v_load_aligned() to load from aligned addresses

... aligned on all 128 / 256 bits. This requirement is much stronger than alignment on lane(base) type.

@vpisarev
Copy link
Copy Markdown
Contributor

vpisarev commented Feb 3, 2020

@alalek, oh, I see, I misunderstood the code. But can we replace CV_Assert() with CV_DbgAssert()? Since adding the check to each load and store operation is quite significant overhead.

@alalek
Copy link
Copy Markdown
Member Author

alalek commented Feb 3, 2020

replace CV_Assert() with CV_DbgAssert()

It is intrin_cpp.hpp file. This SIMD implementation is not used by default:

There are weekly "SIMD emulator" builders which run intrin_cpp code through all tests (to ensure that SIMD functions are used properly).
Replacing to CV_DbgAssert() would require to switch these builders in debug mode - this is much slower than current checks (+emulated SIMD code) in release mode. So I would like to avoid that.

@alalek
Copy link
Copy Markdown
Member Author

alalek commented Feb 8, 2020

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants