OpenCL mxm: move output_count and sample_ids to private memory in MergeMaxChunks

Open Beginner friendly
#316 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
data, performance

Research direction

Read src/opencl/kernels/mxm_merge_max_chunks.cl, focusing on MxMMergeMaxChunksSample and the spla_mxm_merge_max_chunks_kernel propagation loop. Move output_count and sample_ids into the per-thread scope described in the issue, then run the affected OpenCL mxm test on a larger graph. Done when the kernel completes without the hang and produces the expected nonzero result.

Written by the indexing model from the issue text.

Description

task

Problem:
spla_mxm_merge_max_chunks_kernel (src/opencl/kernels/mxm_merge_max_chunks.cl) hangs in the do { ... } while (true) propagation loop (lines 642–662) on larger graphs (triggering i915 GPU reset after ~12s and nnz(R)=0). In MxMMergeMaxChunksSample (lines 266–267), output_count and sample_ids are declared in __local memory sized for a single thread (LM_SIZE(MMC_LENGTH_SAMPLES_PER_THREAD)), so all threads overwrite the same scratch.sample.output_count[0] / sample_ids[0] instead of keeping per-thread values (unlike GALATIC, where both are thread-private).

Fix:
Move output_count and sample_ids out of __local MxMMergeMaxChunksSample into __private per-thread arrays (uint output_count[MMC_LENGTH_SAMPLES_PER_THREAD]; uint sample_ids[MMC_LENGTH_SAMPLES_PER_THREAD];) inside if (!common.completed) in src/opencl/kernels/mxm_merge_max_chunks.cl.

Dominant language
C++
Stars
37
Forks
21
Avg merge
11h 3m
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SparseLinearAlgebra/spla

All issues in SparseLinearAlgebra/spla

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.