mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-25 06:17:38 -04:00
15 lines
510 B
C++
15 lines
510 B
C++
#include <vx_spawn.h>
|
|
#include "common.h"
|
|
|
|
void kernel_body(kernel_arg_t* __UNIFORM__ arg) {
|
|
auto src0_ptr = reinterpret_cast<TYPE*>(arg->src0_addr);
|
|
auto src1_ptr = reinterpret_cast<TYPE*>(arg->src1_addr);
|
|
auto dst_ptr = reinterpret_cast<TYPE*>(arg->dst_addr);
|
|
|
|
dst_ptr[blockIdx.x] = src0_ptr[blockIdx.x] + src1_ptr[blockIdx.x];
|
|
}
|
|
|
|
int main() {
|
|
kernel_arg_t* arg = (kernel_arg_t*)csr_read(VX_CSR_MSCRATCH);
|
|
return vx_spawn_threads(1, &arg->num_points, nullptr, (vx_kernel_func_cb)kernel_body, arg);
|
|
}
|