'Passing integer to kernel function
------ Context ------
i am completely new to swift and metal(kit?).
Problem is: i need to realize a parallel prefixSum(to be specific: the Blelloch scan) calculation in the next 2 weeks.
Due to me not having a NVIDIA GPU but an M1 Macbook, i chose metal, so please be patient with me..
After watching this video (the code is in the video-description), I now try to modify the code so that the prefixSum is calculated instead of just adding two arrays at index i.
------ Question ------
In the first step,I only want to pass an integer myVal and just add up the three values.
Unfortunately, the output for the first 3 values looks like this(note the last digit, which has the expected value but without the additional myVal):
3 + 5 + 10 = 42949672978
2 + 6 + 10 = 42949672978
8 + 3 + 10 = 42949672981
instead of this:
3 + 5 + 10 = 18
2 + 6 + 10 = 18
8 + 3 + 10 = 21
The main.swift code is in this pastebin. The compute.metal can be found here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
