Assert when calling empty restrict(amp) function in VS 11 Beta

Answered Assert when calling empty restrict(amp) function in VS 11 Beta

  • Tuesday, May 01, 2012 6:45 PM
     
     

    I found a case that triggers an assert using C++ AMP in VS 11 Beta. Just define an empty function like this:

        void EmptyFunction(array_view<const float, 2> someView) restrict(amp) {}

    Call this function inside a parallel_for_each. If the code was compiled with the Debug config, a dialog box appears saying that a debug assertion failed. Here is the full text:

        Debug Assertion Failed!

        Program: ...ts\Visual Studio 11\Projects\CLAHE\bin\Debug\CLAHE.vshost.exe
        File: f:\dd\vctools\dpcxxrt\src\dpcrt_compiler.cpp
        Line: 519

        Expression: handle-> _M_device_buffer_info[i]._M_formal_access_mode != _Read_access || !pBufferRWProperty[i]

    There is no assert when compiled with the Release config.

    Edit: Change "float" to "const float" as noted by Weirong below.

    • Changed Type DanielMothMicrosoft Employee, Owner Tuesday, May 01, 2012 9:53 PM this is not a discussion. The implicit question is "Is that expected/fixed?"
    • Edited by tevo Wednesday, May 02, 2012 12:58 PM Fix example that causes bug
    •  

All Replies

  • Tuesday, May 01, 2012 10:48 PM
     
     Answered Has Code

    Hi Tevo,

    Thanks for reporting this.  This looks like a known bug and we should have it fixed for the final product.

    I can reproduce the issue in VS11 Beta with code like:

    #include <amp.h>
    using namespace concurrency;
    
    void EmptyFunction(array_view<const float, 2> someView) restrict(amp) {}
    
    int main()
    {
        float x; 
        array_view<const float, 2> av(1, 1, &x);
        parallel_for_each(av.extent, [=] (index<2> idx) restrict(amp) {
           EmptyFunction(av);
        });
        
        return 0;
    }

    Note my EmptyFunction is slightly different from yours. If I replace "const float" with "float", then I cannot reproduce the assertion as you have seen. So to confirm that we indeed fixed the bug you are experiencing, could you show me the small example you have (if it's not the same as mine) that can trigger the assertion?

    Thanks very much,

    Weirong


    • Edited by Zhu, Weirong Tuesday, May 01, 2012 10:48 PM
    • Marked As Answer by tevo Wednesday, May 02, 2012 12:55 PM
    •  
  • Wednesday, May 02, 2012 12:55 PM
     
     
    Thanks, Weirong. You are correct that my test case had "const float", not just "float".