Skip to content

feat(spacemit): add TCM memory barrier support#11

Open
alex-spacemit wants to merge 1 commit into
spacemit-mtmdfrom
feat/update-thread-barrier
Open

feat(spacemit): add TCM memory barrier support#11
alex-spacemit wants to merge 1 commit into
spacemit-mtmdfrom
feat/update-thread-barrier

Conversation

@alex-spacemit

Copy link
Copy Markdown
Collaborator

Overview

Additional information

Requirements

Copilot AI review requested due to automatic review settings June 24, 2026 07:59
@github-actions github-actions Bot added the ggml label Jun 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a compile-time guard for Spacemit RISC-V64 TCM “memory barrier” operations around thread-affinity setup/teardown, presumably to make the wait/release behavior optional.

Changes:

  • Wrap spine_mem_pool_tcm_mem_wait() in ggml_backend_cpu_riscv64_spacemit_set_numa_thread_affinity() with #ifdef GGML_ENABLE_TCM_MEM_BARRIER.
  • Wrap spine_mem_pool_tcm_mem_release() in ggml_backend_cpu_riscv64_spacemit_clear_numa_thread_affinity_threaded() with the same macro.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1722 to 1726
if (ggml::cpu::riscv64_spacemit::tls_context.tcm_buffer != nullptr) {
void * rt =
ggml::cpu::riscv64_spacemit::spine_mem_pool_tcm_mem_wait(ggml::cpu::riscv64_spacemit::tls_context.cpu_id);
if (rt == nullptr) {
GGML_ABORT("wait tcm buffer failed for cpu_id: %d", ggml::cpu::riscv64_spacemit::tls_context.cpu_id);
Comment on lines 1735 to 1740
auto rt = ggml::cpu::riscv64_spacemit::spine_mem_pool_tcm_mem_release(
ggml::cpu::riscv64_spacemit::tls_context.cpu_id);
if (rt != 0) {
GGML_ABORT("release tcm buffer failed for cpu_id: %d", ggml::cpu::riscv64_spacemit::tls_context.cpu_id);
}
}
ggml::cpu::riscv64_spacemit::global_spine_env_info.tcm_blk_size;
}

#ifdef GGML_ENABLE_TCM_MEM_BARRIER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants