Microsoft AMP throws memory error when compiled in x64

0

I am trying to work with Microsoft's AMP (Accelerated Massive Parallelism) library in Visual Studio 2019, but I cannot run my code when using x64 mode.

Everything compiles correctly, but I get a memory error whenever I try to do anything in parallel using AMP in x64 mode while the program is running, but I need to be able to use x64 mode, as x86 only allows for 2GB of system memory to be used, while the project I am working on requires more than that.

Is there any way to fix this issue, or is it just a flaw with the software itself?

If it helps, I'm using an AMD Ryzen 9 3950x and an NVIDIA GeForce RTX 2080

=============== EDIT ==============

Here is a small bit of code that shows the issue:

#include <iostream>
#include <amp.h>

using namespace concurrency;

int main()
{
    std::cout << "Hello World!\n";

    int a[3] = {1, 2, 3};
    int b[3] = {4, 5, 6};
    int c[3] = {0, 0, 0};

    array_view<const int, 1> arrayA(3, a);
    array_view<const int, 1> arrayB(3, b);
    array_view<int, 1> arrayC(3, c);

    parallel_for_each(arrayC.extent, [=](index<1> idx) restrict(amp)
    {
        arrayC(idx[0]) = arrayA(idx[0]) + arrayB(idx[0]);
    });

    arrayC.synchronize();

    for (int i : c)
        std::cout << i << ", ";
    std::cout << "\n";
}

It compiles, but when it is run in x64 mode, it throws this error:

Exception thrown at 0x00007FF89B2A43D5 (vcamp140d.dll) in UselessApp.exe:
0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

The exact location of the error is at line 1058 in amprt.h

c++
visual-studio
visual-c++
access-violation
asked on Stack Overflow Dec 28, 2020 by Pencilcaseman • edited Dec 28, 2020 by Pencilcaseman

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0