Skip to content

Commit

Permalink
Rename type used to provide indirection for V() style methods
Browse files Browse the repository at this point in the history
This is technically a breaking change, but I can't imagine there being anyone
who creates a variable to one of these types. If they do, I imagine they use
the `:=` syntax and not the explicit `var` syntax, so they won't be naming the
tspe anyway. I'm OK breaking the 1 person who this might affect.

Signed-off-by: Kevin Klues <kklues@nvidia.com>
  • Loading branch information
klueska committed May 24, 2024
1 parent 3ff490b commit e035a38
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
32 changes: 16 additions & 16 deletions pkg/nvml/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -2085,28 +2085,28 @@ func (device nvmlDevice) GetGpuInstanceProfileInfo(profile int) (GpuInstanceProf
}

// nvml.DeviceGetGpuInstanceProfileInfoV()
type GpuInstanceProfileInfoV struct {
type GpuInstanceProfileInfoHandler struct {
device nvmlDevice
profile int
}

func (infoV GpuInstanceProfileInfoV) V1() (GpuInstanceProfileInfo, Return) {
return DeviceGetGpuInstanceProfileInfo(infoV.device, infoV.profile)
func (handler GpuInstanceProfileInfoHandler) V1() (GpuInstanceProfileInfo, Return) {
return DeviceGetGpuInstanceProfileInfo(handler.device, handler.profile)
}

func (infoV GpuInstanceProfileInfoV) V2() (GpuInstanceProfileInfo_v2, Return) {
func (handler GpuInstanceProfileInfoHandler) V2() (GpuInstanceProfileInfo_v2, Return) {
var info GpuInstanceProfileInfo_v2
info.Version = STRUCT_VERSION(info, 2)
ret := nvmlDeviceGetGpuInstanceProfileInfoV(infoV.device, uint32(infoV.profile), &info)
ret := nvmlDeviceGetGpuInstanceProfileInfoV(handler.device, uint32(handler.profile), &info)
return info, ret
}

func (l *library) DeviceGetGpuInstanceProfileInfoV(device Device, profile int) GpuInstanceProfileInfoV {
func (l *library) DeviceGetGpuInstanceProfileInfoV(device Device, profile int) GpuInstanceProfileInfoHandler {
return device.GetGpuInstanceProfileInfoV(profile)
}

func (device nvmlDevice) GetGpuInstanceProfileInfoV(profile int) GpuInstanceProfileInfoV {
return GpuInstanceProfileInfoV{device, profile}
func (device nvmlDevice) GetGpuInstanceProfileInfoV(profile int) GpuInstanceProfileInfoHandler {
return GpuInstanceProfileInfoHandler{device, profile}
}

// nvml.DeviceGetGpuInstancePossiblePlacements()
Expand Down Expand Up @@ -2231,29 +2231,29 @@ func (gpuInstance nvmlGpuInstance) GetComputeInstanceProfileInfo(profile int, en
}

// nvml.GpuInstanceGetComputeInstanceProfileInfoV()
type ComputeInstanceProfileInfoV struct {
type ComputeInstanceProfileInfoHandler struct {
gpuInstance nvmlGpuInstance
profile int
engProfile int
}

func (infoV ComputeInstanceProfileInfoV) V1() (ComputeInstanceProfileInfo, Return) {
return GpuInstanceGetComputeInstanceProfileInfo(infoV.gpuInstance, infoV.profile, infoV.engProfile)
func (handler ComputeInstanceProfileInfoHandler) V1() (ComputeInstanceProfileInfo, Return) {
return GpuInstanceGetComputeInstanceProfileInfo(handler.gpuInstance, handler.profile, handler.engProfile)
}

func (infoV ComputeInstanceProfileInfoV) V2() (ComputeInstanceProfileInfo_v2, Return) {
func (handler ComputeInstanceProfileInfoHandler) V2() (ComputeInstanceProfileInfo_v2, Return) {
var info ComputeInstanceProfileInfo_v2
info.Version = STRUCT_VERSION(info, 2)
ret := nvmlGpuInstanceGetComputeInstanceProfileInfoV(infoV.gpuInstance, uint32(infoV.profile), uint32(infoV.engProfile), &info)
ret := nvmlGpuInstanceGetComputeInstanceProfileInfoV(handler.gpuInstance, uint32(handler.profile), uint32(handler.engProfile), &info)
return info, ret
}

func (l *library) GpuInstanceGetComputeInstanceProfileInfoV(gpuInstance GpuInstance, profile int, engProfile int) ComputeInstanceProfileInfoV {
func (l *library) GpuInstanceGetComputeInstanceProfileInfoV(gpuInstance GpuInstance, profile int, engProfile int) ComputeInstanceProfileInfoHandler {
return gpuInstance.GetComputeInstanceProfileInfoV(profile, engProfile)
}

func (gpuInstance nvmlGpuInstance) GetComputeInstanceProfileInfoV(profile int, engProfile int) ComputeInstanceProfileInfoV {
return ComputeInstanceProfileInfoV{gpuInstance, profile, engProfile}
func (gpuInstance nvmlGpuInstance) GetComputeInstanceProfileInfoV(profile int, engProfile int) ComputeInstanceProfileInfoHandler {
return ComputeInstanceProfileInfoHandler{gpuInstance, profile, engProfile}
}

// nvml.GpuInstanceGetComputeInstanceRemainingCapacity()
Expand Down
6 changes: 3 additions & 3 deletions pkg/nvml/mock/device.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/nvml/mock/gpuinstance.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pkg/nvml/mock/interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pkg/nvml/zz_generated.api.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ type Interface interface {
DeviceGetGpuInstanceId(Device) (int, Return)
DeviceGetGpuInstancePossiblePlacements(Device, *GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return)
DeviceGetGpuInstanceProfileInfo(Device, int) (GpuInstanceProfileInfo, Return)
DeviceGetGpuInstanceProfileInfoV(Device, int) GpuInstanceProfileInfoV
DeviceGetGpuInstanceProfileInfoV(Device, int) GpuInstanceProfileInfoHandler
DeviceGetGpuInstanceRemainingCapacity(Device, *GpuInstanceProfileInfo) (int, Return)
DeviceGetGpuInstances(Device, *GpuInstanceProfileInfo) ([]GpuInstance, Return)
DeviceGetGpuMaxPcieLinkGeneration(Device) (int, Return)
Expand Down Expand Up @@ -549,7 +549,7 @@ type Interface interface {
GpuInstanceGetComputeInstanceById(GpuInstance, int) (ComputeInstance, Return)
GpuInstanceGetComputeInstancePossiblePlacements(GpuInstance, *ComputeInstanceProfileInfo) ([]ComputeInstancePlacement, Return)
GpuInstanceGetComputeInstanceProfileInfo(GpuInstance, int, int) (ComputeInstanceProfileInfo, Return)
GpuInstanceGetComputeInstanceProfileInfoV(GpuInstance, int, int) ComputeInstanceProfileInfoV
GpuInstanceGetComputeInstanceProfileInfoV(GpuInstance, int, int) ComputeInstanceProfileInfoHandler
GpuInstanceGetComputeInstanceRemainingCapacity(GpuInstance, *ComputeInstanceProfileInfo) (int, Return)
GpuInstanceGetComputeInstances(GpuInstance, *ComputeInstanceProfileInfo) ([]ComputeInstance, Return)
GpuInstanceGetInfo(GpuInstance) (GpuInstanceInfo, Return)
Expand Down Expand Up @@ -681,7 +681,7 @@ type Device interface {
GetGpuInstanceId() (int, Return)
GetGpuInstancePossiblePlacements(*GpuInstanceProfileInfo) ([]GpuInstancePlacement, Return)
GetGpuInstanceProfileInfo(int) (GpuInstanceProfileInfo, Return)
GetGpuInstanceProfileInfoV(int) GpuInstanceProfileInfoV
GetGpuInstanceProfileInfoV(int) GpuInstanceProfileInfoHandler
GetGpuInstanceRemainingCapacity(*GpuInstanceProfileInfo) (int, Return)
GetGpuInstances(*GpuInstanceProfileInfo) ([]GpuInstance, Return)
GetGpuMaxPcieLinkGeneration() (int, Return)
Expand Down Expand Up @@ -827,7 +827,7 @@ type GpuInstance interface {
GetComputeInstanceById(int) (ComputeInstance, Return)
GetComputeInstancePossiblePlacements(*ComputeInstanceProfileInfo) ([]ComputeInstancePlacement, Return)
GetComputeInstanceProfileInfo(int, int) (ComputeInstanceProfileInfo, Return)
GetComputeInstanceProfileInfoV(int, int) ComputeInstanceProfileInfoV
GetComputeInstanceProfileInfoV(int, int) ComputeInstanceProfileInfoHandler
GetComputeInstanceRemainingCapacity(*ComputeInstanceProfileInfo) (int, Return)
GetComputeInstances(*ComputeInstanceProfileInfo) ([]ComputeInstance, Return)
GetInfo() (GpuInstanceInfo, Return)
Expand Down

0 comments on commit e035a38

Please sign in to comment.