Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cuda] Port over allocator and buffer implementation #13985

Merged
merged 3 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions experimental/cuda2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ iree_cc_library(
"api.h"
SRCS
"api.h"
"cuda_allocator.c"
"cuda_allocator.h"
"cuda_buffer.c"
"cuda_buffer.h"
"cuda_driver.c"
"memory_pools.c"
"memory_pools.h"
DEPS
::dynamic_symbols
iree::base
Expand Down
24 changes: 24 additions & 0 deletions experimental/cuda2/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,30 @@
extern "C" {
#endif // __cplusplus

//===----------------------------------------------------------------------===//
// iree_hal_cuda_device_t
//===----------------------------------------------------------------------===//

// Parameters defining a CUmemoryPool.
typedef struct iree_hal_cuda2_memory_pool_params_t {
// Minimum number of bytes to keep in the pool when trimming with
// iree_hal_device_trim.
uint64_t minimum_capacity;
// Soft maximum number of bytes to keep in the pool.
// When more than this is allocated the extra will be freed at the next
// device synchronization in order to remain under the threshold.
uint64_t release_threshold;
// TODO: per-device access permissions array.
} iree_hal_cuda2_memory_pool_params_t;

// Parameters for each CUmemoryPool used for queue-ordered allocations.
typedef struct iree_hal_cuda2_memory_pooling_params_t {
// Used exclusively for DEVICE_LOCAL allocations.
iree_hal_cuda2_memory_pool_params_t device_local;
// Used for any host-visible/host-local memory types.
iree_hal_cuda2_memory_pool_params_t other;
} iree_hal_cuda2_memory_pooling_params_t;

//===----------------------------------------------------------------------===//
// iree_hal_cuda2_driver_t
//===----------------------------------------------------------------------===//
Expand Down
Loading
Loading