Commit: 59799893a995715a70b6671f7f38678d4800429e
Parent: c1a71d5569172be1d5af8cfe5f643c83b2911b07
Author: Tyler Henry
Date: Mon, 26 Aug 2024 10:38:10 -0600
split cuda decode and hilbert into two calls
Diffstat:
7 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,6 +1,8 @@
ogl
+ogl.exe
*.dll
*.so
*.mexa64
external/lib
external/include/r*.h
+x64
diff --git a/beamformer.c b/beamformer.c
@@ -124,11 +124,15 @@ do_compute_shader(BeamformerCtx *ctx, enum compute_shaders shader)
csctx->raw_data_fences[csctx->raw_data_index] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
csctx->last_output_ssbo_index = !csctx->last_output_ssbo_index;
break;
- case CS_CUDA_DECODE_AND_DEMOD:
- decode_and_hilbert(csctx->raw_data_index * rf_raw_size, output_ssbo_idx);
+ case CS_CUDA_DECODE:
+ cuda_decode(csctx->raw_data_index * rf_raw_size, output_ssbo_idx);
csctx->raw_data_fences[csctx->raw_data_index] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
csctx->last_output_ssbo_index = !csctx->last_output_ssbo_index;
break;
+ case CS_CUDA_HILBERT:
+ cuda_hilbert(input_ssbo_idx, output_ssbo_idx);
+ csctx->last_output_ssbo_index = !csctx->last_output_ssbo_index;
+ break;
case CS_DEMOD:
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, csctx->rf_data_ssbos[input_ssbo_idx]);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, csctx->rf_data_ssbos[output_ssbo_idx]);
diff --git a/beamformer.h b/beamformer.h
@@ -166,11 +166,14 @@ typedef struct {
typedef INIT_CUDA_CONFIGURATION_FN(init_cuda_configuration_fn);
#define REGISTER_CUDA_BUFFERS_FN(name) void name(u32 *rf_data_ssbos, u32 rf_buffer_count, u32 raw_data_ssbo)
typedef REGISTER_CUDA_BUFFERS_FN(register_cuda_buffers_fn);
-#define DECODE_AND_HILBERT_FN(name) void name(size_t input_offset, u32 output_buffer_idx)
-typedef DECODE_AND_HILBERT_FN(decode_and_hilbert_fn);
+#define CUDA_DECODE_FN(name) void name(size_t input_offset, u32 output_buffer_idx)
+typedef CUDA_DECODE_FN(cuda_decode_fn);
+#define CUDA_HILBERT_FN(name) void name(u32 input_buffer_idx, u32 output_buffer_idx)
+typedef CUDA_HILBERT_FN(cuda_hilbert_fn);
static init_cuda_configuration_fn *init_cuda_configuration;
static register_cuda_buffers_fn *register_cuda_buffers;
-static decode_and_hilbert_fn *decode_and_hilbert;
+static cuda_decode_fn *cuda_decode;
+static cuda_hilbert_fn *cuda_hilbert;
#endif /*_BEAMFORMER_H_ */
diff --git a/beamformer_parameters.h b/beamformer_parameters.h
@@ -1,12 +1,12 @@
/* See LICENSE for license details. */
enum compute_shaders {
- /* TODO: Probably this should be split up */
- CS_CUDA_DECODE_AND_DEMOD = 0,
- CS_DEMOD = 1,
- CS_HADAMARD = 2,
- CS_HERCULES = 3,
- CS_MIN_MAX = 4,
- CS_UFORCES = 5,
+ CS_CUDA_DECODE = 0,
+ CS_CUDA_HILBERT = 1,
+ CS_DEMOD = 2,
+ CS_HADAMARD = 3,
+ CS_HERCULES = 4,
+ CS_MIN_MAX = 5,
+ CS_UFORCES = 6,
CS_LAST
};
diff --git a/helpers/ogl_beamformer_lib.c b/helpers/ogl_beamformer_lib.c
@@ -140,7 +140,8 @@ set_beamformer_pipeline(char *shm_name, i32 *stages, i32 stages_count)
for (i32 i = 0; i < stages_count; i++) {
switch (stages[i]) {
- case CS_CUDA_DECODE_AND_DEMOD:
+ case CS_CUDA_DECODE:
+ case CS_CUDA_HILBERT:
case CS_DEMOD:
case CS_HADAMARD:
case CS_HERCULES:
diff --git a/main.c b/main.c
@@ -58,7 +58,8 @@ do_debug(void)
/* NOTE: cuda lib stubs */
INIT_CUDA_CONFIGURATION_FN(init_cuda_configuration_stub) {}
REGISTER_CUDA_BUFFERS_FN(register_cuda_buffers_stub) {}
-DECODE_AND_HILBERT_FN(decode_and_hilbert_stub) {}
+CUDA_DECODE_FN(cuda_decode_stub) {}
+CUDA_HILBERT_FN(cuda_hilbert_stub) {}
static void
gl_debug_logger(u32 src, u32 type, u32 id, u32 lvl, i32 len, const char *msg, const void *userctx)
@@ -211,7 +212,8 @@ main(void)
if (!f) f = f##_stub
LOOKUP_CUDA_FN(init_cuda_configuration);
LOOKUP_CUDA_FN(register_cuda_buffers);
- LOOKUP_CUDA_FN(decode_and_hilbert);
+ LOOKUP_CUDA_FN(cuda_decode);
+ LOOKUP_CUDA_FN(cuda_hilbert);
break;
}
diff --git a/ui.c b/ui.c
@@ -343,12 +343,13 @@ draw_debug_overlay(BeamformerCtx *ctx, Arena arena, Rect r)
uv2 ws = ctx->window_size;
static s8 labels[CS_LAST] = {
- [CS_CUDA_DECODE_AND_DEMOD] = s8("CUDA Decoding:"),
- [CS_HADAMARD] = s8("Decoding:"),
- [CS_HERCULES] = s8("HERCULES:"),
- [CS_DEMOD] = s8("Demodulation:"),
- [CS_MIN_MAX] = s8("Min/Max:"),
- [CS_UFORCES] = s8("UFORCES:"),
+ [CS_CUDA_DECODE] = s8("CUDA Decoding:"),
+ [CS_CUDA_HILBERT] = s8("CUDA Hilbert:"),
+ [CS_DEMOD] = s8("Demodulation:"),
+ [CS_HADAMARD] = s8("Decoding:"),
+ [CS_HERCULES] = s8("HERCULES:"),
+ [CS_MIN_MAX] = s8("Min/Max:"),
+ [CS_UFORCES] = s8("UFORCES:"),
};
ComputeShaderCtx *cs = &ctx->csctx;