dthuerck / mapmap_cpu

A high-performance general-purpose MRF MAP solver, heavily exploiting SIMD instructions.
BSD 3-Clause "New" or "Revised" License
103 stars 51 forks source link

MSVC debug mode assertion in void PairwiseTable<COSTTYPE, SIMDWIDTH>:: set_costs #18

Open ubc-nvining opened 5 years ago

ubc-nvining commented 5 years ago

Hi folks:

I'm trying to get this working in debug mode on MSVC 2017. Inside of void PairwiseTable<COSTTYPE, SIMDWIDTH>::set_costs(), an assert is being triggered in debug mode claiming an out of bounds operation from these lines here:

/* expand table into aligned storage */
for(_iv_st<COSTTYPE, SIMDWIDTH> li_a = 0; li_a < len_a; ++li_a)
    std::copy(&packed_table[li_a * len_b], 
        &packed_table[(li_a + 1) * len_b],
        &m_packed_table[li_a * padded_b]);

in Release mode, or even RelWithDebugInfo, this works fine.

h00shi commented 5 years ago

Is it the latest version, or the one that I have been using?

ubc-nvining commented 5 years ago

Both. I tried updating to the latest version with no luck.

h00shi commented 5 years ago

If you think it would be of any help, I can take a look if you point me to the input data that trigger the assertion.

dthuerck commented 5 years ago

Hi,

unfortunately, I lack a WIndows/MSVC system to reproduce the issue; however, could you please check the following: 1) What is the SIMDWIDTH selected / reported for your system? 2) In what array is the out of bounds detected? packed_table or m_packed_table? You could e.g. look at the address valgrind returns and compare them with the address ranges of both arrays. 3) Are you getting a similar exception from std::fill(m_packed_table, m_packed_table + padded_size, 0); (in the constructor)? This should access the same memory range -- if the problem is m_packed_table.

Thanks!