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

[FEA] Support for half-float mixed precise in brute-force #2382

Merged
merged 20 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
[Fix] compilation error of gemm & transpose under cuml
  • Loading branch information
rhdong committed Aug 21, 2024
commit 4d55c576ea71dd0c1259f39e8dea76356ab1a5f6
4 changes: 2 additions & 2 deletions cpp/include/raft/linalg/detail/gemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void legacy_gemm(raft::resources const& res,
stream);
}

template <typename A_T, typename B_T, typename C_T, typename S_T>
template <typename A_T, typename B_T, typename C_T>
void legacy_gemm(raft::resources const& res,
const A_T* a,
int n_rows_a,
Expand All @@ -111,7 +111,7 @@ void legacy_gemm(raft::resources const& res,
cudaStream_t stream)
{
return legacy_gemm(
res, a, n_rows_a, n_cols_a, b, c, n_rows_c, n_cols_c, trans_a, trans_b, S_T{1}, S_T{0}, stream);
res, a, n_rows_a, n_cols_a, b, c, n_rows_c, n_cols_c, trans_a, trans_b, C_T{1}, C_T{0}, stream);
}

template <typename x_T, typename y_T, typename z_T, typename s_T, bool DevicePointerMode = false>
Expand Down
7 changes: 5 additions & 2 deletions cpp/include/raft/linalg/detail/transpose.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <thrust/for_each.h>
#include <thrust/iterator/counting_iterator.h>

#include <cmath>

namespace raft {
namespace linalg {
namespace detail {
Expand Down Expand Up @@ -91,8 +93,9 @@ void transpose_half(
int grid_x = (n_cols + block_dim_x - 1) / block_dim_x;
int grid_y = (n_rows + block_dim_x - 1) / block_dim_x;

float ratio = static_cast<float>(grid_y) / static_cast<float>(grid_x);
int adjusted_grid_y = std::max(std::min(grid_y, static_cast<int>(sqrt(num_blocks * ratio))), 1);
float ratio = static_cast<float>(grid_y) / static_cast<float>(grid_x);
int adjusted_grid_y =
std::max(std::min(grid_y, static_cast<int>(std::sqrt(num_blocks * ratio))), 1);
int adjusted_grid_x = std::max(std::min(grid_x, num_blocks / adjusted_grid_y), 1);

dim3 grids(adjusted_grid_x, adjusted_grid_y);
Expand Down
Loading