---
GENERATOR: 
  PackageName: cuda_bindings
  PackageDescription: "Package runtime provides Go bindings"
  PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS."
  SysIncludes: ["cuda.h", "cuda_runtime.h"]
  FlagGroups:
    - {name: LDFLAGS, flags: [-L/usr/local/cuda/lib64 -lcudart]}
    - {name: CFLAGS, flags: [-I /usr/local/cuda/include]}
PARSER: 
  IncludePaths: ["/usr/local/cuda/include"]
  SourcesPaths: ["cuda_runtime.h", "cuda_runtime_api.h", "driver_types.h"]
  # SourcesPaths: ["cuda.h", "cuda_runtime.h"]
TRANSLATOR: 
  ConstCharIsString: true
  ConstUCharIsString: false
  ConstRules: 
    defines: eval
    enum: eval
  Rules:
    global:
      # - {action: accept, from: ".*"}
      - {action: accept, from: "cudaError"}
      - {action: accept, from: "cudaSuccess"}
      # - {action: accept, from: "CUstream_st"}
      # - {transform: export}
    const:
      - {action: accept, from: "^cudaMemcpy"}
      - {action: accept, from: "cudaEventWaitDefault"}
      - {action: accept, from: "cudaEventWaitExternal"}
      - {action: accept, from: "cudaStreamDefault"}
      - {action: accept, from: "cudaStreamNonBlocking"}
      - {transform: export}
    type:
      - {action: accept, from: "cudaStream_t"}
      - {action: replace, from: "cudaStream_t", to: "cudaStream"}
      - {action: accept, from: "CUstream_st"}
      - {action: replace, from: "CUstream_st", to: "cudaStream"}
      - {action: accept, from: "cudaEvent_t"}
      - {action: replace, from: "cudaEvent_t", to: "cudaEvent"}
      - {action: accept, from: "CUevent_st"}
      - {action: replace, from: "CUevent_st", to: "cudaEvent"}
      - {action: accept, from: "cudaMemPool_t"}
      - {action: replace, from: "cudaMemPool_t", to: "cudaMemPool"}
      - {transform: export}
      # - {action: replace, from: C.struct_CUstream_st, to: CudaStream}
    function:
      # memory management
      - {action: accept, from: "^cudaFree$"}
      - {action: accept, from: "^cudaMalloc$"}
      # - {action: accept, from: "^cudaMemcpy$"}
      # - {action: accept, from: "^cudaMemcpyAsync$"}
      - {action: accept, from: "^cudaMemset$"}
      - {action: accept, from: "^cudaMemsetAsync$"}
      # device management
      - {action: accept, from: "^cudaSetDevice$"}
      # error handling
      - {action: accept, from: "^cudaGetLastError$"}
      # stream management
      - {action: accept, from: "^cudaStreamCreate$"}
      - {action: accept, from: "^cudaStreamCreateWithFlags$"}
      - {action: accept, from: "^cudaStreamDestroy$"}
      - {action: accept, from: "^cudaStreamQuery$"}
      - {action: accept, from: "^cudaStreamSynchronize$"}
      - {action: accept, from: "^cudaStreamWaitEvent$"}
      # Stream Ordered Memory Allocator
      - {action: accept, from: "^cudaFreeAsync$"}
      - {action: accept, from: "^cudaMallocAsync$"}

      - {transform: export}
    post-global: 
      - {load: snakecase}
  PtrTips:
    function:
      - {target: ^cudaStreamCreate$, tips: [ref]}
      - {target: ^cudaStreamCreateWithFlags$, tips: [ref, 0]}
      - {target: "^cudaMalloc$", tips: [ref, 0]}
    any:
      - {target: cudaStream_t, tips: [ref]}
  TypeTips:
    function:
      - {target: ^cudaStreamCreate$, tips: [named]}
  MemTips:
    - {target: cudaStream_t, self: raw}
      
