Advertisement
Guest User

Untitled

a guest
Apr 16th, 2022
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.52 KB | None | 0 0
  1. #include <metal_stdlib>
  2. using namespace metal;
  3.  
  4. kernel void addition_compute_function(constant int *arr1         [[ buffer(0) ]],
  5.                                       constant int *arr2         [[ buffer(1) ]],
  6.                                       constant int& myVal         [[ buffer(3) ]],
  7.                                       device   int *resultArray  [[ buffer(2) ]],
  8.                                       uint   index [[ thread_position_in_grid ]])
  9. {
  10.     resultArray[index] = arr1[index] + arr2[index] + myVal;
  11. }
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement