makepad/libs/ai/cuda/kernels/launch_profile.cuh
Admin 74faf62ef1 ai: the AI hub gives way to the UI, smaller models, vision and speech
The AI hub serves local models on the LAN and now yields GPU memory to the
UI (shrinks the chat context, then unloads; grows back after; never loads
into the UI reserve), groups models by type, and reports each model's
memory split. LLM decode on Vulkan with Splash kernels, one shared GPU
device per process, vision on chat turns, an on-device text detector,
music models and stems.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 12:26:21 +02:00

32 lines
1.1 KiB
Text

#pragma once
#include <cuda_runtime.h>
#include <stddef.h>
#include <stdint.h>
// Opt-in cudaEvent graph nodes, read after one instrumented replay. Scopes
// must contain exactly one launch. Rows/cols describe the op, not its grid.
extern thread_local bool makepad_cuda_launch_profile_active;
size_t makepad_cuda_launch_profile_start(const char *name, cudaStream_t stream,
uint32_t rows, uint32_t cols);
void makepad_cuda_launch_profile_stop(size_t slot, cudaStream_t stream);
class MakepadLaunchTiming {
size_t slot = SIZE_MAX;
cudaStream_t stream;
public:
MakepadLaunchTiming(const char *name, cudaStream_t stream, uint32_t rows, uint32_t cols)
: stream(stream) {
if (makepad_cuda_launch_profile_active) {
slot = makepad_cuda_launch_profile_start(name, stream, rows, cols);
}
}
~MakepadLaunchTiming() {
if (slot != SIZE_MAX) makepad_cuda_launch_profile_stop(slot, stream);
}
};
struct MakepadKernelTiming {
const char *name;
uint32_t rows, cols;
double microseconds;
};