Traitée Deadlock

  • lundi 23 juillet 2012 15:03
     
      A du code
    I'm experiencing a deadlock when running the following code in debug mode (works fine in release mode).

    concurrency::graphics::unorm quantize(concurrency::graphics::unorm value, float range) restrict(cpu, amp) { return concurrency::graphics::unorm(concurrency::fast_math::floor(value * range)/range); } concurrency::graphics::unorm_4 quantize(concurrency::graphics::unorm_4 value, float range) restrict(cpu, amp) { return concurrency::graphics::unorm_4(quantize(value.r, range), quantize(value.g, range), quantize(value.b, range), 1.0); } template<typename T> T quantization_error(T value, float range) restrict(cpu, amp) { return value - quantize(value, range); } template<typename T> concurrency::graphics::texture<T, 2> quantize_impl(const concurrency::graphics::texture<T, 2>& src, unsigned int dst_bits_per_element) { if(src.bits_per_scalar_element <= dst_bits_per_element) return src; concurrency::graphics::texture<T, 2> dst(src.extent, (((dst_bits_per_element + 7)/8)*8)); auto dst_range = static_cast<float>((1 << dst_bits_per_element) - 1); auto write = concurrency::graphics::writeonly_texture_view<T, 2>(dst); // Floyd–Steinberg Dithering (http://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering) concurrency::parallel_for_each(write.extent, [&, write, dst_range](concurrency::index<2> idx) restrict(amp) { auto val = quantize(src[idx], dst_range); val += quantization_error<T>(src[idx + concurrency::index<2>( 0, 1)], dst_range) * T(7.0f/16.0f);

    // If the following lines are uncommented it deadlocks? //val += quantization_error<T>(src[idx + concurrency::index<2>( 1, -1)], dst_range) * T(3.0f/16.0f); //val += quantization_error<T>(src[idx + concurrency::index<2>( 1, 0)], dst_range) * T(5.0f/16.0f); //val += quantization_error<T>(src[idx + concurrency::index<2>( 1, 1)], dst_range) * T(1.0f/16.0f); write.set(idx, T(val)); }); return dst; }




    • Modifié Dragon89 lundi 23 juillet 2012 15:18
    • Modifié Dragon89 lundi 23 juillet 2012 15:19
    •  

Toutes les réponses

  • lundi 23 juillet 2012 17:50
     
     Traitée

    Hi Dragon89,

    Could you please describe more on the behavior of the "deadlock"? Is it a TDR?  Could you please wrap all your code with a

    try{ // your AMP code } catch(std::exception & e) { std::cout << e.what() << std::endl; }

    see what you get.

    Also, do you get "deadlock" with the REF device?

    Thanks,

    Weirong


  • lundi 23 juillet 2012 18:15
     
     
    I solved it by using float_4 instead of unorm_4. I will look into it deeper later and get back to you.