FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[BUG] use_greedy in csrmm_nt is failing, cause performance issues (Proposed solution) · Issue #3012 · arrayfire/arrayfire · GitHub

Repository navigation

[BUG] use_greedy in csrmm_nt is failing, cause performance issues (Proposed solution) #3012

Description

Bug is described in opencl/kernel/csrmm.hpp (Line 35).
Fell by accident on this code, while searching for others issues with threading.

Description

Logical error found in the code.
code snippet from opencl/kernel/csrmm.hpp (Line 73 .. 80):

    std::vector<int> count(groups_x);
    cl::Buffer *counter = bufferAlloc(count.size() * sizeof(int));
    getQueue().enqueueWriteBuffer(
        *counter, CL_TRUE, 0, count.size() * sizeof(int), (void *)count.data());

    csrmm_nt_func(cl::EnqueueArgs(getQueue(), global, local), *out.data,
                  *values.data, *rowIdx.data, *colIdx.data, M, N, *rhs.data,
                  rhs.info, alpha, beta, *counter);

The counters are used in the cl script (when USE_GREEDY is defined), to determine the s_rowId by incrementing it for each group_id(0). In the end, each group_id(0) workitem will have written to his rowId in incremental order (THREADS_PER_GROUP times).
The std::vector count(groups_x); is not initialized, resulting in random values (dependent from previous memory allocations) as basis for the s_rowId.

I assume that each element in the vector has to be initialized by 0, so that each row starts from 0 in the opencl script.

Proposed solution

std::vector count(groups_x,0);

System Information

ArrayFire 3.8.0 (master)

Checklist

  • Using the latest available ArrayFire release
  • GPU drivers are up to date

Activity

  1. 9prady9 commented on Sep 14, 2020

    Member

    @willyborn That is a good catch, thanks for reporting it. However, do note that we never use greedy approach in current code base although the code-path is present. Therefore, it shouldn't cause any issues in user code. In fact, it seems like this code-path isn't completely written upon quick look but I would have to check it once more to be certain of that.

    Having said that, it is a bug and we shall address it. Thanks once again.

  2. self-assigned this
    on Sep 14, 2020
  3. 9prady9 commented on Sep 14, 2020

    Member

    Please also note that we are looking another perf issue related to sparse-dense function in this #3010

  4. added this to the 3.8.1 milestone on Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL