OpenMathLib / OpenMathLib/OpenBLAS

Memory allocation

Open
#4,665 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
7.6k
Forks
1.7k
Avg merge
1d 3h
Merged PRs (30d)
42

Description

PR #4577

We have introduced adjust_thread_buffers() function, similar to OpenMP, for initializing global thread buffers instead of the existing local buffers initialized in blas_thread_server.

In blas_thread_init, memory is allocated for blas_cpu_number threads using the adjust_thread_buffers interface. However, when calling interfaces like gemm, memory allocation is still performed in the main thread:

buffer = (XFLOAT *)blas_memory_alloc(0);

This would lead to an additional buffer being allocated, deviating from the logic of the code before the modification.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by reading blas_thread_init, adjust_thread_buffers, blas_thread_server, and the gemm path around blas_memory_alloc(0). Compare the allocation behavior with the pre-change logic described in PR #4577. Done means the extra main-thread buffer is no longer allocated while the thread-buffer behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.