Corrected partition changes in header and wrapper

Signed-off-by: gabrpham <Gabriel.Pham@amd.com>
Change-Id: Iafd7de8f08924873da841ee6eca62100a17b2b6c


[ROCm/amdsmi commit: 8bc4abc88b]
This commit is contained in:
gabrpham
2024-09-20 16:01:09 -05:00
کامیت شده توسط Maisam Arif
والد f59f2caf2c
کامیت 2aa8e8c755
6فایلهای تغییر یافته به همراه114 افزوده شده و 43 حذف شده
+23 -6
مشاهده پرونده
@@ -238,16 +238,34 @@ typedef enum {
AMDSMI_ACCELERATOR_PARTITION_QPX, //!< Quad GPU mode (QPX)- Quarter XCCs
//!< work together with shared memory
AMDSMI_ACCELERATOR_PARTITION_CPX, //!< Core mode (CPX)- Per-chip XCC with
//!< shared memory
//!< shared memory
} amdsmi_accelerator_partition_type_t;
/**
* @brief Possible Memory Partition Modes.
* This union is used to identify various memory partitioning settings.
*/
typedef union {
struct {
uint32_t nps1_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
uint32_t nps2_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
uint32_t nps4_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
uint32_t nps8_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
uint32_t reserved :28;
} amdsmi_nps_flags_t;
uint32_t nps_cap_mask;
} amdsmi_nps_caps_t;
typedef struct {
amdsmi_accelerator_partition_type_t profile_type; // SPX, DPX, QPX, CPX and so on
uint32_t num_partitions; // On MI300X, SPX: 1, DPX: 2, QPX: 4, CPX: 8, the length of resources array
uint32_t profile_index; // The index in the profiles array in amdsmi_compute_partition_profile_t
uint32_t num_partitions; // On MI300X, SPX: 1, DPX: 2, QPX: 4, CPX: 8, length of resources array
uint32_t profile_index;
amdsmi_nps_caps_t memory_caps; // Possible memory partition capabilities
uint32_t num_resources; // length of index_of_resources_profile
uint32_t resources[AMDSMI_MAX_ACCELERATOR_PARTITIONS][AMDSMI_MAX_CP_PROFILE_RESOURCES];
uint32_t reserved[12];
uint64_t reserved[6];
} amdsmi_accelerator_partition_profile_t;
```
@@ -288,8 +306,7 @@ GPU: 1
### Resolved issues
- **Fixed CPX not showing total number of logical GPUs**.
- Updates were made to `amdsmi_init()` and `amdsmi_get_gpu_bdf_id(..)`. In order to display all logical devices, we needed a way to provide order to GPU's enumerated. This was done
by adding a partition_id within the BDF optional pci_id bits.
- Updates were made to `amdsmi_init()` and `amdsmi_get_gpu_bdf_id(..)`. In order to display all logical devices, we needed a way to provide order to GPU's enumerated. This was done by adding a partition_id within the BDF optional pci_id bits.
- Due to driver changes in KFD, some devices may report bits [31:28] or [2:0]. With the newly added `amdsmi_get_gpu_bdf_id(..)`, we provided this fallback to properly retreive partition ID. We
plan to eventually remove partition ID from the function portion of the BDF (Bus Device Function). See below for PCI ID description.
@@ -293,7 +293,7 @@ typedef enum {
AMDSMI_ACCELERATOR_PARTITION_QPX, //!< Quad GPU mode (QPX)- Quarter XCCs
//!< work together with shared memory
AMDSMI_ACCELERATOR_PARTITION_CPX, //!< Core mode (CPX)- Per-chip XCC with
//!< shared memory
//!< shared memory
} amdsmi_accelerator_partition_type_t;
/**
@@ -620,10 +620,31 @@ typedef struct {
uint32_t reserved[13];
} amdsmi_kfd_info_t;
/**
* @brief Possible Memory Partition Modes.
* This union is used to identify various memory partitioning settings.
*/
typedef union {
struct nps_flags_ {
uint32_t nps1_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
uint32_t nps2_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
uint32_t nps4_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
uint32_t nps8_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
uint32_t reserved :28;
} amdsmi_nps_flags_t;
uint32_t nps_cap_mask;
} amdsmi_nps_caps_t;
/**
* @brief Possible Memory Partition Modes.
* This union is used to identify various memory partitioning settings.
*/
typedef struct {
amdsmi_accelerator_partition_type_t profile_type; // SPX, DPX, QPX, CPX and so on
uint32_t num_partitions; // On MI300X, SPX: 1, DPX: 2, QPX: 4, CPX: 8, the length of resources array
uint32_t profile_index; // The index in the profiles array in amdsmi_accelerator_partition_profile_t
uint32_t num_partitions; // On MI300X, SPX: 1, DPX: 2, QPX: 4, CPX: 8, length of resources array
uint32_t profile_index;
amdsmi_nps_caps_t memory_caps; // Possible memory partition capabilities
uint32_t num_resources; // length of index_of_resources_profile
uint32_t resources[AMDSMI_MAX_ACCELERATOR_PARTITIONS][AMDSMI_MAX_CP_PROFILE_RESOURCES];
uint64_t reserved[6];
@@ -4772,7 +4793,7 @@ amdsmi_get_gpu_asic_info(amdsmi_processor_handle processor_handle, amdsmi_asic_i
* @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf}
*
* @details This function returns KFD information populated into the amdsmi_kfd_info_t.
* This contains the kfd_id and node_id which allow for the ID and
* This contains the kfd_id and node_id which allow for the ID and
* index of this device in the KFD.
*
* @param[in] processor_handle Device which to query
@@ -2739,6 +2739,7 @@ def amdsmi_get_gpu_accelerator_partition_profile(
"profile_type" : profile.profile_type,
"num_partitions" : profile.num_partitions,
"profile_index" : profile.profile_index,
"memory_caps" : "N/A",
"num_resources" : profile.num_resources,
"resources" : "N/A"
}
@@ -776,6 +776,19 @@ amdsmi_card_form_factor_t = ctypes.c_uint32 # enum
class struct_amdsmi_pcie_info_t(Structure):
pass
class struct_pcie_static_(Structure):
pass
struct_pcie_static_._pack_ = 1 # source:False
struct_pcie_static_._fields_ = [
('max_pcie_width', ctypes.c_uint16),
('PADDING_0', ctypes.c_ubyte * 2),
('max_pcie_speed', ctypes.c_uint32),
('pcie_interface_version', ctypes.c_uint32),
('slot_type', amdsmi_card_form_factor_t),
('reserved', ctypes.c_uint64 * 10),
]
class struct_pcie_metric_(Structure):
pass
@@ -794,19 +807,6 @@ struct_pcie_metric_._fields_ = [
('reserved', ctypes.c_uint64 * 13),
]
class struct_pcie_static_(Structure):
pass
struct_pcie_static_._pack_ = 1 # source:False
struct_pcie_static_._fields_ = [
('max_pcie_width', ctypes.c_uint16),
('PADDING_0', ctypes.c_ubyte * 2),
('max_pcie_speed', ctypes.c_uint32),
('pcie_interface_version', ctypes.c_uint32),
('slot_type', amdsmi_card_form_factor_t),
('reserved', ctypes.c_uint64 * 10),
]
struct_amdsmi_pcie_info_t._pack_ = 1 # source:False
struct_amdsmi_pcie_info_t._fields_ = [
('pcie_static', struct_pcie_static_),
@@ -937,6 +937,28 @@ struct_amdsmi_kfd_info_t._fields_ = [
]
amdsmi_kfd_info_t = struct_amdsmi_kfd_info_t
class union_amdsmi_nps_caps_t(Union):
pass
class struct_nps_flags_(Structure):
pass
struct_nps_flags_._pack_ = 1 # source:False
struct_nps_flags_._fields_ = [
('nps1_cap', ctypes.c_uint32, 1),
('nps2_cap', ctypes.c_uint32, 1),
('nps4_cap', ctypes.c_uint32, 1),
('nps8_cap', ctypes.c_uint32, 1),
('reserved', ctypes.c_uint32, 28),
]
union_amdsmi_nps_caps_t._pack_ = 1 # source:False
union_amdsmi_nps_caps_t._fields_ = [
('amdsmi_nps_flags_t', struct_nps_flags_),
('nps_cap_mask', ctypes.c_uint32),
]
amdsmi_nps_caps_t = union_amdsmi_nps_caps_t
class struct_amdsmi_accelerator_partition_profile_t(Structure):
pass
@@ -945,8 +967,10 @@ struct_amdsmi_accelerator_partition_profile_t._fields_ = [
('profile_type', amdsmi_accelerator_partition_type_t),
('num_partitions', ctypes.c_uint32),
('profile_index', ctypes.c_uint32),
('memory_caps', amdsmi_nps_caps_t),
('num_resources', ctypes.c_uint32),
('resources', ctypes.c_uint32 * 32 * 8),
('PADDING_0', ctypes.c_ubyte * 4),
('reserved', ctypes.c_uint64 * 6),
]
@@ -1076,6 +1100,16 @@ amdsmi_process_handle_t = ctypes.c_uint32
class struct_amdsmi_proc_info_t(Structure):
pass
class struct_engine_usage_(Structure):
pass
struct_engine_usage_._pack_ = 1 # source:False
struct_engine_usage_._fields_ = [
('gfx', ctypes.c_uint64),
('enc', ctypes.c_uint64),
('reserved', ctypes.c_uint32 * 12),
]
class struct_memory_usage_(Structure):
pass
@@ -1087,16 +1121,6 @@ struct_memory_usage_._fields_ = [
('reserved', ctypes.c_uint32 * 10),
]
class struct_engine_usage_(Structure):
pass
struct_engine_usage_._pack_ = 1 # source:False
struct_engine_usage_._fields_ = [
('gfx', ctypes.c_uint64),
('enc', ctypes.c_uint64),
('reserved', ctypes.c_uint32 * 12),
]
struct_amdsmi_proc_info_t._pack_ = 1 # source:False
struct_amdsmi_proc_info_t._fields_ = [
('name', ctypes.c_char * 32),
@@ -2800,11 +2824,12 @@ __all__ = \
'amdsmi_link_id_bw_type_t', 'amdsmi_link_metrics_t',
'amdsmi_link_type_t', 'amdsmi_memory_page_status_t',
'amdsmi_memory_partition_type_t', 'amdsmi_memory_type_t',
'amdsmi_mm_ip_t', 'amdsmi_name_value_t', 'amdsmi_od_vddc_point_t',
'amdsmi_od_volt_curve_t', 'amdsmi_od_volt_freq_data_t',
'amdsmi_p2p_capability_t', 'amdsmi_pcie_bandwidth_t',
'amdsmi_pcie_info_t', 'amdsmi_power_cap_info_t',
'amdsmi_power_info_t', 'amdsmi_power_profile_preset_masks_t',
'amdsmi_mm_ip_t', 'amdsmi_name_value_t', 'amdsmi_nps_caps_t',
'amdsmi_od_vddc_point_t', 'amdsmi_od_volt_curve_t',
'amdsmi_od_volt_freq_data_t', 'amdsmi_p2p_capability_t',
'amdsmi_pcie_bandwidth_t', 'amdsmi_pcie_info_t',
'amdsmi_power_cap_info_t', 'amdsmi_power_info_t',
'amdsmi_power_profile_preset_masks_t',
'amdsmi_power_profile_status_t', 'amdsmi_power_type_t',
'amdsmi_proc_info_t', 'amdsmi_process_handle_t',
'amdsmi_process_info_t', 'amdsmi_processor_handle',
@@ -2876,7 +2901,7 @@ __all__ = \
'struct_amdsmi_vram_info_t', 'struct_amdsmi_vram_usage_t',
'struct_amdsmi_xgmi_info_t', 'struct_cache_',
'struct_engine_usage_', 'struct_fw_info_list_',
'struct_memory_usage_', 'struct_pcie_metric_',
'struct_pcie_static_', 'struct_amdsmi_bdf_t',
'uint32_t', 'uint64_t', 'uint8_t',
'union_amdsmi_bdf_t']
'struct_memory_usage_', 'struct_nps_flags_',
'struct_pcie_metric_', 'struct_pcie_static_',
'struct_amdsmi_bdf_t','uint32_t', 'uint64_t', 'uint8_t',
'union_amdsmi_bdf_t', 'union_amdsmi_nps_caps_t']
@@ -202,7 +202,7 @@ void TestSysInfoRead::Run(void) {
}
// Verify api support checking functionality is working
err = amdsmi_get_gpu_kfd_info(processor_handles_[i], nullptr);
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
err = amdsmi_get_lib_version(&ver);
CHK_ERR_ASRT(err)
@@ -190,6 +190,13 @@ except OSError as error:
struct_amdsmi_bdf_t_line = "'struct_amdsmi_bdf_t',"
replace_line(output_file, struct_anon_all_line, struct_amdsmi_bdf_t_line)
struct_anon_all_line = ", 'struct_struct"
replace_line(output_file, struct_anon_all_line, ",")
struct_anon_all_line = "(anonymous at "
struct_amdsmi_bdf_t_line = "'struct_amdsmi_bdf_t',"
replace_line(output_file, struct_anon_all_line, struct_amdsmi_bdf_t_line)
struct_anon_all_line_to_remove = f"amdsmi.h:{line_number}:3)', "
replace_line(output_file, struct_anon_all_line_to_remove, "")