Run pre-commit's whitespace related hooks on projects/amdsmi (#2119)

* Run pre-commit's whitespace related hooks on projects/amdsmi

In order for pre-commit to be useful, everything needs to meet a common
baseline.

* Add whitespace back to Changelog for formatting

---------

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
このコミットが含まれているのは:
Mario Limonciello
2025-12-15 13:20:47 -06:00
committed by GitHub
コミット 08949cb884
36個のファイルの変更340行の追加291行の削除
+1 -1
ファイルの表示
@@ -1,6 +1,6 @@
# Contributing to AMD SMI #
We welcome contributions to AMD SMI.
We welcome contributions to AMD SMI.
Please follow these details to help ensure your contributions will be successfully accepted.
## Issue Discussion ##
+4 -4
ファイルの表示
@@ -1,4 +1,4 @@
name: ABI Compliance Check
name: ABI Compliance Check
on:
pull_request:
@@ -218,7 +218,7 @@ jobs:
echo "skip_check_minor=true" >> $GITHUB_OUTPUT
exit 0
fi
echo "Fetching amdsmi.h from ref: $OLD_VERSION_REF_MINOR (as amdsmi_old.h) for Minor check"
git show $OLD_VERSION_REF_MINOR:include/amd_smi/amdsmi.h > amdsmi_old.h 2>/dev/null
if [ $? -ne 0 ] || [ ! -s amdsmi_old.h ]; then
@@ -242,7 +242,7 @@ jobs:
COMPARE_MSG="$V1_NAME_SUFFIX_CLEAN vs $V2_NAME_CLEAN"
echo "Comparing $COMPARE_MSG for Minor ABI Check (Strict)"
abi-compliance-checker -lib amdsmi -old amdsmi_old.h -new amdsmi_new.h -v1 "$V1_NAME_SUFFIX_CLEAN" -v2 "$V2_NAME_CLEAN" -report-path minor-abi-report.html -strict || {
ACC_EXIT_CODE=$?
echo "abi-compliance-checker -strict failed with exit code $ACC_EXIT_CODE."
@@ -260,7 +260,7 @@ jobs:
if grep -q "Problems with.*Data Types.*[1-9]" minor-abi-report.html; then CHANGED=1; echo "::warning::STRICT ABI: Found problems with data types"; fi
if grep -q "Problems with.*Symbols.*[1-9]" minor-abi-report.html; then CHANGED=1; echo "::warning::STRICT ABI: Found problems with symbols"; fi
if grep -q "Problems with.*Constants.*[1-9]" minor-abi-report.html; then CHANGED=1; echo "::warning::STRICT ABI: Found problems with constants"; fi
if [ "$CHANGED" -eq 1 ]; then
echo "::error::STRICT ABI CHECK FAILED: Found changes in ABI report comparing $COMPARE_MSG"
echo "abi_exit_code=1" > $GITHUB_WORKSPACE/minor_abi_status.txt
+23 -23
ファイルの表示
@@ -21,7 +21,7 @@ jobs:
script: |
const pr = context.payload.pull_request;
let prNumber, headSha, baseBranch, headBranch;
// Handle different event types
if (context.eventName === 'pull_request') {
prNumber = pr.number;
@@ -32,26 +32,26 @@ jobs:
// Find the associated PR for workflow_run events
const workflowRun = context.payload.workflow_run;
console.log(`Workflow run completed: ${workflowRun.name} with conclusion: ${workflowRun.conclusion}`);
if (workflowRun.event !== 'pull_request') {
console.log('Workflow run was not triggered by a pull request, skipping');
return;
}
const prs = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
head: `${context.repo.owner}:${workflowRun.head_branch}`
});
const associatedPr = prs.data.find(p => p.head.sha === workflowRun.head_sha);
if (!associatedPr) {
console.log('No associated PR found for this workflow run');
return;
}
prNumber = associatedPr.number;
headSha = associatedPr.head.sha;
baseBranch = associatedPr.base.ref;
@@ -127,40 +127,40 @@ jobs:
if (context.eventName === 'workflow_run') {
// Handle workflow_run events (existing logic)
const workflowRun = context.payload.workflow_run;
if (workflowRun.name === 'ABI Compliance Check') {
shouldCheckABI = true;
console.log(`ABI Compliance Check completed with conclusion: ${workflowRun.conclusion}`);
try {
const { data: jobs } = await github.rest.actions.listJobsForWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: workflowRun.id
});
// Check job conclusions for ABI breakage
for (const job of jobs.jobs) {
console.log(`Job: ${job.name}, Conclusion: ${job.conclusion}`);
if (job.name.includes('Major ABI') && job.conclusion === 'failure') {
hasMajorAbiBreakage = true;
console.log('Major ABI breakage detected from job failure');
}
if (job.name.includes('Minor ABI') && job.conclusion === 'failure') {
hasMinorAbiBreakage = true;
console.log('Minor ABI breakage detected from job failure');
}
}
// If workflow succeeded, no ABI breakage
if (workflowRun.conclusion === 'success') {
console.log('ABI Compliance Check succeeded - no ABI breakage');
hasMajorAbiBreakage = false;
hasMinorAbiBreakage = false;
}
} catch (error) {
console.log(`Could not fetch job details: ${error.message}`);
return;
@@ -169,11 +169,11 @@ jobs:
} else if (context.eventName === 'pull_request') {
// NEW: Check if amdsmi.h has been reverted on PR events
const hasAbiLabels = existingLabels.includes('MAJOR ABI BREAKAGE') || existingLabels.includes('MINOR ABI BREAKAGE');
if (hasAbiLabels) {
console.log('PR has ABI labels, checking if amdsmi.h changes were reverted...');
shouldCheckABI = true;
try {
// Get the diff for amdsmi.h between base and head
const { data: comparison } = await github.rest.repos.compareCommits({
@@ -182,10 +182,10 @@ jobs:
base: currentPr.base.sha,
head: currentPr.head.sha
});
// Check if amdsmi.h has any changes
const amdsmiFile = comparison.files?.find(file => file.filename === 'include/amd_smi/amdsmi.h');
if (!amdsmiFile) {
console.log('No changes to amdsmi.h found in this PR - removing ABI labels');
hasMajorAbiBreakage = false;
@@ -200,7 +200,7 @@ jobs:
hasMajorAbiBreakage = existingLabels.includes('MAJOR ABI BREAKAGE');
hasMinorAbiBreakage = existingLabels.includes('MINOR ABI BREAKAGE');
}
} catch (error) {
console.log(`Error checking file changes: ${error.message}`);
// If we can't check, preserve existing labels
@@ -222,7 +222,7 @@ jobs:
for (const [labelName, shouldHaveLabel] of Object.entries(abiLabels)) {
const hasLabel = existingLabels.includes(labelName);
if (shouldHaveLabel && !hasLabel) {
// Add label
try {
@@ -265,7 +265,7 @@ jobs:
body: '⚠️ **MAJOR ABI BREAKAGE detected** in the latest ABI compliance check. Please review the ABI compliance report and fix any breaking changes.'
});
}
if (hasMinorAbiBreakage && !wasMinorAbiBreakage) {
await github.rest.issues.createComment({
owner: context.repo.owner,
@@ -274,7 +274,7 @@ jobs:
body: '⚠️ **MINOR ABI BREAKAGE detected** in the latest ABI compliance check. Please review the ABI compliance report for details.'
});
}
if (!hasMajorAbiBreakage && wasMajorAbiBreakage) {
await github.rest.issues.createComment({
owner: context.repo.owner,
@@ -283,7 +283,7 @@ jobs:
body: '✅ **MAJOR ABI BREAKAGE resolved** - ABI compliance check is now passing!'
});
}
if (!hasMinorAbiBreakage && wasMinorAbiBreakage) {
await github.rest.issues.createComment({
owner: context.repo.owner,
@@ -302,7 +302,7 @@ jobs:
body: '✅ **MAJOR ABI BREAKAGE resolved** - `amdsmi.h` changes have been reverted.'
});
}
if (!hasMinorAbiBreakage && wasMinorAbiBreakage) {
await github.rest.issues.createComment({
owner: context.repo.owner,
+32 -32
ファイルの表示
@@ -41,33 +41,33 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.6'
- name: Install CMake
run: python3 -m pip install cmake
- name: Install Virtualenv
run: python3 -m pip install virtualenv
- name: Install g++
run: sudo apt-get install -y g++
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.6'
- name: Install CMake
run: python3 -m pip install cmake
- name: Install Virtualenv
run: python3 -m pip install virtualenv
- name: Install g++
run: sudo apt-get install -y g++
- name: Install libdrm
run: sudo apt-get install -y libdrm-dev
- name: Install DOxygen
run: sudo apt-get install -y doxygen
- name: Install LaTeX
run: sudo apt-get install -y texlive
- name: Clean old ROCm directories
run: |
sudo rm -rf /opt/rocm
sudo rm -rf /opt/rocm-*
- name: Install DOxygen
run: sudo apt-get install -y doxygen
- name: Install LaTeX
run: sudo apt-get install -y texlive
- name: Clean old ROCm directories
run: |
sudo rm -rf /opt/rocm
sudo rm -rf /opt/rocm-*
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
@@ -77,14 +77,14 @@ jobs:
build-mode: ${{ matrix.build-mode }}
queries: security-extended
- name: Create build directory
run: mkdir -p build
- name: Build AMD SMI Library
run: |
cd build
cmake ..
make -j $(nproc)
- name: Create build directory
run: mkdir -p build
- name: Build AMD SMI Library
run: |
cd build
cmake ..
make -j $(nproc)
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
+2 -2
ファイルの表示
@@ -75,9 +75,9 @@ jobs:
# 📚 Documentation Generated Successfully!
## 🚀 Quick Start
1. **📥 Download** the artifact `documentation-${{ steps.get_branch_info.outputs.sanitized_name }}`
2. **📂 Extract** the ZIP file
2. **📂 Extract** the ZIP file
3. **🖱️ Double-click** `index.html`
4. **✅ Done!** Documentation opens with full formatting in your browser
EOF
+1 -1
ファイルの表示
@@ -21,7 +21,7 @@ on:
env:
GERRIT_SERVER: "gerrit-git.amd.com"
GERRIT_PROJECT: "SYS-MGMT/ec/amd-smi"
GERRIT_PROJECT: "SYS-MGMT/ec/amd-smi"
GERRIT_USER: "z1_runner"
GERRIT_PORT: "29418"
+24 -24
ファイルの表示
@@ -1,25 +1,25 @@
name: ROCm CI Caller
on:
pull_request:
branches: [amd-staging, release/rocm-rel-*, amd-mainline]
types: [opened, reopened, synchronize]
push:
branches: [amd-mainline]
workflow_dispatch:
issue_comment:
types: [created]
jobs:
call-workflow:
if: github.event_name != 'issue_comment' ||(github.event_name == 'issue_comment' && github.event.issue.pull_request && (startsWith(github.event.comment.body, '!verify') || startsWith(github.event.comment.body, '!verify release') || startsWith(github.event.comment.body, '!verify retest')))
name: ROCm CI Caller
on:
pull_request:
branches: [amd-staging, release/rocm-rel-*, amd-mainline]
types: [opened, reopened, synchronize]
push:
branches: [amd-mainline]
workflow_dispatch:
issue_comment:
types: [created]
jobs:
call-workflow:
if: github.event_name != 'issue_comment' ||(github.event_name == 'issue_comment' && github.event.issue.pull_request && (startsWith(github.event.comment.body, '!verify') || startsWith(github.event.comment.body, '!verify release') || startsWith(github.event.comment.body, '!verify retest')))
uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline
secrets: inherit
with:
input_sha: ${{github.event_name == 'pull_request' && github.event.pull_request.head.sha || (github.event_name == 'push' && github.sha) || (github.event_name == 'issue_comment' && github.event.issue.pull_request.head.sha) || github.sha}}
input_pr_num: ${{github.event_name == 'pull_request' && github.event.pull_request.number || (github.event_name == 'issue_comment' && github.event.issue.number) || 0}}
input_pr_url: ${{github.event_name == 'pull_request' && github.event.pull_request.html_url || (github.event_name == 'issue_comment' && github.event.issue.pull_request.html_url) || ''}}
input_pr_title: ${{github.event_name == 'pull_request' && github.event.pull_request.title || (github.event_name == 'issue_comment' && github.event.issue.pull_request.title) || ''}}
repository_name: ${{ github.repository }}
base_ref: ${{github.event_name == 'pull_request' && github.event.pull_request.base.ref || (github.event_name == 'issue_comment' && github.event.issue.pull_request.base.ref) || github.ref}}
trigger_event_type: ${{ github.event_name }}
comment_text: ${{ github.event_name == 'issue_comment' && github.event.comment.body || '' }}
secrets: inherit
with:
input_sha: ${{github.event_name == 'pull_request' && github.event.pull_request.head.sha || (github.event_name == 'push' && github.sha) || (github.event_name == 'issue_comment' && github.event.issue.pull_request.head.sha) || github.sha}}
input_pr_num: ${{github.event_name == 'pull_request' && github.event.pull_request.number || (github.event_name == 'issue_comment' && github.event.issue.number) || 0}}
input_pr_url: ${{github.event_name == 'pull_request' && github.event.pull_request.html_url || (github.event_name == 'issue_comment' && github.event.issue.pull_request.html_url) || ''}}
input_pr_title: ${{github.event_name == 'pull_request' && github.event.pull_request.title || (github.event_name == 'issue_comment' && github.event.issue.pull_request.title) || ''}}
repository_name: ${{ github.repository }}
base_ref: ${{github.event_name == 'pull_request' && github.event.pull_request.base.ref || (github.event_name == 'issue_comment' && github.event.issue.pull_request.base.ref) || github.ref}}
trigger_event_type: ${{ github.event_name }}
comment_text: ${{ github.event_name == 'issue_comment' && github.event.comment.body || '' }}
+3 -3
ファイルの表示
@@ -256,10 +256,10 @@ if(ENABLE_ESMI_LIB)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/third_party/shared_mutex
${CMAKE_CURRENT_SOURCE_DIR}/include/amd_smi
${CMAKE_CURRENT_SOURCE_DIR}/third_party/shared_mutex
${CMAKE_CURRENT_SOURCE_DIR}/include/amd_smi
${ESMI_INC_DIR}
)
+1 -1
ファイルの表示
@@ -151,7 +151,7 @@ do_install_amdsmi_python_lib() {
"AMD-SMI python library will not be installed."
return
fi
# install python library at @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi
local python_lib_path=@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@
local amdsmi_python_lib_path="$python_lib_path"
+2 -2
ファイルの表示
@@ -9,7 +9,7 @@ documentation at [rocm.docs.amd.com/projects/amdsmi](https://rocm.docs.amd.com/p
>[!NOTE]
>This project is a successor to [rocm_smi_lib](https://github.com/ROCm/rocm_smi_lib)
>and [esmi_ib_library](https://github.com/amd/esmi_ib_library).
>and [esmi_ib_library](https://github.com/amd/esmi_ib_library).
>This project is applicable to Linux Baremetal and Linux VM(Guest). To use AMD SMI for Virtualization, please refer to [AMD-SMI Virtualization](https://github.com/amd/MxGPU-Virtualization/tree/mainline/smi-lib).
## Supported platforms
@@ -44,7 +44,7 @@ The following are required to install and use the AMD SMI library through its la
### Note: No module named more_itertools warning on Azure Linux 3
During the driver installation process on Azure Linux 3, you might encounter the `ModuleNotFoundError: No module named 'more_itertools'` warning. This warning is a result of the reintroduction of `python3-wheel` and `python3-setuptools` dependencies in the CMake of AMD SMI, which requires `more_itertools` to build these Python libraries. This issue will be fixed in a future ROCm release. As a workaround, use the following command before installation:
```
sudo python3 -m pip install more_itertools
sudo python3 -m pip install more_itertools
```
### Go API prerequisites
+1 -1
ファイルの表示
@@ -203,7 +203,7 @@ if __name__ == "__main__":
# Preserve case for short options
processed_argv.append(arg)
sys.argv = processed_argv
if len(sys.argv) == 1:
args = amd_smi_parser.parse_args(args=['default'])
elif sys.tracebacklimit == 10 and (sys.argv[1] == '--loglevel'):
+2 -2
ファイルの表示
@@ -250,7 +250,7 @@ class AMDSMICommands():
bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(args.gpu)
except amdsmi_exception.AmdSmiLibraryException as e:
bdf = "N/A"
try:
uuid = amdsmi_interface.amdsmi_get_gpu_device_uuid(args.gpu)
except amdsmi_exception.AmdSmiLibraryException:
@@ -3476,7 +3476,7 @@ class AMDSMICommands():
process_info['mem_usage'] = self.helpers.unit_format(self.logger,
process_info['mem_usage'],
memory_usage_unit)
process_info['evicted_time'] = self.helpers.unit_format(self.logger,
process_info['evicted_time'],
evicted_time_unit)
+1 -1
ファイルの表示
@@ -611,7 +611,7 @@ class AMDSMIParser(argparse.ArgumentParser):
if '%' in values:
try:
amdsmi_helpers.confirm_out_of_spec_warning()
# Convert percentage to fan speed level
# Convert percentage to fan speed level
values = (int(values[:-1]) / 100) * 255
values = AMDSMIParser._custom_ceil(values) # Round up (Ceiling)
setattr(args, self.dest, values)
+6 -6
ファイルの表示
@@ -343,16 +343,16 @@ CPU Arguments:
--cpu-c0-res Displays C0 residency
--cpu-lclk-dpm-level NBIOID Displays lclk dpm level range. Requires socket ID and NBOID as inputs
--cpu-pwr-svi-telemetry-rails Displays svi based telemetry for all rails
--cpu-io-bandwidth IO_BW LINKID_NAME Displays current IO bandwidth for the selected CPU.
input parameters are bandwidth type(1) and link ID encodings
--cpu-io-bandwidth IO_BW LINKID_NAME Displays current IO bandwidth for the selected CPU.
input parameters are bandwidth type(1) and link ID encodings
i.e. P2, P3, G0 - G7
--cpu-xgmi-bandwidth XGMI_BW LINKID_NAME Displays current XGMI bandwidth for the selected CPU
input parameters are bandwidth type(1,2,4) and link ID encodings
--cpu-xgmi-bandwidth XGMI_BW LINKID_NAME Displays current XGMI bandwidth for the selected CPU
input parameters are bandwidth type(1,2,4) and link ID encodings
i.e. P2, P3, G0 - G7
--cpu-metrics-ver Displays metrics table version
--cpu-metrics-table Displays metric table
--cpu-socket-energy Displays socket energy for the selected CPU socket
--cpu-ddr-bandwidth Displays per socket max ddr bw, current utilized bw,
--cpu-ddr-bandwidth Displays per socket max ddr bw, current utilized bw,
and current utilized ddr bw in percentage
--cpu-temp Displays cpu socket temperature
--cpu-dimm-temp-range-rate DIMM_ADDR Displays dimm temperature range and refresh rate
@@ -586,7 +586,7 @@ Set Arguments:
CPU Arguments:
--cpu-pwr-limit PWR_LIMIT Set power limit for the given socket. Input parameter is power limit value.
--cpu-xgmi-link-width MIN_WIDTH MAX_WIDTH Set max and Min linkwidth. Input parameters are min and max link width values
--cpu-lclk-dpm-level NBIOID MIN_DPM MAX_DPM Sets the max and min dpm level on a given NBIO.
--cpu-lclk-dpm-level NBIOID MIN_DPM MAX_DPM Sets the max and min dpm level on a given NBIO.
Input parameters are die_index, min dpm, max dpm.
--cpu-pwr-eff-mode MODE Sets the power efficency mode policy. Input parameter is mode.
--cpu-gmi3-link-width MIN_LW MAX_LW Sets max and min gmi3 link width range
+2 -2
ファイルの表示
@@ -23,13 +23,13 @@ variable to the directory containing ``librocm_smi64.so`` (usually
```{note}
The environment variable ``AMDSMI_GPU_METRICS_CACHE_MS`` may be set to
control the internal GPU metrics cache duration (ms).
control the internal GPU metrics cache duration (ms).
Default 1, set to 0 to disable.
```
```{note}
The environment variable ``AMDSMI_ASIC_INFO_CACHE_MS`` may be set to
control the internal GPU asic info cache duration (ms).
control the internal GPU asic info cache duration (ms).
Default 10000 ms, set to 0 to disable.
```
+1 -1
ファイルの表示
@@ -78,7 +78,7 @@ To include the AMD SMI Go API in your project, update your Makefile or Go module
to fetch the appropriate version of the AMD SMI library.
```shell
go get github.com/ROCm/amdsmi@amd-staging
go get github.com/ROCm/amdsmi@amd-staging
```
When using a Makefile, ensure you're fetching the latest AMD SMI repository
+2 -2
ファイルの表示
@@ -41,11 +41,11 @@ variable to the directory containing ``librocm_smi64.so`` (usually
```{note}
The environment variable ``AMDSMI_GPU_METRICS_CACHE_MS`` may be set to
control the internal GPU metrics cache duration (ms).
control the internal GPU metrics cache duration (ms).
Default 1, set to 0 to disable.
The environment variable ``AMDSMI_ASIC_INFO_CACHE_MS`` may be set to
control the internal GPU asic info cache duration (ms).
control the internal GPU asic info cache duration (ms).
Default 10000 ms, set to 0 to disable.
You can apply them in one of two ways:
+52 -3
ファイルの表示
@@ -579,6 +579,43 @@ except AmdSmiException as e:
print(e)
```
### amdsmi_get_supported_power_cap
Description: Returns dictionary of Package Power Tracking (PPT) types as currently
configured on the given GPU. It is not supported on virtual machine guest
Input parameters:
* `processor_handle` device which to query
Output: Dictionary with fields
Field | Description | Units
---|---
`sensor_inds` | List of integer indices of the supported ppt types. 0 indicates PPT0 and 1 indicates PPT1. Should be used as input for `amdsmi_get_power_cap_info` and `amdsmi_set_power_cap_info`.
`sensor_types` | Enum `AmdSmiPowerCapType` that corresponds to the ppt types that are supported on the device.
Exceptions that can be thrown by `amdsmi_get_supported_power_cap` function:
* `AmdSmiLibraryException`
* `AmdSmiParameterException`
Example:
```python
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
power_cap_types = amdsmi_get_supported_power_cap(device)
print(power_cap_types['sensor_inds'])
print(power_cap_types['sensor_types'])
except AmdSmiException as e:
print(e)
```
### amdsmi_get_gpu_vram_info
Description: Returns dictionary of vram information for the given GPU.
@@ -1485,10 +1522,10 @@ Description: Dump CPER entries for a given GPU in a file using from CPER header
Input parameters:
* `processor_handle` device which to query
* `severity_mask` the severity mask of the entries to be retrieved:
* `severity_mask` the severity mask of the entries to be retrieved:
1:'nonfatal-uncorrected',
2: 'fatal',
4: 'nonfatal-corrected', 'corrected',
2: 'fatal',
4: 'nonfatal-corrected', 'corrected',
7: 'all'
* `buffer_size` number of bytes that will be used to create a buffer for copying cper entries into; default is 1048576 bytes
* `cursor` the zero based index at which to start retrieving cper entries; default value is 0; for example, if there are 10 cper entries available, then with a cursor value of 8, it will retrieve the last two cper entries only
@@ -1516,6 +1553,18 @@ Field | Description
`flags` | Reserved flags related to the CPER entry. |
`persistence_info` | Reserved information related to persistence. |
Output2: Updated cursor (int type)
* Cursor is the index of the next cper entry in the GPU ring buffer. For example, if 10 entries were fetched successfully, the value of cursor will be 11 upon return from the API. Subsequent call to the API with cursor value of 11 should fetch the next entry
Output3: A list of dictionaries, each dictionary containing the CPER record and its size:
* {"bytes": <raw bytes>, "size": <number of bytes>}
Output4: status_code
AMDSMI_STATUS_SUCCESS: If all entries were retrieved successfully
AMDSMI_STATUS_MORE_DATA: If some of the entries were retrieved and:
* A subsequent call to the API with the updated cursor will result in the fetching the next batch of entries, or
* Increasing the input buffer_size will allow more entries to be fetched with the same cursor
Exceptions that can be thrown by `amdsmi_get_gpu_cper_entries` function:
* `AmdSmiLibraryException`
+2 -2
ファイルの表示
@@ -386,7 +386,7 @@ bool goamdsmi_gpu_init()
if((num_gpu_devices_inAllSocket)) gpu_init_success = true;
}
if (enable_debug_level(GOAMDSMI_DEBUG_LEVEL_1)) {printf("AMDSMI, %s, InitAMDSMIGPUInit:%d, GpuSocketCount:%d, GpuCount:%d\n", gpu_init_success?"Success":"Failed", gpu_init_success?1:0, num_gpuSockets, num_gpu_devices_inAllSocket);}
return gpu_init_success;
}
@@ -407,7 +407,7 @@ char* goamdsmi_gpu_dev_name_get(uint32_t dv_ind)
uint32_t len = 256;
char* dev_name = (char*)malloc(sizeof(char)*len);dev_name[0] = '\0';
strcpy(dev_name, GOAMDSMI_STRING_NA);
return dev_name;
}
+5 -5
ファイルの表示
@@ -1,5 +1,5 @@
/**
* \file xf86drm.h
* \file xf86drm.h
* OS-independent header for DRM user-level library interface.
*
* \author Rickard E. (Rik) Faith <faith@valinux.com>
@@ -200,9 +200,9 @@ typedef enum {
typedef enum {
/** \name Flags for DMA buffer dispatch */
/*@{*/
DRM_DMA_BLOCK = 0x01, /**<
DRM_DMA_BLOCK = 0x01, /**<
* Block until buffer dispatched.
*
*
* \note the buffer may not yet have been
* processed by the hardware -- getting a
* hardware lock with the hardware quiescent
@@ -696,7 +696,7 @@ extern int drmGetLock(int fd,
drmLockFlags flags);
extern int drmUnlock(int fd, drm_context_t context);
extern int drmFinish(int fd, int context, drmLockFlags flags);
extern int drmGetContextPrivateMapping(int fd, drm_context_t ctx_id,
extern int drmGetContextPrivateMapping(int fd, drm_context_t ctx_id,
drm_handle_t * handle);
/* AGP/GART support: X server (root) only */
@@ -782,7 +782,7 @@ typedef struct _drmEventContext {
int version;
void (*vblank_handler)(int fd,
unsigned int sequence,
unsigned int sequence,
unsigned int tv_sec,
unsigned int tv_usec,
void *user_data);
+1 -1
ファイルの表示
@@ -51,7 +51,7 @@ target_link_libraries(${ROCM_SMI_TARGET} PRIVATE
${CMAKE_DL_LIBS}
${FILESYSTEM_LIB}
)
target_include_directories(${ROCM_SMI_TARGET} PRIVATE
target_include_directories(${ROCM_SMI_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/common/shared_mutex
${DRM_INCLUDE_DIRS}
+57 -57
ファイルの表示
@@ -53,28 +53,28 @@ namespace amd::smi
/*
* NOTES:
*
* For the new dynamic metrics implementation, we need to define a `schema`.
* For the new dynamic metrics implementation, we need to define a `schema`.
* The `schema` defines the `types` of the `attributes` (or `properties`, much like a syntax) it
* defines the type of data that can be stored in an attribute. It acts as a blueprint.
*
*
* If we think of the metrics system as a database, the schema is like the table structure.
* It defines the fields (attributes) that can be stored, their types, and any constraints on them.
* This allows for a flexible and extensible system where new metrics can be added without
* needing to change the underlying codebase significantly.
*
*/
*
*/
namespace details
{
/*
* NOTE:
* NOTE:
* Namespace for internal details of 'dynamic gpu metrics'.
* This namespace contains implementation details that are not intended for public use.
* It is used to encapsulate the internal workings of the dynamic GPU metrics system.
* This allows for better organization of code and separation of concerns.
* The public API will interact with this namespace, but the details will be hidden from the user.
* This is a common practice in C++ to keep the public interface clean and maintainable.
*
*
* Guidelines for using namespace details:
* -----------------------------------------
* * Use namespace details in headers for:
@@ -83,14 +83,14 @@ namespace details
* - Internal functions needed for templates/inline functions.
* - Internal constants or enums that are not part of the public API.
* - Internal classes or structs that are not meant for public use.
*
*
* * Use namespace details in implementation files for:
* - Helper functions/constants not meant for public use.
* - Internal state management (e.g., PImpl details).
* * Avoid exposing namespace details in documentation or public API.
*
*
* This improves encapsulation and prevents users from relying on internal details that may change.
*
*
*/
/*
@@ -111,7 +111,7 @@ enum class AMDGpuMetricAttributeType_t
/*
* Attribute IDs for the GPU metrics
*/
enum class AMDGpuMetricAttributeId_t
enum class AMDGpuMetricAttributeId_t
{
TEMPERATURE_HOTSPOT,
TEMPERATURE_MEM,
@@ -227,13 +227,13 @@ static const auto AMDGpuMetricAttributeIdToString = AMDGpuMetricAttributeIdTrans
/*
* Unit types used by attribute instances
* Unit types used by attribute instances
*/
enum class AMDGpuMetricUnitType_t
{
NONE,
/*
/*
* Temperature units
*/
CELSIUS,
@@ -249,26 +249,26 @@ enum class AMDGpuMetricUnitType_t
GIGABYTE_PER_SECOND,
GIGABYTE_PER_SECOND_ACCUMULATOR,
/*
/*
* Power/Energy units
*/
WATT,
JOULE,
/*
/*
* Electrical units
*/
VOLTAGE,
/*
/*
* Time/Frequency units
*/
*/
TIMESTAMP_NANOSECONDS,
CLOCK_MEGAHERTZ,
/*
/*
* Unitless or generic units
*/
*/
PERCENT,
COUNT_ACCUMULATOR,
QUANTITY,
@@ -284,7 +284,7 @@ static const auto AMDGpuMetricUnitTypeToString = AMDGpuMetricUnitTypeTranslation
{AMDGpuMetricUnitType_t::BIT_PER_SECOND, {"BIT_PER_SECOND", "Throughput (bit/s)"}},
{AMDGpuMetricUnitType_t::BYTE_PER_SECOND, {"BYTE_PER_SECOND", "Throughput (B/s)"}},
{AMDGpuMetricUnitType_t::KILOBYTE_PER_SECOND, {"KILOBYTE_PER_SECOND", "Throughput (KB/s)"}},
{AMDGpuMetricUnitType_t::KILOBYTE_PER_SECOND_ACCUMULATOR, {"KILOBYTE_PER_SECOND_ACCUMULATOR", "Accumulated KB/s counter"}},
{AMDGpuMetricUnitType_t::KILOBYTE_PER_SECOND_ACCUMULATOR, {"KILOBYTE_PER_SECOND_ACCUMULATOR", "Accumulated KB/s counter"}},
{AMDGpuMetricUnitType_t::GIGABYTE_PER_SECOND, {"GIGABYTE_PER_SECOND", "Throughput (GB/s)"}},
{AMDGpuMetricUnitType_t::GIGABYTE_PER_SECOND_ACCUMULATOR, {"GIGABYTE_PER_SECOND_ACCUMULATOR", "Accumulated GB/s counter"}},
{AMDGpuMetricUnitType_t::WATT, {"WATT", "Power (W)"}},
@@ -294,7 +294,7 @@ static const auto AMDGpuMetricUnitTypeToString = AMDGpuMetricUnitTypeTranslation
{AMDGpuMetricUnitType_t::CLOCK_MEGAHERTZ, {"CLOCK_MEGAHERTZ", "Frequency (MHz)"}},
{AMDGpuMetricUnitType_t::PERCENT, {"PERCENT", "Percentage (%)"}},
{AMDGpuMetricUnitType_t::COUNT_ACCUMULATOR, {"COUNT_ACCUMULATOR", "Monotonic count"}},
{AMDGpuMetricUnitType_t::QUANTITY, {"QUANTITY", "Unitless Quantity"}},
{AMDGpuMetricUnitType_t::QUANTITY, {"QUANTITY", "Unitless Quantity"}},
{AMDGpuMetricUnitType_t::STATUS_FLAG, {"STATUS_FLAG", "Status bit/flag (bitmask)"}},
};
@@ -315,7 +315,7 @@ struct AMDGpuDynamicMetricsHeader_v1_t
private:
};
using AMDGpuDynamicMetricsVersion_t = std::set<std::pair<std::uint8_t, std::uint8_t>>;
@@ -334,14 +334,14 @@ struct AMDGpuMetricAttributeInstance_t
AMDGpuMetricAttributeId_t m_attribute_id;
AMDGpuMetricAttributeType_t m_attribute_type;
AMDGpuMetricUnitType_t m_unit_type;
AMDGpuMetricAttributeInstance_t() = default;
AMDGpuMetricAttributeInstance_t(const std::string& name,
const std::string& description,
AMDGpuMetricAttributeId_t attribute_id,
AMDGpuMetricAttributeType_t attribute_type,
AMDGpuMetricUnitType_t unit_type)
AMDGpuMetricUnitType_t unit_type)
: m_name(name),
m_description(description),
m_attribute_id(attribute_id),
@@ -355,7 +355,7 @@ struct AMDGpuMetricAttributeInstance_t
* This allows for tracking the availability of the metric across different versions.
* For now, we initialize it to an empty set, meaning the metric is available in all versions.
*/
m_availability_version = {{0, 0}};
m_availability_version = {{0, 0}};
}
AMDGpuMetricAttributeInstance_t(const std::string& name,
@@ -383,13 +383,13 @@ struct AMDGpuMetricAttributeInstance_t
/*
* The unique ID is calculated based on the attribute ID and type.
* This allows for a unique identifier for each metric instance.
*
*
* Example:
* If attribute_id is TEMPERATURE_MEM (1) and attribute_type is TYPE_INT32 (5),
* then m_unique_id will be 1 * 100 + 5 = 105.
*
*
* We might need to revisit this, but for now, it serves as a unique identifier.
*/
*/
return (static_cast<std::uint64_t>(attribute_id) * 100 + static_cast<std::uint64_t>(attribute_type));
}
@@ -406,12 +406,12 @@ struct AMDGpuMetricAttributeInstance_t
};
/*
/*
* Based on supported value types in `AMDGpuMetricAttributeType_t`
*/
using AMDGpuMetricAttributeValue_t = std::variant<std::uint8_t, std::int8_t,
using AMDGpuMetricAttributeValue_t = std::variant<std::uint8_t, std::int8_t,
std::uint16_t, std::int16_t,
std::uint32_t, std::int32_t,
std::uint32_t, std::int32_t,
std::uint64_t, std::int64_t,
std::vector<std::uint8_t>, std::vector<std::int8_t>,
std::vector<std::uint16_t>, std::vector<std::int16_t>,
@@ -456,15 +456,15 @@ struct AMDGpuMetricAttributeData_t
AMDGpuMetricAttributeValue_t m_value;
AMDGpuMetricAttributeData_t() = default;
AMDGpuMetricAttributeData_t(const AMDGpuMetricAttributeInstance_t& metric_instance,
AMDGpuMetricAttributeData_t(const AMDGpuMetricAttributeInstance_t& metric_instance,
const AMDGpuMetricAttributeValue_t& metric_value)
: m_instance(metric_instance),
m_value(metric_value)
{ }
auto is_multivalued() const -> bool
{
return (std::holds_alternative<std::vector<std::uint8_t>>(m_value) ||
return (std::holds_alternative<std::vector<std::uint8_t>>(m_value) ||
std::holds_alternative<std::vector<std::int8_t>>(m_value) ||
std::holds_alternative<std::vector<std::uint16_t>>(m_value) ||
std::holds_alternative<std::vector<std::int16_t>>(m_value) ||
@@ -505,11 +505,11 @@ struct is_multivalued_attribute : std::false_type { };
template<typename Tp>
struct is_multivalued_attribute<
Tp,
Tp,
std::void_t<decltype(std::declval<Tp>().is_multivalued())>
> : std::true_type { };
constexpr auto get_metric_data_type_size(AMDGpuMetricAttributeType_t attrib_type) -> std::size_t
constexpr auto get_metric_data_type_size(AMDGpuMetricAttributeType_t attrib_type) -> std::size_t
{
switch (attrib_type) {
case (AMDGpuMetricAttributeType_t::TYPE_UINT8):
@@ -536,7 +536,7 @@ constexpr auto get_metric_data_type_size(AMDGpuMetricAttributeType_t attrib_type
case (AMDGpuMetricAttributeType_t::TYPE_INT64):
return sizeof(std::int64_t);
default:
default:
throw std::runtime_error("Error: Metric attribute type unknown... ");
}
}
@@ -589,7 +589,7 @@ constexpr auto ATTR_UNIT_SHIFT = (ATTR_TYPE_SHIFT + ATTR_TYPE_BITS); // 24
/*
* Masks are constant and used for decoding values safely
* - They are derived from bit sizes and shifts
* - They are derived from bit sizes and shifts
* - They help in isolating specific fields when encoding/decoding
*/
constexpr auto ATTR_INST_MASK = static_cast<std::uint64_t>((1ULL << ATTR_INST_BITS) - 1);
@@ -608,9 +608,9 @@ struct AMDGpuMetricAttributeDecode_t
constexpr auto operator==(const AMDGpuMetricAttributeDecode_t& other) const noexcept -> bool
{
return ((m_attr_unit == other.m_attr_unit) &&
(m_attr_type == other.m_attr_type) &&
(m_attr_id == other.m_attr_id) &&
return ((m_attr_unit == other.m_attr_unit) &&
(m_attr_type == other.m_attr_type) &&
(m_attr_id == other.m_attr_id) &&
(m_attr_instance == other.m_attr_instance));
}
@@ -621,19 +621,19 @@ struct AMDGpuMetricAttributeDecode_t
/*
* Function to encode the attribute type, ID, and instance into a single uint32_t value.
* So we can do something like:
* auto attribute1 = amdgpu_metrics_enc_attr(AMDGpuMetricAttributeType_t::TYPE_UINT32,
* auto attribute1 = amdgpu_metrics_enc_attr(AMDGpuMetricAttributeType_t::TYPE_UINT32,
* AMDGpuMetricAttributeId_t::GFX_BUSY_INST,
*
*
*/
[[nodiscard]]
constexpr auto amdgpu_metrics_encode_attr(std::uint64_t attr_unit,
std::uint64_t attr_type,
std::uint64_t attr_id,
constexpr auto amdgpu_metrics_encode_attr(std::uint64_t attr_unit,
std::uint64_t attr_type,
std::uint64_t attr_id,
std::uint64_t attr_instance) noexcept -> std::uint64_t
{
return ((attr_unit << ATTR_UNIT_SHIFT) |
(attr_type << ATTR_TYPE_SHIFT) |
(attr_id << ATTR_ID_SHIFT) |
return ((attr_unit << ATTR_UNIT_SHIFT) |
(attr_type << ATTR_TYPE_SHIFT) |
(attr_id << ATTR_ID_SHIFT) |
(attr_instance));
}
@@ -725,7 +725,7 @@ static const auto AMDGpuMetricsBaseSchema = details::AMDGpuMetricSchemaMapType_t
details::AMDGpuMetricAttributeType_t::TYPE_UINT64,
details::AMDGpuMetricUnitType_t::GIGABYTE_PER_SECOND),
static_cast<details::AMDGpuMetricAttributeValue_t>(0)
}},
}},
{ details::AMDGpuMetricAttributeId_t::ENERGY_ACCUMULATOR,
details::AMDGpuMetricAttributeData_t{
@@ -774,7 +774,7 @@ static const auto AMDGpuMetricsBaseSchema = details::AMDGpuMetricSchemaMapType_t
details::AMDGpuMetricAttributeId_t::PPT_RESIDENCY_ACC,
details::AMDGpuMetricAttributeType_t::TYPE_UINT32,
details::AMDGpuMetricUnitType_t::CELSIUS_ACCUMULATOR),
static_cast<details::AMDGpuMetricAttributeValue_t>(0)
static_cast<details::AMDGpuMetricAttributeValue_t>(0)
}},
{ details::AMDGpuMetricAttributeId_t::SOCKET_THM_RESIDENCY_ACC,
@@ -876,7 +876,7 @@ static const auto AMDGpuMetricsBaseSchema = details::AMDGpuMetricSchemaMapType_t
details::AMDGpuMetricUnitType_t::PERCENT),
static_cast<details::AMDGpuMetricAttributeValue_t>(0)
}},
{ details::AMDGpuMetricAttributeId_t::PCIE_BANDWIDTH_ACC,
details::AMDGpuMetricAttributeData_t{
details::AMDGpuMetricAttributeInstance_t("PCIe Bandwidth Accumulator",
@@ -1170,7 +1170,7 @@ class AMDGpuDynamicMetrics_t
// m_current_conditional_var.notify_all();
//}
}
// Parsing helpers
auto parse_from_buffer(const std::byte* data, std::size_t size) noexcept -> rsmi_status_t;
auto parse_from_file(const std::string& metrics_file_path, std::size_t read_size = 0) -> rsmi_status_t;
@@ -1186,12 +1186,12 @@ class AMDGpuDynamicMetrics_t
* based on the data offsets
*
*/
class AMDGpuDynamicMetricsCursor_t
class AMDGpuDynamicMetricsCursor_t
{
public:
AMDGpuDynamicMetricsCursor_t(const AMDGpuDynamicMetrics_t& metrics_data,
std::uint64_t start_offset = 0)
: m_metrics(metrics_data),
AMDGpuDynamicMetricsCursor_t(const AMDGpuDynamicMetrics_t& metrics_data,
std::uint64_t start_offset = 0)
: m_metrics(metrics_data),
m_current_offset(start_offset),
m_read_lock(metrics_data.m_mutex) {
m_current_metric_attribute = m_metrics.m_dynamic_metrics_data_offsets.lower_bound(0);
+5 -5
ファイルの表示
@@ -3350,7 +3350,7 @@ rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_type,
return RSMI_STATUS_NOT_SUPPORTED;
}
std::string file_path = dev->get_sys_file_path_by_type(amd::smi::kDevGpuBoardTempMetrics);
if (file_path == "") {
LOG_ERROR("Failed to get GPU board temperature metrics file path");
@@ -3365,7 +3365,7 @@ rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_type,
return ret;
}
ret = get_gpuboard_temp_value(gpuboard_metric,
ret = get_gpuboard_temp_value(gpuboard_metric,
static_cast<rsmi_temperature_type_t>(sensor_type), temperature);
return ret;
}
@@ -7499,7 +7499,7 @@ rsmi_event_notification_get(int timeout_ms,
LOG_ERROR(ss);
continue;
}
flockfile(anon_fp); // serialize stdio on this stream
data_item =
@@ -7594,7 +7594,7 @@ rsmi_event_notification_get(int timeout_ms,
sscanf(message, "%" PRId64 " -%d @%" PRIu32 "(%" PRIu32 ") %x->%x %x:%x %d\n", &ns, &pid, &start, &size, &from, &to, &prefetch_loc, &preferred_loc, &migrate_trigger);
std::stringstream final_message;
final_message << "nd: " << std::to_string(ns).c_str()
final_message << "nd: " << std::to_string(ns).c_str()
<< " pid: " << std::to_string(pid).c_str()
<< " start: 0x" << std::hex << start
<< " size: 0x" << std::hex << size
@@ -7620,7 +7620,7 @@ rsmi_event_notification_get(int timeout_ms,
sscanf(message, "%" PRId64 " -%d @%" PRIu32 "(%" PRIu32 ") %x->%x %d %d\n", &ns, &pid, &start, &size, &from, &to, &migrate_trigger, &error_code);
std::stringstream final_message;
final_message << "nd: " << std::to_string(ns).c_str()
final_message << "nd: " << std::to_string(ns).c_str()
<< " pid: " << std::to_string(pid).c_str()
<< " start: 0x" << std::hex << start
<< " size: 0x" << std::hex << size
+13 -13
ファイルの表示
@@ -91,13 +91,13 @@ static const std::map<int, rsmi_temperature_type_t> system_temp_map = {
static std::string createHexDump(const void* data, size_t size, const std::string& description) {
std::ostringstream ss;
const unsigned char* bytes = static_cast<const unsigned char*>(data);
ss << "=== " << description << " (size: " << size << " bytes) ===" << std::endl;
for (size_t i = 0; i < size; i += 16) {
// Print offset
ss << std::hex << std::setfill('0') << std::setw(8) << i << ": ";
// Print hex bytes
for (size_t j = 0; j < 16; ++j) {
if (i + j < size) {
@@ -106,18 +106,18 @@ static std::string createHexDump(const void* data, size_t size, const std::strin
ss << " ";
}
}
ss << " | ";
// Print ASCII representation
for (size_t j = 0; j < 16 && i + j < size; ++j) {
unsigned char c = bytes[i + j];
ss << (std::isprint(c) ? static_cast<char>(c) : '.');
}
ss << std::endl;
}
ss << "=== End " << description << " ===" << std::endl;
return ss.str();
}
@@ -154,7 +154,7 @@ rsmi_status_t read_gpuboard_temp_metrics(const char* filename, amdgpu_gpuboard_t
// Read the entire structure
file.read(reinterpret_cast<char*>(&metrics), sizeof(metrics));
if (file.bad()) {
std::ostringstream ess;
ess << __PRETTY_FUNCTION__ << " | ======= end ======= "
@@ -163,7 +163,7 @@ rsmi_status_t read_gpuboard_temp_metrics(const char* filename, amdgpu_gpuboard_t
LOG_INFO(ess);
return ErrnoToRsmiStatus(errno);
}
// Always create hex dump for debugging, using the number of bytes actually read
std::string hexDump = createHexDump(&metrics, file.gcount(), "GPU Board Temperature Metrics");
LOG_DEBUG(hexDump);
@@ -223,7 +223,7 @@ rsmi_status_t read_baseboard_temp_metrics(const char* filename, amdgpu_baseboard
// Read the entire structure
file.read(reinterpret_cast<char*>(&metrics), sizeof(metrics));
if (file.bad()) {
std::ostringstream ess;
ess << __PRETTY_FUNCTION__ << " | ======= end ======= "
@@ -232,7 +232,7 @@ rsmi_status_t read_baseboard_temp_metrics(const char* filename, amdgpu_baseboard
LOG_INFO(ess);
return ErrnoToRsmiStatus(errno);
}
// Always create hex dump for debugging, using the number of bytes actually read
std::string hexDump = createHexDump(&metrics, file.gcount(), "Baseboard Temperature Metrics");
LOG_DEBUG(hexDump);
@@ -300,7 +300,7 @@ rsmi_status_t get_gpuboard_temp_value(const amdgpu_gpuboard_temp_metrics_v1_0& m
auto it = vr_temp_map.find(i);
if (it != vr_temp_map.end() && it->second == temperature_type) {
*value = decode_temperature_value(metrics.vr_temp[i]);
std::ostringstream oss;
oss << __PRETTY_FUNCTION__ << " | ======= end ======= "
<< " | Success | VR temp found at index: " << i
@@ -362,7 +362,7 @@ rsmi_status_t get_baseboard_temp_value(const amdgpu_baseboard_temp_metrics_v1_0&
auto it = system_temp_map.find(i);
if (it != system_temp_map.end() && it->second == temperature_type) {
*value = decode_temperature_value(metrics.system_temp[i]);
std::ostringstream oss;
oss << __PRETTY_FUNCTION__ << " | ======= end ======= "
<< " | Success | System temp found at index: " << i
+2 -2
ファイルの表示
@@ -588,7 +588,7 @@ static const std::map<const char *, dev_depends_t> kDevFuncDependsMap = {
kDevPowerODVoltageFName}, {}}},
{"rsmi_dev_overdrive_level_set", {{kDevOverDriveLevelFName}, {}}},
{"rsmi_dev_vbios_version_get", {{kDevVBiosVerFName}, {}}},
{"rsmi_dev_vbios_build_number_get", {{kDevVBiosBuildFName}, {}}},
{"rsmi_dev_vbios_build_number_get", {{kDevVBiosBuildFName}, {}}},
{"rsmi_dev_od_volt_info_get", {{kDevPowerODVoltageFName}, {}}},
{"rsmi_dev_od_volt_info_set", {{kDevPowerODVoltageFName,
kDevPerfLevelFName}, {}}},
@@ -1245,7 +1245,7 @@ int Device::readDevInfoBinary(DevInfoTypes type, std::size_t b_size,
if (type == DevInfoTypes::kDevGpuMetrics &&
kGpuMetricsCacheDuration > std::chrono::milliseconds::zero()) {
auto now = std::chrono::steady_clock::now();
std::lock_guard<std::mutex> lock(cache_ptr->mtx);
cache_ptr->data.assign(
reinterpret_cast<uint8_t*>(p_binary_data),
+9 -9
ファイルの表示
@@ -91,7 +91,7 @@ static inline std::optional<T> read_scalar(Cursor& c) {
template <class T>
static inline std::optional<std::vector<T>> read_vector(Cursor& c, std::size_t count) {
static_assert(std::is_integral_v<T> && std::is_trivially_copyable_v<T>,
"metrics expect integral element types");
@@ -224,31 +224,31 @@ auto AMDGpuDynamicMetrics_t::parse_from_buffer(const std::byte* data,
break;
}
case AMDGpuMetricAttributeType_t::TYPE_INT8: {
mv = read_metric_value<std::int8_t>(cur, instances);
mv = read_metric_value<std::int8_t>(cur, instances);
break;
}
case AMDGpuMetricAttributeType_t::TYPE_UINT16: {
mv = read_metric_value<std::uint16_t>(cur, instances);
mv = read_metric_value<std::uint16_t>(cur, instances);
break;
}
case AMDGpuMetricAttributeType_t::TYPE_INT16: {
mv = read_metric_value<std::int16_t>(cur, instances);
mv = read_metric_value<std::int16_t>(cur, instances);
break;
}
case AMDGpuMetricAttributeType_t::TYPE_UINT32: {
mv = read_metric_value<std::uint32_t>(cur, instances);
mv = read_metric_value<std::uint32_t>(cur, instances);
break;
}
case AMDGpuMetricAttributeType_t::TYPE_INT32: {
mv = read_metric_value<std::int32_t>(cur, instances);
mv = read_metric_value<std::int32_t>(cur, instances);
break;
}
case AMDGpuMetricAttributeType_t::TYPE_UINT64: {
mv = read_metric_value<std::uint64_t>(cur, instances);
mv = read_metric_value<std::uint64_t>(cur, instances);
break;
}
case AMDGpuMetricAttributeType_t::TYPE_INT64: {
mv = read_metric_value<std::int64_t>(cur, instances);
mv = read_metric_value<std::int64_t>(cur, instances);
break;
}
default: return RSMI_STATUS_INSUFFICIENT_SIZE;
@@ -289,7 +289,7 @@ auto AMDGpuDynamicMetrics_t::parse_from_file(const std::string& metrics_file_pat
rsmi_status_t read_dynamic_gpu_metrics_file(const std::string& metrics_file_path,
const size_t read_size,
AMDGPUMetricsDynDataBuffer_t& out) {
// Clear output buffer and open file stream
out.clear();
std::ifstream gpu_metrics_file(metrics_file_path, std::ios::binary);
+1 -1
ファイルの表示
@@ -537,7 +537,7 @@ rsmi_status_t GpuMetricsBaseDynamic_t::populate_metrics_dynamic_tbl() {
LOG_TRACE(ss);
auto m_metrics_dynamic_tbl = AMDGpuDynamicMetricsTbl_t{};
auto emit = [&](AMDGpuMetricsClassId_t cls, AMDGpuMetricsUnitType_t unit,
const char* label,
const details::AMDGpuMetricAttributeData_t& row) {
+5 -5
ファイルの表示
@@ -67,7 +67,7 @@ else()
endif()
file(GLOB RAS_DECODE_INCLUDES "${RAS_DECODE_INC_DIR}/*.h")
file(GLOB RAS_DECODE_SOURCES "${RAS_DECODE_SRC_DIR}/*.c")
list(REMOVE_ITEM RAS_DECODE_SOURCES "main.c")
list(REMOVE_ITEM RAS_DECODE_SOURCES "main.c")
set(SRC_LIST ${SRC_LIST} ${RAS_DECODE_SOURCES})
set(INC_LIST ${INC_LIST} ${RAS_DECODE_INCLUDES})
@@ -90,13 +90,13 @@ target_link_libraries(${AMD_SMI} PRIVATE
${CMAKE_DL_LIBS}
${FILESYSTEM_LIB}
)
target_include_directories(${AMD_SMI} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
target_include_directories(${AMD_SMI} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/rocm_smi/include
${PROJECT_SOURCE_DIR}/common/shared_mutex
${PROJECT_SOURCE_DIR}/common/shared_mutex
${RAS_DECODE_INC_DIR}
${DRM_INCLUDE_DIRS}
${DRM_AMDGPU_INCLUDE_DIRS}
${DRM_AMDGPU_INCLUDE_DIRS}
)
# use the target_include_directories() command to specify the include directories for the target
+12 -12
ファイルの表示
@@ -492,7 +492,7 @@ amdsmi_status_t amdsmi_get_node_handle(amdsmi_processor_handle processor_handle,
if (r != AMDSMI_STATUS_SUCCESS) {
return r;
}
if (asic_info.oam_id != 0) {
return AMDSMI_STATUS_NOT_SUPPORTED;
}
@@ -514,7 +514,7 @@ amdsmi_status_t amdsmi_get_node_handle(amdsmi_processor_handle processor_handle,
// Navigate to the board directory from the DRM device path
fs::path board_dir = drm_device_path / "board";
fs::path npm_status = board_dir / "npm_status";
// Check if board directory and npm_status exist
if (fs::exists(board_dir) && fs::is_directory(board_dir) && fs::exists(npm_status)) {
found_board = board_dir;
@@ -1610,7 +1610,7 @@ amdsmi_status_t amdsmi_set_gpu_fan_speed(amdsmi_processor_handle processor_handl
return AMDSMI_STATUS_NOT_SUPPORTED;
}
}
return rsmi_wrapper(rsmi_dev_fan_speed_set, processor_handle, 0,
sensor_ind, speed);
}
@@ -1954,7 +1954,7 @@ amdsmi_get_gpu_asic_info(amdsmi_processor_handle processor_handle, amdsmi_asic_i
// ---- Store cache success ----
if (status == AMDSMI_STATUS_SUCCESS &&
kAsicInfoCacheDuration > std::chrono::milliseconds::zero()) {
auto now = std::chrono::steady_clock::now();
std::lock_guard<std::mutex> lk(cache_ptr->mtx);
cache_ptr->info = *info;
@@ -2241,9 +2241,9 @@ amdsmi_get_gpu_event_notification(int timeout_ms,
data[i].event = static_cast<amdsmi_evt_notification_type_t>(
rsmi_data.event);
// Size is tied max event notification size
snprintf(data[i].message,
snprintf(data[i].message,
AMDSMI_MAX_STRING_LENGTH,
"%s",
"%s",
rsmi_data.message);
amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance()
.gpu_index_to_handle(rsmi_data.dv_ind, &(data[i].processor_handle));
@@ -3647,7 +3647,7 @@ amdsmi_status_t amdsmi_set_gpu_pci_bandwidth(amdsmi_processor_handle processor_
return AMDSMI_STATUS_NOT_SUPPORTED;
}
}
return rsmi_wrapper(rsmi_dev_pci_bandwidth_set, processor_handle, 0,
bw_bitmask);
}
@@ -3979,7 +3979,7 @@ amdsmi_status_t amdsmi_set_gpu_clk_range(amdsmi_processor_handle processor_handl
return AMDSMI_STATUS_NOT_SUPPORTED;
}
}
return rsmi_wrapper(rsmi_dev_clk_range_set, processor_handle, 0,
minclkvalue, maxclkvalue,
static_cast<rsmi_clk_type_t>(clkType));
@@ -5329,7 +5329,7 @@ bool amdsmi_is_supported_format(
amdsmi_status_t
amdsmi_get_gpu_ptl_state(amdsmi_processor_handle processor_handle, bool *enabled) {
return rsmi_wrapper(rsmi_get_gpu_ptl_state, processor_handle, 0, enabled);
return rsmi_wrapper(rsmi_get_gpu_ptl_state, processor_handle, 0, enabled);
}
amdsmi_status_t
@@ -5456,7 +5456,7 @@ amdsmi_get_gpu_ptl_formats(amdsmi_processor_handle processor_handle,
if (tokens.empty() || tokens.size() != 2) {
return AMDSMI_STATUS_UNEXPECTED_SIZE; // malformed sysfs content
}
// Parse tokens
amdsmi_ptl_data_format_t f1 = token_to_amdsmi_fmt(tokens[0]);
if (f1 == AMDSMI_PTL_DATA_FORMAT_INVALID) {
@@ -5508,11 +5508,11 @@ amdsmi_set_gpu_ptl_formats(amdsmi_processor_handle processor_handle,
}
// Convert enums to string
std::string format =
std::string format =
std::string(amdsmi_fmt_to_token(data_format1)) + "," +
amdsmi_fmt_to_token(data_format2);
return rsmi_wrapper(rsmi_set_gpu_ptl_formats, processor_handle, 0, format.c_str());
return rsmi_wrapper(rsmi_set_gpu_ptl_formats, processor_handle, 0, format.c_str());
}
amdsmi_status_t amdsmi_get_cpu_affinity_with_scope(amdsmi_processor_handle processor_handle,
+11 -11
ファイルの表示
@@ -151,7 +151,7 @@ static auto amdsmi_read_cper_file(const std::string &filepath) -> CperFileCtx {
0x72, 0x5F, 0xD6, 0xAE)
#define AMD_GPU_NONSTANDARD_ERROR \
GUID_INIT(0x32AC0C78, 0x2623, 0x48F6, 0x81, 0xA2, 0xAC, 0x69, \
0x17, 0x80, 0x55, 0x1D)
0x17, 0x80, 0x55, 0x1D)
#define PROC_ERR_SECTION_TYPE \
GUID_INIT(0xDC3EA0B0, 0xA144, 0x4797, 0xB9, 0x5B, 0x53, 0xFA, \
0x24, 0x2B, 0x6E, 0x1D)
@@ -238,9 +238,9 @@ static int cper_dump_sec_desc(const struct cper_sec_desc *desc)
ss << "[SEC DESC] fru_id = " << desc->fru_id << "\n";
ss << "[SEC DESC] fru_text = " << desc->fru_text << "\n";
ss << std::dec << "\n";
if (cper_is_cr(&desc->sec_type))
ss << "[SEC DESC] AMD CrashDump Section\n";
else if (cper_is_nonstd(&desc->sec_type))
@@ -256,13 +256,13 @@ static int cper_dump_sec_desc(const struct cper_sec_desc *desc)
return 0;
}
static int aca_decode_fatal(const cper_sec_crashdump_data &data, uint32_t flag, uint16_t hw_revision, uint16_t register_context_type)
static int aca_decode_fatal(const cper_sec_crashdump_data &data, uint32_t flag, uint16_t hw_revision, uint16_t register_context_type)
{
const uint64_t *register_array = reinterpret_cast<const uint64_t *>(&data.dump.fatal_err);
return decode_afid(register_array, sizeof(data.dump.fatal_err)/sizeof(uint64_t), flag, hw_revision, register_context_type);
}
static int aca_decode_corrected_error(const uint32_t *reg_dump, size_t num_bytes, uint32_t flag, uint16_t hw_revision, uint16_t register_context_type)
static int aca_decode_corrected_error(const uint32_t *reg_dump, size_t num_bytes, uint32_t flag, uint16_t hw_revision, uint16_t register_context_type)
{
const uint64_t *register_array = reinterpret_cast<const uint64_t *>(reg_dump);
return decode_afid(register_array, num_bytes, flag, hw_revision, register_context_type);
@@ -294,13 +294,13 @@ static int cper_dump_nonstd_err(const struct cper_sec_nonstd_err *nonstd_err, co
for (int i = 0; i < CPER_ACA_REG_COUNT; i++) {
ss << "[NonSTD SEC] reg_dump[" << std::dec << i << "] = 0x" << std::hex << body->err_ctx.reg_dump[i] << "\n";
}
exit:
exit:
ss << std::dec << "~~~~NON STANDARD SECTION~~~\n\n";
LOG_DEBUG(ss);
return aca_decode_corrected_error(body->err_ctx.reg_dump, sizeof(body->err_ctx.reg_dump)/sizeof(uint64_t),
return aca_decode_corrected_error(body->err_ctx.reg_dump, sizeof(body->err_ctx.reg_dump)/sizeof(uint64_t),
section->flags_mask, section->revision_major, body->err_ctx.reg_ctx_type);
}
@@ -349,7 +349,7 @@ static void inject_product_serial_number(amdsmi_cper_hdr_t *cper, uint64_t produ
}
}
} //namespace
} //namespace
amdsmi_status_t amdsmi_get_gpu_cper_entries_by_path(
const char *amdgpu_ring_cper_file,
@@ -520,13 +520,13 @@ std::vector<int> cper_decode(const amdsmi_cper_hdr_t *cper) {
ss << __PRETTY_FUNCTION__ << "\n:" << __LINE__ << "[AFIDS] decoding non-standard error\n";
LOG_DEBUG(ss);
afids.emplace_back(cper_dump_nonstd_err(crashdump, section));
}
}
else if (cper_is_proc_err(sec_guid)) {
struct cper_sec_nonstd_err *crashdump = static_cast<struct cper_sec_nonstd_err *>(sec_offset);
ss << __PRETTY_FUNCTION__ << "\n:" << __LINE__ << "[AFIDS] decoding proc error section type\n";
LOG_DEBUG(ss);
afids.emplace_back(cper_dump_nonstd_err(crashdump, section));
}
}
else {
ss << __PRETTY_FUNCTION__ << "\n:" << __LINE__ << "[AFIDS] Unknown error type!!\n";
for(size_t j = 0; j < sizeof(sec_guid->b); ++j) {
+2 -2
ファイルの表示
@@ -1028,8 +1028,8 @@ uint64_t get_product_serial_number(amdsmi_processor_handle processor_handle) {
amdsmi_status_t status = amdsmi_get_gpu_board_info(processor_handle, &board_info);
if (status != AMDSMI_STATUS_SUCCESS) {
std::ostringstream ss;
ss << __PRETTY_FUNCTION__ << "\n:" << __LINE__ <<
"Failed to retrieve product serial number! error: " <<
ss << __PRETTY_FUNCTION__ << "\n:" << __LINE__ <<
"Failed to retrieve product serial number! error: " <<
static_cast<int>(status);
LOG_DEBUG(ss);
return serial_number;
+3 -3
ファイルの表示
@@ -41,7 +41,7 @@ static const std::map<uint32_t, std::string> kTempSensorNameMap = {
{AMDSMI_TEMPERATURE_TYPE_HBM_2, "HBM_2"},
{AMDSMI_TEMPERATURE_TYPE_HBM_3, "HBM_3"},
{AMDSMI_TEMPERATURE_TYPE_PLX, "PLX"},
// GPU Board Node Temperature Types (100-149)
{AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_RETIMER_X, "GPU Board Node Retimer X"},
{AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_OAM_X_IBC, "GPU Board Node OAM X IBC"},
@@ -49,7 +49,7 @@ static const std::map<uint32_t, std::string> kTempSensorNameMap = {
{AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_OAM_X_VDD18_VR, "GPU Board Node OAM X VDD18 VR"},
{AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_OAM_X_04_HBM_B_VR, "GPU Board Node OAM X 04 HBM B VR"},
{AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_OAM_X_04_HBM_D_VR, "GPU Board Node OAM X 04 HBM D VR"},
// GPU Board VR Temperature Types (150-199)
{AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_VDD0, "GPU Board VDDCR VDD0"},
{AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_VDD1, "GPU Board VDDCR VDD1"},
@@ -64,7 +64,7 @@ static const std::map<uint32_t, std::string> kTempSensorNameMap = {
{AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_11_HBM_D, "GPU Board VDDCR 11 HBM D"},
{AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDD_USR, "GPU Board VDD USR"},
{AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDIO_11_E32, "GPU Board VDDIO 11 E32"},
// Baseboard System Temperature Types (200+)
{AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_FPGA, "Baseboard UBB FPGA"},
{AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_FRONT, "Baseboard UBB Front"},
+13 -13
ファイルの表示
@@ -12,21 +12,21 @@ Follow our install/build guides to ensure the Python API is installed correctly
## How to Run
### Basic How To
The 2 tests are in this PATH:
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py```
The 2 tests are in this PATH:
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py```
The recommended method to run the tests:
<u>Unittest only (not verbose)</u>
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -b -v```
The recommended method to run the tests:
<u>Unittest only (not verbose)</u>
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -b -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -b -v```
<u>Unittest verbose</u>
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -v```
<u>Unittest verbose</u>
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -v```
<u>Unittest filter and verbose</u>
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -k "testname" -v```
<u>Unittest filter and verbose</u>
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -k "testname" -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -k "testname" -v```
## Unittest Run Options
@@ -43,7 +43,7 @@ options:
Runs all tests. Silence print statements to stdout. Lists tests results.
This is also the best way to list all tests available.
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -b -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -b -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -b -v```
ex.
@@ -67,7 +67,7 @@ OK
### Unittest: verbose (with print statements)
Helpful to see print outs of Python.
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -v```
@@ -621,9 +621,9 @@ OK
### Unittest: filter and verbose
Allow filtering based on common or specific test names.
Allow filtering based on common or specific test names.
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -k "test_walkthrough" -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -k "test_walkthrough" -v```
ex.
<details open>
+32 -32
ファイルの表示
@@ -192,7 +192,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
vram_info['vram_bit_width']))
print(" vram_info['vram_max_bandwidth'] is: {} GB/s".format(
vram_info['vram_max_bandwidth']))
# amdsmi_get_gpu_xcd_counter should be supported on all ASICs
def test_get_xcd_counter(self):
processors = amdsmi.amdsmi_get_processor_handles()
@@ -359,7 +359,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" DF clock_frequency['frequency']: {}".format(
clock_frequency['frequency']))
print("\n")
# amdsmi_get_clk_freq with AmdSmiClkType.DCEF is not supported in MI210, MI300A
def test_clock_frequency_DCEF(self):
@@ -382,7 +382,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" DCEF clock_frequency['frequency']: {}".format(
clock_frequency['frequency']))
print("\n")
def test_clock_info(self):
processors = amdsmi.amdsmi_get_processor_handles()
@@ -421,7 +421,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" Is MEM clock in deep sleep: {}".format(
clock_measure['clk_deep_sleep']))
print("\n")
# AmdSmiClkType.VCLK0 and DCLK0 are not supported in MI210
def test_clock_info_vclk0_dclk0(self):
@@ -459,7 +459,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" Is DCLK0 clock in deep sleep: {}".format(
clock_measure['clk_deep_sleep']))
print("\n")
# AmdSmiClkType.VCLK1 and DCLK1 are not supported in MI210, MI300A, MI300X
def test_clock_info_vclk1_dclk1(self):
@@ -497,7 +497,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" Is DCLK1 clock in deep sleep: {}".format(
clock_measure['clk_deep_sleep']))
print("\n")
def test_driver_info(self):
processors = amdsmi.amdsmi_get_processor_handles()
@@ -514,7 +514,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
continue
print("Driver info: {}".format(driver_info))
print("\n")
# amdsmi_get_gpu_ecc_count is not supported in Navi2x, Navi3x, MI210, MI300A
def test_ecc_count_block(self):
@@ -565,7 +565,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
self.assertGreaterEqual(ecc_count['deferred_count'], 0)
print("\n")
print("\n")
def test_ecc_count_total(self):
processors = amdsmi.amdsmi_get_processor_handles()
@@ -590,7 +590,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
self.assertGreaterEqual(ecc_info['correctable_count'], 0)
self.assertGreaterEqual(ecc_info['deferred_count'], 0)
print("\n")
def test_fw_info(self):
processors = amdsmi.amdsmi_get_processor_handles()
@@ -638,7 +638,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" engine_usage['mm_activity'] is: {} %".format(
engine_usage['mm_activity']))
print("\n")
def test_memory_usage(self):
@@ -660,7 +660,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
self._check_exception(e)
continue
print("\n")
def test_pcie_info(self):
@@ -703,7 +703,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" pcie_info['pcie_metric']['pcie_lc_perf_other_end_recovery_count'] is: {}".format(
pcie_info['pcie_metric']['pcie_lc_perf_other_end_recovery_count']))
print("\n")
def test_power_info(self):
@@ -750,7 +750,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" Power management enabled: {}".format(
is_power_management_enabled))
print("\n")
def test_process_list(self):
@@ -807,7 +807,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
for j in range(0, len(ras_enabled)):
print(" RAS status for {} is: {}".format(ras_enabled[j]['block'], ras_enabled[j]['status']))
print("\n")
# amdsmi_get_gpu_ras_feature_info is not supported in Navi2x, Navi3x
def test_ras_feature_info(self):
@@ -831,7 +831,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print("RAS double bit schema: {}".format(ras_feature['double_bit_schema']))
print("Poisoning supported: {}".format(ras_feature['poison_schema']))
print("\n")
def test_socket_info(self):
@@ -840,7 +840,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
sockets = amdsmi.amdsmi_get_socket_handles()
except amdsmi.AmdSmiLibraryException as e:
self._check_exception(e)
for i in range(0, len(sockets)):
print("\n\n###Test Socket {}".format(i))
try:
@@ -851,7 +851,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
continue
print(" Socket: {}".format(socket_name))
print("\n")
def test_temperature_metric(self):
@@ -893,7 +893,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
self._check_exception(e)
continue
print("\n")
# AmdSmiTemperatureType.EDGE is not supported in MI300A, MI300X
def test_temperature_metric_edge(self):
@@ -922,7 +922,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
self._check_exception(e)
continue
print("\n")
def test_temperature_metric_plx(self):
@@ -950,7 +950,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
self._check_exception(e)
continue
print("\n")
# AmdSmiTemperatureType.HBM_0, HBM_1, HBM_2, HBM_3 are not supported in Navi2x, Navi3x, MI210, MI300A
def test_temperature_metric_hbm(self):
@@ -986,7 +986,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
self._check_exception(e)
continue
print("\n")
def test_utilization_count(self):
@@ -1097,7 +1097,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" num_resources: {}".format(
accelerator_partition['partition_profile']['num_resources']))
print("\n")
# Requires sudo (to see full resource/config detail).
# Should only be supported on MI300+ ASICs
@@ -1130,7 +1130,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print("\t\t\t num_partitions_share_resource: {}".format(
p['resources'][r]['num_partitions_share_resource']))
print("\n")
# amdsmi_get_violation_status is only supported on MI300+ ASICs
# We should expect a not supported status for Navi / MI100 / MI2x ASICs
@@ -1192,8 +1192,8 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" GFX CLK Below Host Limit Violation (bool): {}".format(
violation_status['active_gfx_clk_below_host_limit']))
print("\n")
# Add test for amdsmi_get_gpu_reg_table_info
def test_gpu_reg_table_info(self):
@@ -1210,8 +1210,8 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" reg_table_info['reg_table'] is: {}".format(
reg_table_info))
print("\n")
def test_get_gpu_revision(self):
processors = amdsmi.amdsmi_get_processor_handles()
@@ -1228,8 +1228,8 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
continue
print(f" GPU revision is: {revision}")
print("\n")
# Add test for amdsmi_get_gpu_pm_metrics_info
def test_gpu_pm_metrics_info(self):
@@ -1246,7 +1246,7 @@ class TestAmdSmiPythonInterface(unittest.TestCase):
print(" pm_metrics_info['pm_metrics'] is: {}".format(
pm_metrics_info))
print("\n")
def test_walkthrough(self):
print("\n\n#######################################################################")
@@ -1367,7 +1367,7 @@ if __name__ == '__main__':
elif '-v' in sys.argv or '--verbose' in sys.argv:
verbose=2
has_info_printed = False
# If no -k or --keyword argument is given, print all available tests
if not ('-k' in sys.argv or '--keyword' in sys.argv):
loader = unittest.TestLoader()
@@ -1381,7 +1381,7 @@ if __name__ == '__main__':
print("Legend: . = pass, s = skipped, F = fail, E = error")
print("==============================================================")
print("Running tests...\n")
# Detect if ran without sudo or root privileges
if os.geteuid() != 0:
print("Warning: Some tests may require elevated privileges (sudo/root) to run completely.\n")
+1 -1
ファイルの表示
@@ -19,7 +19,7 @@
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
set -e
set -u
+6 -6
ファイルの表示
@@ -5,7 +5,7 @@ def get_platforms(file_name):
# removing the new line characters
with open(file_name) as f:
lines = [line.rstrip() for line in f]
platform_map = {}
platform_lines = ""
function_line = ""
@@ -29,7 +29,7 @@ def get_platforms(file_name):
platform_lines = ""
function_line = ""
continue
function_line += line + " "
function_line += line + " "
return platform_map
# string in list1 but not in list2
@@ -69,7 +69,7 @@ if __name__ == '__main__':
for f in platform_map[args.list]:
print (f)
exit(0)
if args.diff != None:
if args.diff[0] not in platform_map or args.diff[1] not in platform_map:
print("Unknown platforms ", args.diff)
@@ -81,8 +81,8 @@ if __name__ == '__main__':
for f in result:
print(f)
exit(0)
if args.common != None:
if args.common[0] not in platform_map or args.common[1] not in platform_map:
print("Unknown platforms ", args.common)
@@ -94,6 +94,6 @@ if __name__ == '__main__':
for f in result:
print(f)
exit(0)
parser.print_help()