Add proto schema for GPU precompilation configs
Text instances of these protos will be generated by the
gpu_config_builder.
Generated proto code by executing the following from the `gpuconfig/` dir:
`go generate`
BUG=b/238798451
Change-Id: I75fad4a61e61c18273dbae7548653538be95f9c3
Reviewed-on: https://cos-review.googlesource.com/c/cos/tools/+/34840
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
Cloud-Build: GCB Service account <228075978874@cloudbuild.gserviceaccount.com>
Tested-by: Arnav Kansal <rnv@google.com>
diff --git a/src/pkg/gpuconfig/generate_configs.go b/src/pkg/gpuconfig/generate_configs.go
new file mode 100644
index 0000000..23d19a8
--- /dev/null
+++ b/src/pkg/gpuconfig/generate_configs.go
@@ -0,0 +1,8 @@
+// Package gpuconfig implements routines for manipulating proto based
+// GPU build configuration files.
+//
+// It also implements the construction of these configs for
+// the COS Image and the COS Kernel CI.
+package gpuconfig
+
+//go:generate protoc --go_out=:./pb -I. proto/config.proto
diff --git a/src/pkg/gpuconfig/pb/config.pb.go b/src/pkg/gpuconfig/pb/config.pb.go
new file mode 100644
index 0000000..620b4a5
--- /dev/null
+++ b/src/pkg/gpuconfig/pb/config.pb.go
@@ -0,0 +1,252 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.28.0
+// protoc v3.17.3
+// source: proto/config.proto
+
+package pb
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type COSGPUBuildRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Kernel source tarball in tgz or tar.gz format.
+ // Ex: for release builds,
+ //
+ // gs://cos-tools/16108.403.42/kernel-src.tar.gz
+ //
+ // Ex: for kernel CI builds, or for precompiled driver generation,
+ //
+ // gs://cos-kernel-artifacts/builds/5.10.105-23.m97/cos-kernel-src-5.10.105-23.m97.tgz,
+ KernelSrcTarballGcs *string `protobuf:"bytes,1,opt,name=kernel_src_tarball_gcs,json=kernelSrcTarballGcs,proto3,oneof" json:"kernel_src_tarball_gcs,omitempty"`
+ // Kernel headers tarball in tgz or tar.gz format.
+ // Ex: for release builds,
+ //
+ // gs://cos-tools/16108.403.42/kernel-headers.tgz
+ //
+ // Ex: for kernel CI builds, or for precompiled driver generation,
+ //
+ // gs://cos-kernel-artifacts/builds/5.10.105-23.m97/cos-kernel-headers-5.10.105-23.m97-x86_64.tgz
+ KernelHeadersTarballGcs *string `protobuf:"bytes,2,opt,name=kernel_headers_tarball_gcs,json=kernelHeadersTarballGcs,proto3,oneof" json:"kernel_headers_tarball_gcs,omitempty"`
+ // Nvidia driver .run file address.
+ // Ex:
+ // https://us.download.nvidia.com/tesla/450.119.04/NVIDIA-Linux-x86_64-450.119.04.run
+ NvidiaRunfileAddress *string `protobuf:"bytes,3,opt,name=nvidia_runfile_address,json=nvidiaRunfileAddress,proto3,oneof" json:"nvidia_runfile_address,omitempty"`
+ // Toolchain tarball in tar.xz format.
+ // Ex: for release builds,
+ //
+ // gs://cos-tools/16108.403.42/toolchain.tar.xz
+ //
+ // Ex: for kernel CI builds, or for precompiled driver generation,
+ //
+ // gs://cos-kernel-artifacts/builds/5.10.105-23.m97/toolchain.tar.xz
+ ToolchainTarballGcs *string `protobuf:"bytes,4,opt,name=toolchain_tarball_gcs,json=toolchainTarballGcs,proto3,oneof" json:"toolchain_tarball_gcs,omitempty"`
+ // Toolchain environment file
+ // Ex: for release builds,
+ //
+ // gs://cos-tools/16108.403.42/toolchain_env
+ //
+ // Ex: for kernel CI builds, or for precompiled driver generation,
+ //
+ // gs://cos-kernel-artifacts/builds/5.10.105-23.m97/toolchain_env
+ ToolchainEnvGcs *string `protobuf:"bytes,5,opt,name=toolchain_env_gcs,json=toolchainEnvGcs,proto3,oneof" json:"toolchain_env_gcs,omitempty"`
+ // Driver output gcs bucket
+ // This will be the gcs directory where the output of the build will be pushed
+ // as the precompiled driver file (self executing archive) Ex:
+ // gs://nvidia-drivers-us-public/nvidia-cos-project/5.10.105-23.m97/
+ DriverOutputGcsDir *string `protobuf:"bytes,6,opt,name=driver_output_gcs_dir,json=driverOutputGcsDir,proto3,oneof" json:"driver_output_gcs_dir,omitempty"`
+}
+
+func (x *COSGPUBuildRequest) Reset() {
+ *x = COSGPUBuildRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_proto_config_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *COSGPUBuildRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*COSGPUBuildRequest) ProtoMessage() {}
+
+func (x *COSGPUBuildRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_proto_config_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use COSGPUBuildRequest.ProtoReflect.Descriptor instead.
+func (*COSGPUBuildRequest) Descriptor() ([]byte, []int) {
+ return file_proto_config_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *COSGPUBuildRequest) GetKernelSrcTarballGcs() string {
+ if x != nil && x.KernelSrcTarballGcs != nil {
+ return *x.KernelSrcTarballGcs
+ }
+ return ""
+}
+
+func (x *COSGPUBuildRequest) GetKernelHeadersTarballGcs() string {
+ if x != nil && x.KernelHeadersTarballGcs != nil {
+ return *x.KernelHeadersTarballGcs
+ }
+ return ""
+}
+
+func (x *COSGPUBuildRequest) GetNvidiaRunfileAddress() string {
+ if x != nil && x.NvidiaRunfileAddress != nil {
+ return *x.NvidiaRunfileAddress
+ }
+ return ""
+}
+
+func (x *COSGPUBuildRequest) GetToolchainTarballGcs() string {
+ if x != nil && x.ToolchainTarballGcs != nil {
+ return *x.ToolchainTarballGcs
+ }
+ return ""
+}
+
+func (x *COSGPUBuildRequest) GetToolchainEnvGcs() string {
+ if x != nil && x.ToolchainEnvGcs != nil {
+ return *x.ToolchainEnvGcs
+ }
+ return ""
+}
+
+func (x *COSGPUBuildRequest) GetDriverOutputGcsDir() string {
+ if x != nil && x.DriverOutputGcsDir != nil {
+ return *x.DriverOutputGcsDir
+ }
+ return ""
+}
+
+var File_proto_config_proto protoreflect.FileDescriptor
+
+var file_proto_config_proto_rawDesc = []byte{
+ 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x67, 0x70, 0x75, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22,
+ 0x8c, 0x04, 0x0a, 0x12, 0x43, 0x4f, 0x53, 0x47, 0x50, 0x55, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x16, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c,
+ 0x5f, 0x73, 0x72, 0x63, 0x5f, 0x74, 0x61, 0x72, 0x62, 0x61, 0x6c, 0x6c, 0x5f, 0x67, 0x63, 0x73,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x13, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c,
+ 0x53, 0x72, 0x63, 0x54, 0x61, 0x72, 0x62, 0x61, 0x6c, 0x6c, 0x47, 0x63, 0x73, 0x88, 0x01, 0x01,
+ 0x12, 0x40, 0x0a, 0x1a, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65,
+ 0x72, 0x73, 0x5f, 0x74, 0x61, 0x72, 0x62, 0x61, 0x6c, 0x6c, 0x5f, 0x67, 0x63, 0x73, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x17, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x48, 0x65,
+ 0x61, 0x64, 0x65, 0x72, 0x73, 0x54, 0x61, 0x72, 0x62, 0x61, 0x6c, 0x6c, 0x47, 0x63, 0x73, 0x88,
+ 0x01, 0x01, 0x12, 0x39, 0x0a, 0x16, 0x6e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x5f, 0x72, 0x75, 0x6e,
+ 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x09, 0x48, 0x02, 0x52, 0x14, 0x6e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x52, 0x75, 0x6e, 0x66,
+ 0x69, 0x6c, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x88, 0x01, 0x01, 0x12, 0x37, 0x0a,
+ 0x15, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x74, 0x61, 0x72, 0x62, 0x61,
+ 0x6c, 0x6c, 0x5f, 0x67, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x13,
+ 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x62, 0x61, 0x6c, 0x6c,
+ 0x47, 0x63, 0x73, 0x88, 0x01, 0x01, 0x12, 0x2f, 0x0a, 0x11, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68,
+ 0x61, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x76, 0x5f, 0x67, 0x63, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28,
+ 0x09, 0x48, 0x04, 0x52, 0x0f, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x45, 0x6e,
+ 0x76, 0x47, 0x63, 0x73, 0x88, 0x01, 0x01, 0x12, 0x36, 0x0a, 0x15, 0x64, 0x72, 0x69, 0x76, 0x65,
+ 0x72, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x67, 0x63, 0x73, 0x5f, 0x64, 0x69, 0x72,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x05, 0x52, 0x12, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72,
+ 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x47, 0x63, 0x73, 0x44, 0x69, 0x72, 0x88, 0x01, 0x01, 0x42,
+ 0x19, 0x0a, 0x17, 0x5f, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x5f, 0x73, 0x72, 0x63, 0x5f, 0x74,
+ 0x61, 0x72, 0x62, 0x61, 0x6c, 0x6c, 0x5f, 0x67, 0x63, 0x73, 0x42, 0x1d, 0x0a, 0x1b, 0x5f, 0x6b,
+ 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x74, 0x61,
+ 0x72, 0x62, 0x61, 0x6c, 0x6c, 0x5f, 0x67, 0x63, 0x73, 0x42, 0x19, 0x0a, 0x17, 0x5f, 0x6e, 0x76,
+ 0x69, 0x64, 0x69, 0x61, 0x5f, 0x72, 0x75, 0x6e, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x61, 0x64, 0x64,
+ 0x72, 0x65, 0x73, 0x73, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61,
+ 0x69, 0x6e, 0x5f, 0x74, 0x61, 0x72, 0x62, 0x61, 0x6c, 0x6c, 0x5f, 0x67, 0x63, 0x73, 0x42, 0x14,
+ 0x0a, 0x12, 0x5f, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x76,
+ 0x5f, 0x67, 0x63, 0x73, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f,
+ 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x67, 0x63, 0x73, 0x5f, 0x64, 0x69, 0x72, 0x42, 0x06,
+ 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_proto_config_proto_rawDescOnce sync.Once
+ file_proto_config_proto_rawDescData = file_proto_config_proto_rawDesc
+)
+
+func file_proto_config_proto_rawDescGZIP() []byte {
+ file_proto_config_proto_rawDescOnce.Do(func() {
+ file_proto_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_config_proto_rawDescData)
+ })
+ return file_proto_config_proto_rawDescData
+}
+
+var file_proto_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
+var file_proto_config_proto_goTypes = []interface{}{
+ (*COSGPUBuildRequest)(nil), // 0: gpuconfig.COSGPUBuildRequest
+}
+var file_proto_config_proto_depIdxs = []int32{
+ 0, // [0:0] is the sub-list for method output_type
+ 0, // [0:0] is the sub-list for method input_type
+ 0, // [0:0] is the sub-list for extension type_name
+ 0, // [0:0] is the sub-list for extension extendee
+ 0, // [0:0] is the sub-list for field type_name
+}
+
+func init() { file_proto_config_proto_init() }
+func file_proto_config_proto_init() {
+ if File_proto_config_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_proto_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*COSGPUBuildRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ file_proto_config_proto_msgTypes[0].OneofWrappers = []interface{}{}
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_proto_config_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 1,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_proto_config_proto_goTypes,
+ DependencyIndexes: file_proto_config_proto_depIdxs,
+ MessageInfos: file_proto_config_proto_msgTypes,
+ }.Build()
+ File_proto_config_proto = out.File
+ file_proto_config_proto_rawDesc = nil
+ file_proto_config_proto_goTypes = nil
+ file_proto_config_proto_depIdxs = nil
+}
diff --git a/src/pkg/gpuconfig/proto/config.proto b/src/pkg/gpuconfig/proto/config.proto
new file mode 100644
index 0000000..cdf6993
--- /dev/null
+++ b/src/pkg/gpuconfig/proto/config.proto
@@ -0,0 +1,46 @@
+syntax = "proto3";
+
+package gpuconfig;
+
+option go_package = ".;pb";
+
+message COSGPUBuildRequest {
+ // Kernel source tarball in tgz or tar.gz format.
+ // Ex: for release builds,
+ // gs://cos-tools/16108.403.42/kernel-src.tar.gz
+ // Ex: for kernel CI builds, or for precompiled driver generation,
+ // gs://cos-kernel-artifacts/builds/5.10.105-23.m97/cos-kernel-src-5.10.105-23.m97.tgz,
+ optional string kernel_src_tarball_gcs = 1;
+
+ // Kernel headers tarball in tgz or tar.gz format.
+ // Ex: for release builds,
+ // gs://cos-tools/16108.403.42/kernel-headers.tgz
+ // Ex: for kernel CI builds, or for precompiled driver generation,
+ // gs://cos-kernel-artifacts/builds/5.10.105-23.m97/cos-kernel-headers-5.10.105-23.m97-x86_64.tgz
+ optional string kernel_headers_tarball_gcs = 2;
+
+ // Nvidia driver .run file address.
+ // Ex:
+ // https://us.download.nvidia.com/tesla/450.119.04/NVIDIA-Linux-x86_64-450.119.04.run
+ optional string nvidia_runfile_address = 3;
+
+ // Toolchain tarball in tar.xz format.
+ // Ex: for release builds,
+ // gs://cos-tools/16108.403.42/toolchain.tar.xz
+ // Ex: for kernel CI builds, or for precompiled driver generation,
+ // gs://cos-kernel-artifacts/builds/5.10.105-23.m97/toolchain.tar.xz
+ optional string toolchain_tarball_gcs = 4;
+
+ // Toolchain environment file
+ // Ex: for release builds,
+ // gs://cos-tools/16108.403.42/toolchain_env
+ // Ex: for kernel CI builds, or for precompiled driver generation,
+ // gs://cos-kernel-artifacts/builds/5.10.105-23.m97/toolchain_env
+ optional string toolchain_env_gcs = 5;
+
+ // Driver output gcs bucket
+ // This will be the gcs directory where the output of the build will be pushed
+ // as the precompiled driver file (self executing archive) Ex:
+ // gs://nvidia-drivers-us-public/nvidia-cos-project/5.10.105-23.m97/
+ optional string driver_output_gcs_dir = 6;
+}