Skip to content

Add riscv64 and Imagination Technologies GPUs support #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2025

Conversation

vkutuev
Copy link
Contributor

@vkutuev vkutuev commented May 16, 2025

Closes #231

  • Add RISC-V support to CMakeLists.txt
  • Add Imagination Technologies vendor to cl_accelerator

Problem

In src/opencl/cl_format_*.hpp, copying data to staging buffer created with CL_MEM_READ_ONLY flag does not affect this buffer.

Workaround

Remove this flag if device vendor is Imagination Technologies.

Testing

Solution was tested on

  • IMG BXE-2-32, SoC Spacemit K1 on Banana Pi BPI-F3 board
  • IMG BXE-4-32, SoC StarFive JH7110 on StarFive VisionFive 2 board

All tests were passed

@vkutuev vkutuev requested review from gsvgit and EgorOrachyov May 16, 2025 14:35
@vkutuev vkutuev self-assigned this May 16, 2025
@vkutuev vkutuev force-pushed the vkutuev/riscv-img-povervr branch from 85f336b to 6621830 Compare May 16, 2025 14:40
m_vendor_name.find("img") != std::string::npos ||
m_vendor_id == 0x1010) {
m_vendor_code = VENDOR_CODE_IMG;
m_default_wgs = 32;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you decided to set default wgs = 32, and not 64? It seems that 64 suits in most cases well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RECOMMENDATION: If possible use a workgroup size of 32.

This is a recommendation from the official Imagination Technologies blog

@@ -138,7 +143,12 @@ namespace spla {
auto* cl_coo = s.template get<CLCooVec<T>>();
auto* cpu_coo = s.template get<CpuCooVec<T>>();
cpu_coo_vec_resize(cl_coo->values, *cpu_coo);
cl_coo_vec_read(cl_coo->values, cpu_coo->Ai.data(), cpu_coo->Ax.data(), *cl_coo, cl_acc->get_queue_default());
if (!cl_acc->is_img()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, comments with explanation and references to related documents are necessary here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -146,7 +146,12 @@ namespace spla {
auto* cl_csr = s.template get<CLCsr<T>>();
auto* cpu_csr = s.template get<CpuCsr<T>>();
cpu_csr_resize(s.get_n_rows(), cl_csr->values, *cpu_csr);
cl_csr_read(s.get_n_rows(), cl_csr->values, cpu_csr->Ap.data(), cpu_csr->Aj.data(), cpu_csr->Ax.data(), *cl_csr, cl_acc->get_queue_default());
if (!cl_acc->is_img()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, comments with explanation and references to related documents are necessary here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -126,7 +126,12 @@ namespace spla {
auto* cl_acc = get_acc_cl();
auto* cl_dense = s.template get<CLDenseVec<T>>();
auto* cpu_dense = s.template get<CpuDenseVec<T>>();
cl_dense_vec_read(s.get_n_rows(), cpu_dense->Ax.data(), *cl_dense, cl_acc->get_queue_default());
if (!cl_acc->is_img()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, comments with explanation and references to related documents are necessary here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@vkutuev vkutuev merged commit 32d3e1c into main May 19, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenCL: add IMG BXE support
3 participants