#pragma once


#include <iostream> 
#include <type_traits> 
#ifdef NATTEN_WITH_CUTLASS
#include <natten/natten.h> 
#include <ATen/ATen.h> 
#include <ATen/cuda/CUDAContext.h> 
#include <c10/cuda/CUDAGuard.h> 
#include <c10/cuda/CUDAStream.h> 
#include <torch/extension.h> 
#include <natten/natten.h> 
#include <natten/helpers.h> 
#include <natten/cuda/reference/fna_reference_forward.hpp> 
#include <natten/cuda/reference/fna_reference_backward.hpp> 
namespace natten { 
namespace cuda { 
namespace reference { 

void reference_fna1d_float32_causal0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_float32_causal1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_float16_causal0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_float16_causal1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_bfloat16_causal0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_bfloat16_causal1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_backward_float32_causal0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_backward_float32_causal1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_backward_float16_causal0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_backward_float16_causal1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_backward_bfloat16_causal0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna1d_backward_bfloat16_causal1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int> qkv_shape,
      cute::tuple<int> window_size,
      cute::tuple<int> stride,
      cute::tuple<int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_float32_causal0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_float32_causal0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_float32_causal1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_float32_causal1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_float16_causal0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_float16_causal0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_float16_causal1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_float16_causal1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_bfloat16_causal0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_bfloat16_causal0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_bfloat16_causal1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_bfloat16_causal1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_float32_causal0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_float32_causal0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_float32_causal1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_float32_causal1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_float16_causal0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_float16_causal0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_float16_causal1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_float16_causal1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_bfloat16_causal0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_bfloat16_causal0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_bfloat16_causal1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna2d_backward_bfloat16_causal1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int> qkv_shape,
      cute::tuple<int, int> window_size,
      cute::tuple<int, int> stride,
      cute::tuple<int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float32_causal0x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float32_causal0x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float32_causal0x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float32_causal0x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float32_causal1x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float32_causal1x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float32_causal1x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float32_causal1x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float16_causal0x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float16_causal0x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float16_causal0x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float16_causal0x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float16_causal1x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float16_causal1x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float16_causal1x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_float16_causal1x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_bfloat16_causal0x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_bfloat16_causal0x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_bfloat16_causal0x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_bfloat16_causal0x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_bfloat16_causal1x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_bfloat16_causal1x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_bfloat16_causal1x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_bfloat16_causal1x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float32_causal0x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float32_causal0x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float32_causal0x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float32_causal0x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float32_causal1x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float32_causal1x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float32_causal1x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float32_causal1x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float16_causal0x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float16_causal0x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float16_causal0x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float16_causal0x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float16_causal1x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float16_causal1x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float16_causal1x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_float16_causal1x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_bfloat16_causal0x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_bfloat16_causal0x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_bfloat16_causal0x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_bfloat16_causal0x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_bfloat16_causal1x0x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_bfloat16_causal1x0x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_bfloat16_causal1x1x0(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);

void reference_fna3d_backward_bfloat16_causal1x1x1(
      void* ptr_Q,
      void* ptr_K,
      void* ptr_V,
      void* ptr_O,
      void* ptr_DO,
      void* ptr_DQ,
      void* ptr_DK,
      void* ptr_DV,
      void* ptr_LSE,
      int batch_size,
      int seqlen,
      int heads,
      int dim,
      int dim_value,
      int num_additional_kv,
      cute::tuple<int, int, int> qkv_shape,
      cute::tuple<int, int, int> window_size,
      cute::tuple<int, int, int> stride,
      cute::tuple<int, int, int> dilation,
      float attn_scale,
      cudaStream_t stream);


} // namespace natten 
} // namespace cuda 
} // namespace reference 
#endif 

