Closed Bambofy closed 4 years ago
update
When running this program:
auto instance = vuh::Instance();
auto device = instance.devices().at(0);
std::vector<float> inputHostData = std::vector<float>(1000, 100.0f);
std::vector<float> outputHostData = std::vector<float>(1000, -1.0f);
auto inputDeviceData = vuh::Array<float>(device, inputHostData);
auto outDeviceData = vuh::Array<float>(device, outputHostData);
using Specs = vuh::typelist<uint32_t, uint32_t, uint32_t>;
struct Params {
uint32_t numberOfElements;
};
auto program = vuh::Program<Specs, Params>(device, "a.spv");
program.grid(128, 1, 1);
program.spec(128, 1, 1);
program.bind({ 1000 }, inputDeviceData, outDeviceData);
program.run();
outDeviceData.toHost(outputHostData.begin());
std::cout << "Complete" << std::endl;
it prints an EXC_BAD_INSTRUCT on the last std::cout line. However, the outputHostData array actually contains the correct data!
Here is the vulkan information for this Macbook Air: osx_gpu.txt
Ok i found a fix!
You have to put a return statement at the end of the function, or else you get a EXC_BAD_INSTRUCTION.
Trying to copy from a vuh::Array to host vector after running a program causes a EXC_BAD_INSTRUCTION exception. OS X.
Image:
Sample code:
Sample spv