Refactor: unify register access into generic read_reg/write_reg interface#93
Open
Refactor: unify register access into generic read_reg/write_reg interface#93
Conversation
…face Replace purpose-specific register functions (read_task_id_by_reg, set_aicore_busy/idle, enable/disable_aicore_register, write_task_id_to_aicore, read_aicore_status) with a generic read_reg/write_reg API parameterized by RegId enum. Platform layer: - Add RegId enum (DATA_MAIN_BASE, COND, FAST_PATH_ENABLE) and reg_offset() mapping in platform_config.h - Add SIM_REG_BLOCK_SIZE constant for simulation register memory sizing - Rewrite a2a3 aicpu_regs.cpp to use read_reg/write_reg with MMIO pointers - Add a2a3sim aicpu_regs.cpp with identical interface over host memory - Rewrite a2a3 inner_kernel.h: replace inline asm helpers with read_reg/write_reg dispatching on RegId via switch - Add a2a3sim inner_kernel.h register simulation: thread-local g_sim_reg_base, read_reg/write_reg over simulated memory, pipe_barrier macro - Update aicpu_regs.h header to declare unified read_reg/write_reg interface Simulation runner: - Allocate per-core simulated register blocks in DeviceRunner::run() - Pass physical_core_id through aicore_execute_wrapper to set up thread-local g_sim_reg_base before kernel execution - Update function pointer signatures to include physical_core_id Runtime layer: - Add physical_core_id field to Handshake struct (aicpu_build_graph, tensormap_and_ringbuffer) - Update aicore_executor.cpp to use write_reg/read_reg instead of set_aicore_idle/busy/read_task_id_by_reg - Update aicpu_executor.cpp: replace all register helper calls with read_reg/write_reg, add pre-set COND=BUSY before task dispatch to prevent false completion detection from stale IDLE state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace purpose-specific register functions (read_task_id_by_reg, set_aicore_busy/idle, enable/disable_aicore_register, write_task_id_to_aicore, read_aicore_status) with a generic read_reg/write_reg API parameterized by RegId enum.
Platform layer:
Simulation runner:
Runtime layer: