Skip to content

Commit

Permalink
Add missing mapping for std::array<Stat>`
Browse files Browse the repository at this point in the history
  • Loading branch information
HGuillemet committed Dec 2, 2023
1 parent 2350ff4 commit 0e0f664
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pytorch/src/gen/java/org/bytedeco/pytorch/cuda/DeviceStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ public class DeviceStats extends Pointer {
}

// COUNT: allocations requested by client code
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") BoolPointer allocation(); public native DeviceStats allocation(BoolPointer setter);
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") Stat allocation(); public native DeviceStats allocation(Stat setter);
// COUNT: number of allocated segments from cudaMalloc().
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") BoolPointer segment(); public native DeviceStats segment(BoolPointer setter);
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") Stat segment(); public native DeviceStats segment(Stat setter);
// COUNT: number of active memory blocks (allocated or used by stream)
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") BoolPointer active(); public native DeviceStats active(BoolPointer setter);
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") Stat active(); public native DeviceStats active(Stat setter);
// COUNT: number of inactive, split memory blocks (unallocated but can't be
// released via cudaFree)
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") BoolPointer inactive_split(); public native DeviceStats inactive_split(BoolPointer setter);
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") Stat inactive_split(); public native DeviceStats inactive_split(Stat setter);

// SUM: bytes allocated by this memory alocator
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") BoolPointer allocated_bytes(); public native DeviceStats allocated_bytes(BoolPointer setter);
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") Stat allocated_bytes(); public native DeviceStats allocated_bytes(Stat setter);
// SUM: bytes reserved by this memory allocator (both free and used)
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") BoolPointer reserved_bytes(); public native DeviceStats reserved_bytes(BoolPointer setter);
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") Stat reserved_bytes(); public native DeviceStats reserved_bytes(Stat setter);
// SUM: bytes within active memory blocks
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") BoolPointer active_bytes(); public native DeviceStats active_bytes(BoolPointer setter);
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") Stat active_bytes(); public native DeviceStats active_bytes(Stat setter);
// SUM: bytes within inactive, split memory blocks
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") BoolPointer inactive_split_bytes(); public native DeviceStats inactive_split_bytes(BoolPointer setter);
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") Stat inactive_split_bytes(); public native DeviceStats inactive_split_bytes(Stat setter);
// SUM: bytes requested by client code
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") BoolPointer requested_bytes(); public native DeviceStats requested_bytes(BoolPointer setter);
public native @ByRef @Cast("c10::cuda::CUDACachingAllocator::StatArray*") Stat requested_bytes(); public native DeviceStats requested_bytes(Stat setter);

// COUNT: total number of failed calls to CUDA malloc necessitating cache
// flushes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ public void map(InfoMap infoMap) {
.put(new Info("std::vector<c10::cuda::CUDAKernelLaunchInfo>").pointerTypes("CUDAKernelLaunchInfoVector").define())
.put(new Info("const std::vector<c10::cuda::CUDACachingAllocator::TraceEntry>", "std::vector<c10::cuda::CUDACachingAllocator::TraceEntry>").pointerTypes("TraceEntryVector").define())

//// std::array
.put(new Info("std::array<c10::cuda::CUDACachingAllocator::Stat,3>", "c10::cuda::CUDACachingAllocator::StatArray").cast().pointerTypes("Stat"))

//// Function pointers
// Function pointer returning shared_ptr don't compile on windows
// "D:\a\javacpp-presets\javacpp-presets\pytorch\target\native\org\bytedeco\pytorch\windows-x86_64\jnitorch.cpp(98904): error C2526: 'JavaCPP_org_bytedeco_pytorch_functions_GatheredContextSupplier_allocate_callback': C linkage function cannot return C++ class 'std::shared_ptr<c10::GatheredContext>'"
Expand Down

0 comments on commit 0e0f664

Please sign in to comment.