Summary
Allow shared-memory footprint to be chosen at launch time rather than only via compile-time \! shared name T[N] constants.
Motivation
Static shared sizes force kernels to compile for a max problem size (e.g. attention SCORES f64[1024]). Dynamic shared memory (CUDA extern __shared__ / launch sharedMemBytes) is standard for libraries that adapt to runtime seq_len or tile sizes.
Proposed design (sketch)
Language
\! shared SCORES f64[] \ dynamic, extent from host
\! shared SCORES f64[MAX] \ static max + optional dynamic use
Or a header directive:
\! dynamic-shared 8192 \ bytes requested by default; host may override
Lowering
- MLIR GPU workgroup memory with dynamic size where supported
- Host API / runner passes
shared_mem_bytes at launch
- Kernel uses base pointers as today; bounds are programmer-managed (debug checks optional)
Acceptance criteria
Related
Summary
Allow shared-memory footprint to be chosen at launch time rather than only via compile-time
\! shared name T[N]constants.Motivation
Static shared sizes force kernels to compile for a max problem size (e.g. attention
SCORES f64[1024]). Dynamic shared memory (CUDAextern __shared__/ launchsharedMemBytes) is standard for libraries that adapt to runtimeseq_lenor tile sizes.Proposed design (sketch)
Language
Or a header directive:
Lowering
shared_mem_bytesat launchAcceptance criteria
\! shareddeclarations defined (replace vs additional)Related