Skip to content

Conversation

@harp-intel
Copy link
Contributor

Refactor to add support for Ampere CPU identification and event/metric loading.

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel requested a review from Copilot December 8, 2025 12:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors CPU microarchitecture detection to make it more flexible and extensible, with specific support for Ampere ARM processors. The changes consolidate CPU identification logic into a unified system that handles both x86 and ARM architectures through a common interface.

Key changes:

  • Unified CPU identification system supporting both x86 (family/model/stepping) and ARM (implementer/part/dmidecode) detection
  • New getter/setter methods in Target interface for caching CPU-related values
  • Centralized microarchitecture detection logic with architecture-specific handlers
  • Added support for Ampere Altra, AmpereOne AC03, AC04, and AC04_1 processors

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
internal/target/target.go Changes Target interface from error-returning methods to simple getters/setters for CPU properties; adds new fields for ARM identification
internal/target/remote_target.go Implements new getter/setter methods for RemoteTarget
internal/target/local_target.go Implements new getter/setter methods for LocalTarget
internal/target/helpers.go Removes old CPU property retrieval functions (moved to common package)
internal/cpus/cpus.go New unified CPU identification system with support for both x86 and ARM architectures
internal/cpus/cpu_defs.go Removed (functionality consolidated into cpus.go)
internal/cpus/cpu_defs_test.go Removed (tests need updating for new API)
internal/table/table.go Removes IsTableForTarget function (moved to common package)
internal/script/script.go Removes script filtering logic (moved to common package)
internal/common/targets.go Adds centralized functions for getting CPU properties and filtering scripts/tables by target compatibility
internal/common/table_helpers.go Updates to use new CPU identification API
internal/common/common.go Updates to use new isTableForTarget implementation
cmd/report/cpu.go Updates to use new CPU identification API
cmd/metrics/*.go Updates to use new common.RunScript* wrappers and CPU identification functions
cmd/config/*.go Updates to use new common.RunScript* wrappers and CPU identification functions
Comments suppressed due to low confidence (2)

internal/cpus/cpus.go:1

  • The DmidecodePart values 'X' and 'M' are ambiguous single-letter identifiers. Add a comment explaining what these letters represent (e.g., specific SKU variants, product codes) to help future maintainers understand the distinction between AC04 and AC04_1.
// Package cpus provides CPU definitions and lookup utilities for microarchitecture,

cmd/metrics/loader_legacy.go:1

  • Add a comment explaining that this function handles special naming cases like 'Turin (Zen 5)' by extracting only the first word. This clarifies why the space-based split is necessary.
package metrics

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel requested a review from Copilot December 8, 2025 14:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

internal/cpus/cpus.go:1

  • The DmidecodePart values 'X' and 'M' lack explanation. Add a comment explaining what these single-letter codes represent for AmpereOne AC04 variants to help maintainers understand the distinction.
// Package cpus provides CPU definitions and lookup utilities for microarchitecture,

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel requested a review from Copilot December 8, 2025 17:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (2)

internal/cpus/cpus.go:1

  • [nitpick] The dmidecode part identifiers "X" and "M" are ambiguous single-letter codes. Consider using more descriptive identifiers or adding comments explaining what these letters represent to improve maintainability.
// Package cpus provides CPU definitions and lookup utilities for microarchitecture,

internal/cpus/cpu_defs_test.go:1

  • The entire test file has been deleted, leaving no test coverage for the new unified CPU identification system in cpus.go. Tests should be added to verify the GetCPU function works correctly for both x86 and ARM identifiers, including the new Ampere CPU definitions.

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel requested a review from Copilot December 8, 2025 19:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 30 out of 30 changed files in this pull request and generated 6 comments.

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel merged commit fefb565 into main Dec 9, 2025
5 checks passed
@harp-intel harp-intel deleted the idarm branch December 9, 2025 00:27
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.

2 participants