CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / src / omega_gpu_conv2d_api.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ |
| 2 | #ifndef OMEGA_GPU_CONV2D_API_H |
| 3 | #define OMEGA_GPU_CONV2D_API_H |
| 4 | #include "omega_blackwell_codegen.h" |
| 5 | #include "omega_gpu_dnn_types.h" |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | /* Contiguous NCHW (layout=0) or NHWC (layout=1), for BOTH input and output. |
| 10 | * Filter is always contiguous OIHW: [out_channels][in_channels/groups][kh][kw]. |
| 11 | * Cross-correlation, not reversed convolution. Zero padding is explicit on four |
| 12 | * sides. OH=floor((H+top+bottom-dilation_h*(kh-1)-1)/stride_h)+1, likewise OW. |
| 13 | * Input/filter storage uses dtype 0=f32,1=bf16,2=f16; accumulation/output f32. |
| 14 | * No bias, scaling, activation or implicit SAME padding. No im2col workspace. */ |
| 15 | typedef struct { |
| 16 | uint32_t batch, in_channels, height, width, out_channels; |
| 17 | uint32_t kernel_h, kernel_w, stride_h, stride_w; |
| 18 | uint32_t pad_top, pad_bottom, pad_left, pad_right; |
| 19 | uint32_t dilation_h, dilation_w, groups, layout, dtype; |
| 20 | } OmegaGpuConv2dShape; |
| 21 | enum { OMEGA_GPU_CONV2D_OK=0, OMEGA_GPU_CONV2D_BAD_ARGS=1, |
| 22 | OMEGA_GPU_CONV2D_REFUSED=2, OMEGA_GPU_CONV2D_CODEGEN=3, OMEGA_GPU_CONV2D_CHIP=4 }; |
| 23 | /* plan[0:2]=OH,OW; [2:5]=input/filter/output bytes; [5]=launch count; |
| 24 | * [6:8]=grid_x,threads; [8:11]=byte offsets for a launch; [11]=output row. |
| 25 | * All planning/refusal occurs before session access. Dimension bound 65535, |
| 26 | * positive geometry, divisible groups and each tensor/launch count <2^30. */ |
| 27 | int omega_gpu_conv2d_plan(const OmegaGpuConv2dShape *shape, uint64_t launch, uint64_t plan[32]); |
| 28 | int omega_gpu_conv2d_codegen(const OmegaGpuConv2dShape *shape, BlackwellIRProgram *program, |
| 29 | uint8_t *code, size_t capacity, OmegaBlackwellKernel *kernel); |
| 30 | int omega_gpu_conv2d(const OmegaGpuConv2dShape *shape, const void *image, const void *filter, float *output); |
| 31 | #ifdef __cplusplus |
| 32 | } |
| 33 | #endif |
| 34 | #endif |