Ver código fonte

build: add CUDA demod kernel build helper

master
Jan Svabenik 3 dias atrás
pai
commit
2f286aec75
3 arquivos alterados com 29 adições e 0 exclusões
  1. +1
    -0
      internal/demod/gpudemod/README.md
  2. +1
    -0
      internal/demod/gpudemod/gpudemod.go
  3. +27
    -0
      tools/build-gpudemod-kernel.ps1

+ 1
- 0
internal/demod/gpudemod/README.md Ver arquivo

@@ -21,6 +21,7 @@ This is **not compiled automatically yet** in the current environment because th
On a CUDA-capable dev machine with toolchain installed:

1. Compile `kernels.cu` into an object file
- helper script: `tools/build-gpudemod-kernel.ps1`
2. Link it into the `cufft` build
3. Replace `gpud_launch_freq_shift(...)` stub body with the real kernel launch
4. Validate copied-back shifted IQ against `dsp.FreqShift`


+ 1
- 0
internal/demod/gpudemod/gpudemod.go Ver arquivo

@@ -4,6 +4,7 @@ package gpudemod

/*
#cgo windows LDFLAGS: -lcufft64_12 -lcudart64_13
#cgo windows CFLAGS: -I"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.2/include"
#include <cuda_runtime.h>
#include <cufft.h>



+ 27
- 0
tools/build-gpudemod-kernel.ps1 Ver arquivo

@@ -0,0 +1,27 @@
param(
[string]$CudaRoot = 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2',
[string]$Source = 'internal/demod/gpudemod/kernels.cu',
[string]$OutDir = 'internal/demod/gpudemod/build'
)

$ErrorActionPreference = 'Stop'
$repo = Split-Path -Parent $PSScriptRoot
Set-Location $repo

$nvcc = Join-Path $CudaRoot 'bin\nvcc.exe'
if (!(Test-Path $nvcc)) {
throw "nvcc not found at $nvcc"
}

New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
$outObj = Join-Path $OutDir 'kernels.obj'

Write-Host "Using nvcc: $nvcc"
Write-Host "Building $Source -> $outObj"

& $nvcc -c $Source -o $outObj -I (Join-Path $CudaRoot 'include') -Xcompiler "/EHsc"
if ($LASTEXITCODE -ne 0) {
throw "nvcc failed with exit code $LASTEXITCODE"
}

Write-Host "Built: $outObj"

Carregando…
Cancelar
Salvar