About Extension-FFI for PyTorch

I am trying to write a extension for pytorch. I find some repos to study. Now I have some problems:

  1. How about the relation between module and function? I find some examples call function in module,why not only use module to implement?
  2. I find some cuda implement use kernle, and others not. When should I write the cuda kernel files ?