Kernels
kernel
cuda
Deep-ML's picture
Publish kernel from Deep-ML
bf15574 verified
Raw
History Blame Contribute Delete
592 Bytes
#include <torch/library.h>
#include "registration.h"
#include "torch_binding.h"
// Registers `flash_attention_in_cuda_from_scratch` as a custom op so it is callable from Python as
// torch.ops.flash_attention_in_cuda_from_scratch.flash_attention_in_cuda_from_scratch(...). Adjust the schema to your kernel.
TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) {
ops.def("flash_attention_in_cuda_from_scratch(Tensor! out, Tensor input) -> ()");
ops.impl("flash_attention_in_cuda_from_scratch", torch::kCUDA, &flash_attention_in_cuda_from_scratch);
}
REGISTER_EXTENSION(TORCH_EXTENSION_NAME)