Skip to content

cuda : fix conflict with std::swap #6186

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

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Changes from all 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
12 changes: 3 additions & 9 deletions ggml-cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,6 @@ struct ggml_cuda_pool {

virtual void * alloc(size_t size, size_t * actual_size) = 0;
virtual void free(void * ptr, size_t size) = 0;

ggml_cuda_pool() = default;
ggml_cuda_pool(const ggml_cuda_pool &) = delete;
ggml_cuda_pool(ggml_cuda_pool &&) = delete;
ggml_cuda_pool& operator=(const ggml_cuda_pool &) = delete;
ggml_cuda_pool& operator=(ggml_cuda_pool &&) = delete;
};

struct ggml_cuda_pool_leg : public ggml_cuda_pool {
Expand Down Expand Up @@ -6969,7 +6963,7 @@ static __global__ void k_sum_rows_f32(const float * x, float * dst, const int nc
}

template<typename T>
static inline __device__ void swap(T & a, T & b) {
static inline __device__ void ggml_cuda_swap(T & a, T & b) {
T tmp = a;
a = b;
b = tmp;
Expand Down Expand Up @@ -6998,11 +6992,11 @@ static __global__ void k_argsort_f32_i32(const float * x, int * dst, const int n
if (ixj > col) {
if ((col & k) == 0) {
if (order == GGML_SORT_ORDER_ASC ? x_row[dst_row[col]] > x_row[dst_row[ixj]] : x_row[dst_row[col]] < x_row[dst_row[ixj]]) {
swap(dst_row[col], dst_row[ixj]);
ggml_cuda_swap(dst_row[col], dst_row[ixj]);
}
} else {
if (order == GGML_SORT_ORDER_ASC ? x_row[dst_row[col]] < x_row[dst_row[ixj]] : x_row[dst_row[col]] > x_row[dst_row[ixj]]) {
swap(dst_row[col], dst_row[ixj]);
ggml_cuda_swap(dst_row[col], dst_row[ixj]);
}
}
}
Expand Down