Download src/gemm/memory/allocator.h from Snapkitty/bsh-harness: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/Snapkitty/bsh-harness/resolve/main/src/gemm/memory/allocator.h
- Command line
-
hf download hf://Snapkitty/bsh-harness/src/gemm/memory/allocator.h
-
curl -L -o allocator.h https://huggingface.co/Snapkitty/bsh-harness/resolve/main/src/gemm/memory/allocator.h
1.08 kB
| typedef struct { | |
| void* ptr; | |
| size_t size; | |
| size_t alignment; | |
| bool is_aligned; | |
| } aligned_buffer_t; | |
| aligned_buffer_t* buffer_allocate(size_t size, size_t alignment); | |
| void buffer_free(aligned_buffer_t* buf); | |
| void* buffer_ptr(aligned_buffer_t* buf); | |
| bool buffer_is_aligned(aligned_buffer_t* buf, size_t required_alignment); | |
| typedef struct { | |
| float* data; | |
| size_t rows; | |
| size_t cols; | |
| size_t stride; | |
| size_t alignment; | |
| bool owns_data; | |
| } matrix_t; | |
| matrix_t* matrix_allocate(size_t rows, size_t cols, size_t alignment); | |
| void matrix_free(matrix_t* mat); | |
| float* matrix_ptr(matrix_t* mat); | |
| float matrix_get(const matrix_t* mat, size_t i, size_t j); | |
| void matrix_set(matrix_t* mat, size_t i, size_t j, float val); | |
| void matrix_zero(matrix_t* mat); | |
| void matrix_fill(matrix_t* mat, float val); | |
| void matrix_copy(const matrix_t* src, matrix_t* dst); | |