From bd4d859572a29e8a77c04509443d97c185e69a50 Mon Sep 17 00:00:00 2001 From: Chetan Pandey <163017526+chetan-spheron@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:19:54 +0530 Subject: [PATCH] VRAMAvailablePercentage added (#10) * vram available added * type cange to int64 * Dup fix --- docs/proto/provider.md | 1 + go/inventory/v1/gpu.go | 24 ++-- go/inventory/v1/gpu.pb.go | 117 +++++++++++++------- proto/provider/akash/inventory/v1/gpu.proto | 5 + 4 files changed, 97 insertions(+), 50 deletions(-) diff --git a/docs/proto/provider.md b/docs/proto/provider.md index 229cef42..a09694e7 100644 --- a/docs/proto/provider.md +++ b/docs/proto/provider.md @@ -965,6 +965,7 @@ | `modelid` | [string](#string) | | | | `interface` | [string](#string) | | | | `memory_size` | [string](#string) | | | + | `vram_available_percentage` | [int64](#int64) | | | diff --git a/go/inventory/v1/gpu.go b/go/inventory/v1/gpu.go index 01038c24..213ae3f3 100644 --- a/go/inventory/v1/gpu.go +++ b/go/inventory/v1/gpu.go @@ -25,12 +25,13 @@ func (r *GPU) Dup() GPU { func (s *GPUInfo) Dup() GPUInfo { res := GPUInfo{ - Vendor: s.Vendor, - VendorID: s.VendorID, - Name: s.Name, - ModelID: s.ModelID, - Interface: s.Interface, - MemorySize: s.MemorySize, + Vendor: s.Vendor, + VendorID: s.VendorID, + Name: s.Name, + ModelID: s.ModelID, + Interface: s.Interface, + MemorySize: s.MemorySize, + VRAMAvailablePercentage: s.VRAMAvailablePercentage, } return res @@ -45,11 +46,12 @@ func (s GPUInfoS) Dup() GPUInfoS { for _, n := range s { res = append(res, GPUInfo{ - Vendor: n.Vendor, - Name: n.Name, - ModelID: n.ModelID, - Interface: n.Interface, - MemorySize: n.MemorySize, + Vendor: n.Vendor, + Name: n.Name, + ModelID: n.ModelID, + Interface: n.Interface, + MemorySize: n.MemorySize, + VRAMAvailablePercentage: n.VRAMAvailablePercentage, }) } diff --git a/go/inventory/v1/gpu.pb.go b/go/inventory/v1/gpu.pb.go index aafd8b58..3031b2c0 100644 --- a/go/inventory/v1/gpu.pb.go +++ b/go/inventory/v1/gpu.pb.go @@ -25,12 +25,13 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GPUInfo reports GPU details type GPUInfo struct { - Vendor string `protobuf:"bytes,1,opt,name=vendor,proto3" json:"vendor" yaml:"vendor"` - VendorID string `protobuf:"bytes,2,opt,name=vendor_id,json=vendorId,proto3" json:"vendor_id" yaml:"vendor_id"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name" yaml:"name"` - ModelID string `protobuf:"bytes,4,opt,name=modelid,proto3" json:"model_id" yaml:"model_id"` - Interface string `protobuf:"bytes,5,opt,name=interface,proto3" json:"interface" yaml:"interface"` - MemorySize string `protobuf:"bytes,6,opt,name=memory_size,json=memorySize,proto3" json:"memory_size" yaml:"memory_size"` + Vendor string `protobuf:"bytes,1,opt,name=vendor,proto3" json:"vendor" yaml:"vendor"` + VendorID string `protobuf:"bytes,2,opt,name=vendor_id,json=vendorId,proto3" json:"vendor_id" yaml:"vendor_id"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name" yaml:"name"` + ModelID string `protobuf:"bytes,4,opt,name=modelid,proto3" json:"model_id" yaml:"model_id"` + Interface string `protobuf:"bytes,5,opt,name=interface,proto3" json:"interface" yaml:"interface"` + MemorySize string `protobuf:"bytes,6,opt,name=memory_size,json=memorySize,proto3" json:"memory_size" yaml:"memory_size"` + VRAMAvailablePercentage int64 `protobuf:"varint,7,opt,name=vram_available_percentage,json=vramAvailablePercentage,proto3" json:"vram_available_percentage" yaml:"vram_available_percentage"` } func (m *GPUInfo) Reset() { *m = GPUInfo{} } @@ -108,6 +109,13 @@ func (m *GPUInfo) GetMemorySize() string { return "" } +func (m *GPUInfo) GetVRAMAvailablePercentage() int64 { + if m != nil { + return m.VRAMAvailablePercentage + } + return 0 +} + // GPUInfo reports GPU inventory details type GPU struct { Quantity ResourcePair `protobuf:"bytes,1,opt,name=quantity,proto3" json:"quantity" yaml:"quantity"` @@ -169,39 +177,43 @@ func init() { func init() { proto.RegisterFile("akash/inventory/v1/gpu.proto", fileDescriptor_2cc01b12bd00ffcc) } var fileDescriptor_2cc01b12bd00ffcc = []byte{ - // 511 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcf, 0x6e, 0xd3, 0x30, - 0x18, 0x6f, 0xd6, 0xd2, 0xb5, 0xae, 0x10, 0xc8, 0xe2, 0x10, 0x0d, 0x14, 0x57, 0x96, 0x26, 0x4d, - 0x48, 0x4d, 0xb4, 0x95, 0x13, 0x12, 0x97, 0x6a, 0x62, 0x2a, 0x62, 0x53, 0xc9, 0x18, 0x07, 0x2e, - 0xc5, 0x6b, 0xdc, 0xd4, 0xda, 0x62, 0x07, 0x37, 0xad, 0xd4, 0x3d, 0x05, 0xcf, 0xc1, 0x95, 0x97, - 0xd8, 0x71, 0x27, 0xc4, 0xc9, 0xa0, 0xf4, 0xd6, 0x63, 0x9f, 0x00, 0xd9, 0xf9, 0x37, 0xc4, 0x6e, - 0xfe, 0x7e, 0xff, 0x3e, 0xdb, 0xdf, 0x07, 0x5e, 0x90, 0x2b, 0x32, 0x9f, 0x79, 0x8c, 0x2f, 0x29, - 0x4f, 0x84, 0x5c, 0x79, 0xcb, 0x43, 0x2f, 0x8c, 0x17, 0x6e, 0x2c, 0x45, 0x22, 0x20, 0x34, 0xac, - 0x5b, 0xb2, 0xee, 0xf2, 0x70, 0xef, 0x59, 0x28, 0x42, 0x61, 0x68, 0x4f, 0x9f, 0x32, 0xe5, 0xde, - 0xfe, 0x03, 0x39, 0x92, 0xce, 0xc5, 0x42, 0x4e, 0x68, 0x4c, 0x98, 0xcc, 0x64, 0xf8, 0x47, 0x1d, - 0xec, 0x9e, 0x8c, 0x2e, 0x86, 0x7c, 0x2a, 0xe0, 0x1b, 0xd0, 0x5c, 0x52, 0x1e, 0x08, 0x69, 0x5b, - 0x5d, 0xeb, 0xa0, 0x3d, 0xd8, 0x4f, 0x15, 0x6a, 0x7e, 0x32, 0xc8, 0x46, 0xa1, 0x9c, 0xdb, 0x2a, - 0xf4, 0x78, 0x45, 0xa2, 0xeb, 0xd7, 0x38, 0xab, 0xb1, 0x9f, 0x13, 0xf0, 0x1d, 0x68, 0x67, 0xa7, - 0x31, 0x0b, 0xec, 0x1d, 0x93, 0xd0, 0x4b, 0x15, 0x6a, 0x65, 0x09, 0xc3, 0xe3, 0x8d, 0x42, 0x95, - 0x60, 0xab, 0xd0, 0xd3, 0xfb, 0x31, 0x63, 0x16, 0x60, 0xbf, 0x95, 0x9d, 0x87, 0x01, 0xec, 0x83, - 0x06, 0x27, 0x11, 0xb5, 0xeb, 0x26, 0x06, 0xa5, 0x0a, 0x35, 0xce, 0x48, 0x44, 0x37, 0x0a, 0x19, - 0x7c, 0xab, 0x50, 0x27, 0x73, 0xeb, 0x0a, 0xfb, 0x06, 0x84, 0xc7, 0x60, 0x37, 0x12, 0x01, 0xbd, - 0x66, 0x81, 0xdd, 0x30, 0xbe, 0x97, 0xa9, 0x42, 0xbb, 0xa7, 0x1a, 0x32, 0xdd, 0x5b, 0x86, 0xcd, - 0x9a, 0x3f, 0xc9, 0xec, 0x05, 0x82, 0xfd, 0xc2, 0x0a, 0xdf, 0x83, 0x36, 0xe3, 0x09, 0x95, 0x53, - 0x32, 0xa1, 0xf6, 0x23, 0x93, 0xe3, 0xa6, 0x0a, 0xb5, 0x87, 0x05, 0xa8, 0xdf, 0x51, 0x2a, 0xaa, - 0x77, 0x94, 0x10, 0xf6, 0x2b, 0x1a, 0x7e, 0x04, 0x9d, 0x88, 0x46, 0x42, 0xae, 0xc6, 0x73, 0x76, - 0x43, 0xed, 0xa6, 0xc9, 0xeb, 0xa7, 0x0a, 0x81, 0x53, 0x03, 0x9f, 0xb3, 0x1b, 0x1d, 0x78, 0x5f, - 0xb4, 0x55, 0x08, 0xe6, 0xb7, 0xab, 0x40, 0xec, 0x83, 0xa8, 0x34, 0xe0, 0x9f, 0x16, 0xa8, 0x9f, - 0x8c, 0x2e, 0x60, 0x04, 0x5a, 0x5f, 0x17, 0x84, 0x27, 0x2c, 0x59, 0x99, 0x99, 0x75, 0x8e, 0xba, - 0xee, 0xff, 0x1b, 0xe2, 0xfa, 0xf9, 0xdc, 0x47, 0x84, 0xc9, 0x81, 0x77, 0xab, 0x50, 0x4d, 0xcf, - 0xe5, 0x43, 0xee, 0xd4, 0x3f, 0x53, 0xa4, 0x54, 0x3f, 0x53, 0x20, 0xd8, 0x2f, 0x49, 0xf8, 0x05, - 0x34, 0x18, 0x9f, 0x0a, 0x7b, 0xa7, 0x5b, 0x3f, 0xe8, 0x1c, 0x3d, 0x7f, 0xa8, 0x55, 0xbe, 0x4b, - 0x65, 0x97, 0x86, 0xae, 0xf4, 0xd8, 0xb4, 0xb1, 0x1a, 0x9b, 0xae, 0xf0, 0xf7, 0xdf, 0xa8, 0x95, - 0xeb, 0xcf, 0x7d, 0x23, 0x18, 0x9c, 0xdd, 0xa6, 0x8e, 0x75, 0x97, 0x3a, 0xd6, 0x9f, 0xd4, 0xb1, - 0xbe, 0xad, 0x9d, 0xda, 0xdd, 0xda, 0xa9, 0xfd, 0x5a, 0x3b, 0xb5, 0xcf, 0xaf, 0x42, 0x96, 0xcc, - 0x16, 0x97, 0xee, 0x44, 0x44, 0xde, 0x3c, 0x9e, 0x51, 0x29, 0xf8, 0xdb, 0x80, 0x7b, 0xe6, 0x0a, - 0x3d, 0x12, 0xb3, 0xde, 0x54, 0xc8, 0x2b, 0x2f, 0x14, 0xff, 0x6c, 0xfc, 0x65, 0xd3, 0x6c, 0x79, - 0xff, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb0, 0x51, 0x58, 0xf7, 0x56, 0x03, 0x00, 0x00, + // 574 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x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6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd0, 0x99, 0xfb, 0x49, 0xf1, 0x03, 0x00, 0x00, } func (m *GPUInfo) Marshal() (dAtA []byte, err error) { @@ -224,6 +236,11 @@ func (m *GPUInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.VRAMAvailablePercentage != 0 { + i = encodeVarintGpu(dAtA, i, uint64(m.VRAMAvailablePercentage)) + i-- + dAtA[i] = 0x38 + } if len(m.MemorySize) > 0 { i -= len(m.MemorySize) copy(dAtA[i:], m.MemorySize) @@ -357,6 +374,9 @@ func (m *GPUInfo) Size() (n int) { if l > 0 { n += 1 + l + sovGpu(uint64(l)) } + if m.VRAMAvailablePercentage != 0 { + n += 1 + sovGpu(uint64(m.VRAMAvailablePercentage)) + } return n } @@ -604,6 +624,25 @@ func (m *GPUInfo) Unmarshal(dAtA []byte) error { } m.MemorySize = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VRAMAvailablePercentage", wireType) + } + m.VRAMAvailablePercentage = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGpu + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VRAMAvailablePercentage |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipGpu(dAtA[iNdEx:]) diff --git a/proto/provider/akash/inventory/v1/gpu.proto b/proto/provider/akash/inventory/v1/gpu.proto index cf6f1b1f..68ae9bf9 100644 --- a/proto/provider/akash/inventory/v1/gpu.proto +++ b/proto/provider/akash/inventory/v1/gpu.proto @@ -41,6 +41,11 @@ message GPUInfo { (gogoproto.jsontag) = "memory_size", (gogoproto.moretags) = "yaml:\"memory_size\"" ]; + int64 vram_available_percentage = 7 [ + (gogoproto.customname) = "VRAMAvailablePercentage", + (gogoproto.jsontag) = "vram_available_percentage", + (gogoproto.moretags) = "yaml:\"vram_available_percentage\"" + ]; } // GPUInfo reports GPU inventory details