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

Fix aliasing violation in t-SNE #4363

Merged
merged 1 commit into from
Nov 15, 2021
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
11 changes: 4 additions & 7 deletions cpp/src/tsne/utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ __global__ void min_max_kernel(
*/
template <typename value_idx, typename value_t>
__global__ void compute_kl_div_k(const value_t* restrict Ps,
const value_t* restrict Qs,
value_t* restrict KL_divs,
const value_t* Qs,
value_t* KL_divs,
const value_idx NNZ)
{
const auto index = (blockIdx.x * blockDim.x) + threadIdx.x;
Expand All @@ -199,11 +199,8 @@ __global__ void compute_kl_div_k(const value_t* restrict Ps,
* Compute KL divergence
*/
template <typename value_t>
value_t compute_kl_div(value_t* restrict Ps,
value_t* restrict Qs,
value_t* restrict KL_divs,
const size_t NNZ,
cudaStream_t stream)
value_t compute_kl_div(
value_t* restrict Ps, value_t* Qs, value_t* KL_divs, const size_t NNZ, cudaStream_t stream)
{
value_t P_sum = thrust::reduce(rmm::exec_policy(stream), Ps, Ps + NNZ);
raft::linalg::scalarMultiply(Ps, Ps, 1.0f / P_sum, NNZ, stream);
Expand Down