Refactor: extract 3 comment-only-diff headers + platform_compile_info.cpp (-250 lines)#938
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughPlatform abstractions are consolidated into shared headers under ChangesPlatform Abstraction Centralization
🎯 4 (Complex) | ⏱️ ~60 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
c2e7269 to
11798c7
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/common/platform/include/host/function_cache.h (1)
47-48: ⚡ Quick winInclude guard not normalized to the new convention.
The PR normalizes header guards to
SRC_COMMON_PLATFORM_INCLUDE_…(seememory_allocator.handmemory_barrier.hin this same cohort), but this file still uses the older genericPLATFORM_FUNCTION_CACHE_H_. Besides the inconsistency, the generic name is more prone to collision now that the file lives under the shared include tree.♻️ Normalize the guard
-#ifndef PLATFORM_FUNCTION_CACHE_H_ -#define PLATFORM_FUNCTION_CACHE_H_ +#ifndef SRC_COMMON_PLATFORM_INCLUDE_HOST_FUNCTION_CACHE_H_ +#define SRC_COMMON_PLATFORM_INCLUDE_HOST_FUNCTION_CACHE_H_-#endif // PLATFORM_FUNCTION_CACHE_H_ +#endif // SRC_COMMON_PLATFORM_INCLUDE_HOST_FUNCTION_CACHE_H_🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/common/platform/include/host/function_cache.h` around lines 47 - 48, Update the include guard in host/function_cache.h to follow the new normalized convention: replace the current PLATFORM_FUNCTION_CACHE_H_ guard with SRC_COMMON_PLATFORM_INCLUDE_HOST_FUNCTION_CACHE_H_ in both the `#ifndef` and `#define`, and update the trailing `#endif` comment to match (e.g., // SRC_COMMON_PLATFORM_INCLUDE_HOST_FUNCTION_CACHE_H_).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/common/platform/include/host/function_cache.h`:
- Around line 47-48: Update the include guard in host/function_cache.h to follow
the new normalized convention: replace the current PLATFORM_FUNCTION_CACHE_H_
guard with SRC_COMMON_PLATFORM_INCLUDE_HOST_FUNCTION_CACHE_H_ in both the
`#ifndef` and `#define`, and update the trailing `#endif` comment to match (e.g., //
SRC_COMMON_PLATFORM_INCLUDE_HOST_FUNCTION_CACHE_H_).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 76ea3796-4715-4228-ad28-c3b0b93e9c52
📒 Files selected for processing (64)
simpler_setup/kernel_compiler.pysrc/a2a3/platform/include/aicore/aicore.hsrc/a2a3/platform/include/aicpu/device_time.hsrc/a2a3/platform/include/aicpu/l2_swimlane_collector_aicpu.hsrc/a2a3/platform/include/aicpu/orch_so_file.hsrc/a2a3/platform/include/host/runtime_compile_info.hsrc/a2a3/platform/onboard/aicore/CMakeLists.txtsrc/a2a3/platform/onboard/aicpu/CMakeLists.txtsrc/a2a3/platform/onboard/host/CMakeLists.txtsrc/a2a3/platform/onboard/host/platform_compile_info.cppsrc/a2a3/platform/sim/aicore/CMakeLists.txtsrc/a2a3/platform/sim/aicpu/CMakeLists.txtsrc/a2a3/platform/sim/host/CMakeLists.txtsrc/a5/platform/include/aicore/aicore.hsrc/a5/platform/include/aicpu/device_log.hsrc/a5/platform/include/aicpu/device_malloc.hsrc/a5/platform/include/aicpu/device_time.hsrc/a5/platform/include/aicpu/l2_swimlane_collector_aicpu.hsrc/a5/platform/include/aicpu/platform_aicpu_affinity.hsrc/a5/platform/include/aicpu/scope_stats_collector_aicpu.hsrc/a5/platform/include/aicpu/tensor_dump_aicpu.hsrc/a5/platform/include/common/compile_strategy.hsrc/a5/platform/include/common/core_type.hsrc/a5/platform/include/common/memory_barrier.hsrc/a5/platform/include/common/qualifier.hsrc/a5/platform/include/common/scope_stats.hsrc/a5/platform/include/host/function_cache.hsrc/a5/platform/include/host/memory_allocator.hsrc/a5/platform/include/host/platform_compile_info.hsrc/a5/platform/include/host/raii_scope_guard.hsrc/a5/platform/onboard/aicore/CMakeLists.txtsrc/a5/platform/onboard/aicpu/CMakeLists.txtsrc/a5/platform/onboard/host/CMakeLists.txtsrc/a5/platform/onboard/host/platform_compile_info.cppsrc/a5/platform/sim/aicore/CMakeLists.txtsrc/a5/platform/sim/aicpu/CMakeLists.txtsrc/a5/platform/sim/host/CMakeLists.txtsrc/a5/platform/sim/host/platform_compile_info.cppsrc/a5/platform/src/aicpu/scope_stats_collector_aicpu.cppsrc/a5/platform/src/aicpu/tensor_dump_aicpu.cppsrc/a5/platform/src/aicpu/unified_log_device.cppsrc/common/platform/include/aicore/aicore.hsrc/common/platform/include/aicpu/device_log.hsrc/common/platform/include/aicpu/device_malloc.hsrc/common/platform/include/aicpu/device_time.hsrc/common/platform/include/aicpu/orch_so_file.hsrc/common/platform/include/aicpu/platform_aicpu_affinity.hsrc/common/platform/include/aicpu/scope_stats_collector_aicpu.hsrc/common/platform/include/aicpu/tensor_dump_aicpu.hsrc/common/platform/include/common/compile_strategy.hsrc/common/platform/include/common/core_type.hsrc/common/platform/include/common/memory_barrier.hsrc/common/platform/include/common/qualifier.hsrc/common/platform/include/common/scope_stats.hsrc/common/platform/include/host/function_cache.hsrc/common/platform/include/host/memory_allocator.hsrc/common/platform/include/host/platform_compile_info.hsrc/common/platform/include/host/raii_scope_guard.hsrc/common/platform/include/host/runtime_compile_info.hsrc/common/platform/src/aicpu/scope_stats_collector_aicpu.cppsrc/common/platform/src/aicpu/tensor_dump_aicpu.cppsrc/common/platform/src/aicpu/unified_log_device.cppsrc/common/platform/src/host/platform_compile_info.cpptests/ut/cpp/CMakeLists.txt
💤 Files with no reviewable changes (26)
- src/a5/platform/include/host/platform_compile_info.h
- src/a5/platform/include/host/raii_scope_guard.h
- src/a2a3/platform/include/aicpu/device_time.h
- src/a2a3/platform/include/aicpu/orch_so_file.h
- src/a5/platform/include/common/qualifier.h
- src/a5/platform/include/aicpu/device_time.h
- src/a5/platform/include/common/core_type.h
- src/a5/platform/sim/host/platform_compile_info.cpp
- src/a2a3/platform/onboard/host/platform_compile_info.cpp
- src/a5/platform/include/host/memory_allocator.h
- src/a5/platform/include/host/function_cache.h
- src/a5/platform/include/common/memory_barrier.h
- src/a5/platform/include/aicpu/scope_stats_collector_aicpu.h
- src/a5/platform/src/aicpu/unified_log_device.cpp
- src/a5/platform/include/common/compile_strategy.h
- src/a5/platform/onboard/host/platform_compile_info.cpp
- src/a2a3/platform/include/aicore/aicore.h
- src/a5/platform/include/aicpu/device_malloc.h
- src/a5/platform/include/aicpu/platform_aicpu_affinity.h
- src/a5/platform/include/aicpu/tensor_dump_aicpu.h
- src/a2a3/platform/include/host/runtime_compile_info.h
- src/a5/platform/include/aicpu/device_log.h
- src/a5/platform/src/aicpu/scope_stats_collector_aicpu.cpp
- src/a5/platform/include/common/scope_stats.h
- src/a5/platform/src/aicpu/tensor_dump_aicpu.cpp
- src/a5/platform/include/aicore/aicore.h
….cpp (-250 lines) Move 3 more headers whose per-arch differences were ONLY arch-name strings in doc comments (same pattern as hw-native-sys#937): - include/aicore/aicore.h (33 lines) - include/aicpu/device_malloc.h (53 lines) - include/host/memory_allocator.h (109 lines) Per-arch save from header moves: ~195 lines. Also collapses the 4 per-arch `platform_compile_info.cpp` files (byte-identical modulo the platform-name string literal) into a single shared impl at `src/common/platform/src/host/platform_compile_info.cpp`. The string is supplied via `target_compile_definitions(host_runtime PRIVATE SIMPLER_PLATFORM_NAME=\"…\")` on each per-arch host CMakeLists, matching what `get_platform()` returned before. - 4 files deleted (a2a3/{onboard,sim}/host/, a5/{onboard,sim}/host/) - 1 file added (src/common/platform/src/host/platform_compile_info.cpp) - 4 host CMakeLists: source path moved to the common location + `SIMPLER_PLATFORM_NAME` define added with the appropriate string ("a2a3" / "a2a3sim" / "a5" / "a5sim") Header comment cleanups (same shape as hw-native-sys#937): - `aicore.h`: "a2a3: Real Ascend hardware" → "onboard: …" and doc reference generalized to `src/{a2a3,a5}/platform/...` - `device_malloc.h`: "On a2a3:" / "On a2a3sim:" → "On onboard:" / "On sim:" - `memory_allocator.h`: "a2a3: Wraps CANN runtime" → "onboard: …" - Header guards normalized to SRC_COMMON_PLATFORM_INCLUDE_… Builds: - a2a3sim + a5sim + a2a3 + a5 host_runtime.so clean - `get_platform()` returns the right string per variant (verified via compile_commands.json + ST smoke run) - Smoke ST passes on both arches Stacked on hw-native-sys#937 (which is stacked on hw-native-sys#934). Co-authored-by: Chao Wang <26245345+ChaoWao@users.noreply.github.com>
11798c7 to
21036e9
Compare
Summary
Stacked on #937 (which is stacked on #934). Combines two related cleanups:
Part A — 3 more comment-only-diff headers (same pattern as #937)
include/aicore/aicore.hinclude/aicpu/device_malloc.hinclude/host/memory_allocator.hComment cleanups carried with the moves:
aicore.h: "a2a3: Real Ascend hardware" → "onboard: …" and the doc reference tosrc/a2a3/platform/...generalized tosrc/{a2a3,a5}/platform/...device_malloc.h: "On a2a3:" / "On a2a3sim:" → "On onboard:" / "On sim:"memory_allocator.h: "a2a3: Wraps CANN runtime" → "onboard: Wraps CANN runtime" (4 occurrences)SRC_COMMON_PLATFORM_INCLUDE_…Part B —
platform_compile_info.cppparameterization (4→1 file)The 4 per-arch
platform_compile_info.cppfiles were byte-identical except for the platform-name string returned byget_platform(). Collapsed to a single shared impl that reads the name from a build-system define:Each host CMakeLists supplies the correct string:
SIMPLER_PLATFORM_NAMEa2a3/onboard/host"a2a3"a2a3/sim/host"a2a3sim"a5/onboard/host"a5"a5/sim/host"a5sim"src/common/platform/src/host/platform_compile_info.cpp)SIMPLER_PLATFORM_NAMEdefine addedAfter this PR, the remaining DIFF files in
src/{a2a3,a5}/platform/include/andsrc/{a2a3,a5}/platform/src/have substantive semantic differences (padding sizes, function signatures, dlsym tables, MMIO vs sparse-reg layout, dep_gen-on-a2a3-only, profiling_copy-on-a5-only) and cannot be deduped without behavioral changes — so this is the last of the easy-mechanical wins in this area.Test plan
SIMPLER_PLATFORM_NAME="…"matches the expected string for each variant