Files
rocm-systems/protos/rdc.proto
T
Bill(Shuzhou) Liu 020f6939f7 SWDEV-209060 - Create the Skeleton RDC CLI and daemon
Create the skeleton implementation of rdc_client.so and rdci. Modify current rdcd to
integrate the RDC API service:

rdc.proto is changed to add a new RdcAPI service which defined the interfaces for the RDC API.

RdcStandaloneHandler.cpp is added to send the request using gRPC to the rdcd. It is built into
the rdc_client.so

rdci.cc, RdciDisCoverySubSystem.cc and RdciSubSystem.cc are added to implement skeleton rdci.
Currently, the discovery subsystem is supported.

rdc_api_service.cc is added to the server as a skeleton to implement the RdcAPI service. Currently,
only discovery API is implemented. Note: we disabled the rdc_rsmi_service, which will be removed
in the future. The original rdc_client.so is renamed to rdc_client_smi.so which should also be
removed in the future.

Add the instruction how to run the rdcd and rdci in the build folder in the README.md.

Change-Id: Id232f9f83787e5812d4a295dc8cf0daa7728b06c
2020-08-17 14:07:25 -05:00

362 lines
9.9 KiB
Protocol Buffer
Executable File

// Copyright (c) 2019 - present Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR 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.
syntax = "proto3";
// option java_multiple_files = true;
// option java_package = "io.grpc.examples.helloworld";
// option java_outer_classname = "HelloWorldProto";
// option objc_class_prefix = "HLW";
package rdc;
/****************************************************************************/
/********************************** Rsmi Service ****************************/
/****************************************************************************/
service Rsmi {
// RSMI ID services
rpc GetNumDevices (GetNumDevicesRequest) returns(GetNumDevicesResponse) {}
// RSMI Physical Queries
rpc GetTemperature(GetTemperatureRequest) returns(GetTemperatureResponse){}
rpc GetFanRpms(GetFanRpmsRequest) returns(GetFanRpmsResponse){}
rpc GetFanSpeed(GetFanSpeedRequest) returns(GetFanSpeedResponse){}
rpc GetFanSpeedMax(GetFanSpeedMaxRequest) returns(GetFanSpeedMaxResponse){}
}
/* rsmi_num_monitor_devices() */
message GetNumDevicesRequest {
}
message GetNumDevicesResponse {
uint64 val = 1;
uint64 ret_val = 2;
}
/* GetTemperature */
/* rsmi_dev_temp_metric_get() */
message GetTemperatureRequest {
uint32 dv_ind = 1;
uint32 sensor_type = 2;
enum TemperatureMetric {
RSMI_TEMP_CURRENT = 0;
RSMI_TEMP_MAX = 1;
RSMI_TEMP_MIN = 2;
RSMI_TEMP_MAX_HYST = 3;
RSMI_TEMP_MIN_HYST = 4;
RSMI_TEMP_CRITICAL = 5;
RSMI_TEMP_CRITICAL_HYST = 6;
RSMI_TEMP_EMERGENCY = 7;
RSMI_TEMP_EMERGENCY_HYST = 8;
RSMI_TEMP_CRIT_MIN = 9;
RSMI_TEMP_CRIT_MIN_HYST = 10;
RSMI_TEMP_OFFSET = 11;
RSMI_TEMP_LOWEST = 12;
RSMI_TEMP_HIGHEST = 13;
}
TemperatureMetric metric = 3;
}
message GetTemperatureResponse {
int64 temperature = 1;
uint64 ret_val = 2;
}
/* GetFanRpms */
/* rsmi_dev_fan_rpms_get() */
message GetFanRpmsRequest {
uint32 dv_ind = 1;
uint32 sensor_ind = 2;
}
message GetFanRpmsResponse {
int64 rpms = 1;
uint64 ret_val = 2;
}
/* GetFanSpeed */
/* rsmi_dev_fan_speed_get() */
message GetFanSpeedRequest {
uint32 dv_ind = 1;
uint32 sensor_ind = 2;
}
message GetFanSpeedResponse {
int64 speed = 1;
uint64 ret_val = 2;
}
/* GetFanSpeedMax */
/* rsmi_dev_fan_speed_max_get() */
message GetFanSpeedMaxRequest {
uint32 dv_ind = 1;
uint32 sensor_ind = 2;
}
message GetFanSpeedMaxResponse {
uint64 max_speed = 1;
uint64 ret_val = 2;
}
/****************************************************************************/
/********************************** RdcAdmin Service ************************/
/****************************************************************************/
service RdcAdmin {
// RDC admin services
rpc VerifyConnection (VerifyConnectionRequest)
returns (VerifyConnectionResponse) {}
}
/* GetNumDevices */
message VerifyConnectionRequest {
uint64 magic_num = 1;
}
message VerifyConnectionResponse {
uint64 echo_magic_num = 1;
}
/****************************************************************************/
/********************************** RdcAPI Service ************************/
/****************************************************************************/
service RdcAPI {
// Discovery API
// rdc_status_t rdc_get_all_devices(uint32_t gpu_index_list[RDC_MAX_NUM_DEVICES], uint32_t* count)
rpc GetAllDevices(Empty) returns (GetAllDevicesResponse) {}
// rdc_status_t rdc_get_device_attributes(uint32_t gpu_index, rdc_device_attributes_t* p_rdc_attr)
rpc GetDeviceAttributes(GetDeviceAttributesRequest) returns (GetDeviceAttributesResponse) {}
// Group API
// rdc_status_t rdc_group_gpu_create(rdc_group_type_t type,
// const char* group_name, rdc_gpu_group_t* p_rdc_group_id)
rpc CreateGpuGroup(CreateGpuGroupRequest) returns (CreateGpuGroupResponse) {}
// rdc_status_t rdc_group_gpu_add(rdc_gpu_group_t groupId,
// uint32_t gpu_index)
rpc AddToGpuGroup(AddToGpuGroupRequest) returns (AddToGpuGroupResponse) {}
// rdc_status_t rdc_group_field_create(uint32_t num_field_ids,
// uint32_t* field_ids, const char* field_group_name,
// rdc_field_grp_t* rdc_field_group_id)
rpc CreateFieldGroup(CreateFieldGroupRequest) returns (CreateFieldGroupResponse) {}
// rdc_status_t rdc_group_field_get_info(
// rdc_field_grp_t rdc_field_group_id,
// rdc_field_group_info_t* field_group_info)
rpc GetFieldGroupInfo(GetFieldGroupInfoRequest) returns (GetFieldGroupInfoResponse) {}
// rdc_status_t rdc_group_gpu_get_info(
// rdc_gpu_group_t p_rdc_group_id, rdc_group_info_t* p_rdc_group_info)
rpc GetGpuGroupInfo(GetGpuGroupInfoRequest) returns (GetGpuGroupInfoResponse) {}
// rdc_status_t rdc_group_gpu_destroy(
// rdc_gpu_group_t p_rdc_group_id)
rpc DestroyGpuGroup(DestroyGpuGroupRequest) returns (DestroyGpuGroupResponse) {}
// rdc_status_t rdc_group_field_destroy(
// rdc_field_grp_t rdc_field_group_id)
rpc DestroyFieldGroup(DestroyFieldGroupRequest) returns (DestroyFieldGroupResponse) {}
// Field API
// rdc_status_t rdc_watch_fields(rdc_gpu_group_t group_id,
// rdc_field_grp_t field_group_id, uint64_t update_freq,
// double max_keep_age, uint32_t max_keep_samples)
rpc WatchFields(WatchFieldsRequest) returns (WatchFieldsResponse) {}
// rdc_status_t rdc_get_latest_value_for_field(uint32_t gpu_index,
// uint32_t field, rdc_field_value* value)
rpc GetLatestFieldValue(GetLatestFieldValueRequest) returns (GetLatestFieldValueResponse) {}
// rdc_status_t rdc_get_field_value_since(uint32_t gpu_index,
// uint32_t field, uint64_t since_time_stamp,
// uint64_t *next_since_time_stamp, rdc_field_value* value)
rpc GetFieldSince(GetFieldSinceRequest) returns (GetFieldSinceResponse) {}
// rdc_status_t rdc_unwatch_fields(rdc_gpu_group_t group_id,
// rdc_field_grp_t field_group_id)
rpc UnWatchFields(UnWatchFieldsRequest) returns (UnWatchFieldsResponse) {}
// rdc_status_t rdc_update_all_fields(uint32_t wait_for_update)
rpc UpdateAllFields(UpdateAllFieldsRequest) returns (UpdateAllFieldsResponse) {}
}
message Empty {
}
message GetAllDevicesResponse {
uint32 status = 1;
repeated uint32 gpus = 2;
}
message GetDeviceAttributesRequest {
uint32 gpu_index = 1;
}
message DeviceAttributes {
string device_name = 1;
}
message GetDeviceAttributesResponse {
uint32 status = 1;
DeviceAttributes attributes = 2;
}
message CreateGpuGroupRequest {
enum GpuGroupType {
RDC_GROUP_DEFAULT = 0;
RDC_GROUP_EMPTY = 1;
}
GpuGroupType type = 1;
string group_name = 2;
}
message CreateGpuGroupResponse {
uint32 status = 1;
uint32 group_id = 2;
}
message AddToGpuGroupRequest {
uint32 group_id = 1;
uint32 gpu_index = 2;
}
message AddToGpuGroupResponse {
uint32 status = 1;
}
message CreateFieldGroupRequest {
repeated uint32 field_ids = 1;
string filed_group_name = 2;
}
message CreateFieldGroupResponse {
uint32 status = 1;
uint32 field_group_id = 2;
}
message GetFieldGroupInfoRequest {
uint32 field_group_id = 1;
}
message GetFieldGroupInfoResponse {
uint32 status = 1;
string filed_group_name = 2;
repeated uint32 field_ids = 3;
}
message GetGpuGroupInfoRequest {
uint32 group_id = 1;
}
message GetGpuGroupInfoResponse {
uint32 status = 1;
string group_name = 2;
repeated uint32 entity_ids = 3;
}
message DestroyGpuGroupRequest {
uint32 group_id = 1;
}
message DestroyGpuGroupResponse {
uint32 status = 1;
}
message DestroyFieldGroupRequest {
uint32 field_group_id = 1;
}
message DestroyFieldGroupResponse {
uint32 status = 1;
}
message WatchFieldsRequest {
uint32 group_id = 1;
uint32 field_group_id = 2;
uint64 update_freq = 3;
double max_keep_age = 4;
uint32 max_keep_samples = 5;
}
message WatchFieldsResponse {
uint32 status = 1;
}
message GetLatestFieldValueRequest {
uint32 gpu_index = 1;
uint32 field_id = 2;
}
message GetLatestFieldValueResponse {
uint32 status = 1;
uint32 field_id = 2;
uint32 rdc_status = 3;
uint64 ts = 4;
enum FieldType {
INTEGER = 0;
DOUBLE = 1;
STRING = 2;
BLOB = 3;
};
FieldType type = 5;
oneof value {
uint64 l_int = 6;
double dbl = 7;
string str = 8;
}
}
message GetFieldSinceRequest {
uint32 gpu_index = 1;
uint32 field_id = 2;
uint64 since_time_stamp = 3;
}
message GetFieldSinceResponse {
uint32 status = 1;
uint64 next_since_time_stamp = 2;
uint32 field_id = 3;
uint32 rdc_status = 4;
uint64 ts = 5;
enum FieldType {
INTEGER = 0;
DOUBLE = 1;
STRING = 2;
BLOB = 3;
};
FieldType type = 6;
oneof value {
uint64 l_int = 7;
double dbl = 8;
string str = 9;
}
}
message UnWatchFieldsRequest {
uint32 group_id = 1;
uint32 field_group_id = 2;
}
message UnWatchFieldsResponse {
uint32 status = 1;
}
message UpdateAllFieldsRequest {
uint32 wait_for_update = 1;
}
message UpdateAllFieldsResponse {
uint32 status = 1;
}