← 返回首页
1918 sparse matrix not updated in for loop in opencl by christophe-murphy · Pull Request #3602 · arrayfire/arrayfire · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .cl  (1) .hpp  (1) All 2 file types selected Viewed files
Conversations
Failed to load comments. Retry
Loading
Jump to
Jump to file
Failed to load files. Retry
Loading
Diff view
Unified
Split
Hide whitespace
Apply and reload
Show whitespace
Diff view
Unified
Split
Hide whitespace
Apply and reload
Prev
Next Next commit
Fix for issue in the opencl backend where array offsets for the value…
…s and/or row/cols arrays are not accounted for when converting a sparse array to a dense one. This can happen when a sparse matrix is constructed using values and/or row/cols arrays that have been indexed using the seq method.
  • Loading branch information
christophe-murphy committed Sep 11, 2024
commit 3c5a4f478312cdf32f991a8edce50626ede5af3c
11 changes: 7 additions & 4 deletions src/backend/opencl/kernel/csr2dense.cl
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@

kernel void csr2Dense(global T *output, global const T *values,
global const int *rowidx, global const int *colidx,
const int M) {
const int M, const int v_off, const int r_off, const int c_off) {
T *v = values + v_off;
int *r = rowidx + r_off;
int *c = colidx + c_off;
int lid = get_local_id(0);
for (int rowId = get_group_id(0); rowId < M; rowId += get_num_groups(0)) {
int colStart = rowidx[rowId];
int colEnd = rowidx[rowId + 1];
int colStart = r[rowId];
int colEnd = r[rowId + 1];
for (int colId = colStart + lid; colId < colEnd; colId += THREADS) {
output[rowId + colidx[colId] * M] = values[colId];
output[rowId + c[colId] * M] = v[colId];
}
}
}
5 changes: 4 additions & 1 deletion src/backend/opencl/kernel/sparse.hpp
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ void csr2dense(Param output, const Param values, const Param rowIdx,
cl::NDRange global(local[0] * groups_x, 1);

csr2dense(cl::EnqueueArgs(getQueue(), global, local), *output.data,
*values.data, *rowIdx.data, *colIdx.data, M);
*values.data, *rowIdx.data, *colIdx.data, M,
static_cast<int>(values.info.offset),
static_cast<int>(rowIdx.info.offset),
static_cast<int>(colIdx.info.offset));
CL_DEBUG_FINISH(getQueue());
}

Expand Down
Toggle all file notes Toggle all file annotations

Footer

© 2026 GitHub, Inc.