Skip to content

Commit

Permalink
OOB access in GLM SoftMax (#3642)
Browse files Browse the repository at this point in the history
closes #3590

Authors:
  - Divye Gala (@divyegala)

Approvers:
  - William Hicks (@wphicks)
  - John Zedlewski (@JohnZed)

URL: #3642
  • Loading branch information
divyegala authored Mar 23, 2021
1 parent c2f246a commit af0863d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cpp/src/glm/qn/glm_softmax.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, NVIDIA CORPORATION.
* Copyright (c) 2018-2021, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -59,7 +59,11 @@ __global__ void logSoftmaxKernel(T *out, T *dZ, const T *in, const T *labels,
bool delta = false;
// TODO is there a better way to read this?
if (getDerivative && threadIdx.x == 0) {
shm.sh_val[threadIdx.y] = labels[y];
if (y < N) {
shm.sh_val[threadIdx.y] = labels[y];
} else {
shm.sh_val[threadIdx.y] = std::numeric_limits<T>::lowest();
}
}
__syncthreads();
T label = shm.sh_val[threadIdx.y];
Expand Down

0 comments on commit af0863d

Please sign in to comment.